Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f479f63662 |
@ -2,17 +2,10 @@
|
|||||||
|
|
||||||
internal static partial class Kernel32
|
internal static partial class Kernel32
|
||||||
{
|
{
|
||||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
|
||||||
public static partial bool GetConsoleScreenBufferInfo(nint hConsoleOutput, out ConsoleScreenBufferInfo lpConsoleScreenBufferInfo);
|
|
||||||
|
|
||||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
|
||||||
public static partial nint GetConsoleWindow();
|
|
||||||
|
|
||||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||||
public static partial uint GetFinalPathNameByHandleA(nint hFile, [MarshalAs(UnmanagedType.LPTStr)] string lpszFilePath,
|
public static partial uint GetFinalPathNameByHandleA(nint hFile, [MarshalAs(UnmanagedType.LPTStr)] string lpszFilePath,
|
||||||
uint cchFilePath, uint dwFlags);
|
uint cchFilePath, uint dwFlags);
|
||||||
|
|
||||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
[LibraryImport("kernel32.dll")]
|
||||||
public static partial nuint GlobalSize(nint hPtr);
|
public static partial nuint GlobalSize(nint hPtr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
namespace SrcMod.Shell.Interop.ObjectModels;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal struct ConsoleScreenBufferInfo
|
|
||||||
{
|
|
||||||
[MarshalAs(UnmanagedType.LPStruct)]
|
|
||||||
public Coord dwSize;
|
|
||||||
[MarshalAs(UnmanagedType.LPStruct)]
|
|
||||||
public Coord dwCursorPosition;
|
|
||||||
public int wAttributes;
|
|
||||||
[MarshalAs(UnmanagedType.LPStruct)]
|
|
||||||
public SmallRect srWindow;
|
|
||||||
[MarshalAs(UnmanagedType.LPStruct)]
|
|
||||||
public Coord dwMaximumWindowSize;
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
namespace SrcMod.Shell.Interop.ObjectModels;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal struct Coord
|
|
||||||
{
|
|
||||||
public short X;
|
|
||||||
public short Y;
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
namespace SrcMod.Shell.Interop.ObjectModels;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal struct SmallRect
|
|
||||||
{
|
|
||||||
public short Left;
|
|
||||||
public short Top;
|
|
||||||
public short Right;
|
|
||||||
public short Bottom;
|
|
||||||
}
|
|
||||||
@ -6,7 +6,6 @@ global using SharpCompress.Archives.SevenZip;
|
|||||||
global using SharpCompress.Readers;
|
global using SharpCompress.Readers;
|
||||||
global using SrcMod.Shell.Extensions;
|
global using SrcMod.Shell.Extensions;
|
||||||
global using SrcMod.Shell.Interop;
|
global using SrcMod.Shell.Interop;
|
||||||
global using SrcMod.Shell.Interop.ObjectModels;
|
|
||||||
global using SrcMod.Shell.Modules;
|
global using SrcMod.Shell.Modules;
|
||||||
global using SrcMod.Shell.Modules.ObjectModels;
|
global using SrcMod.Shell.Modules.ObjectModels;
|
||||||
global using SrcMod.Shell.ObjectModels;
|
global using SrcMod.Shell.ObjectModels;
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
namespace SrcMod.Shell.Modules.Valve;
|
|
||||||
|
|
||||||
[Module("vkv")]
|
|
||||||
public static class VkvModule
|
|
||||||
{
|
|
||||||
[Command("create")]
|
|
||||||
public static void CreateVkv(string path)
|
|
||||||
{
|
|
||||||
if (File.Exists(path)) throw new($"File already exists at \"{path}\". Did you mean to run \"vkv edit\"?");
|
|
||||||
|
|
||||||
VkvNode parentNode = new VkvTreeNode()
|
|
||||||
{
|
|
||||||
{ "key", new VkvSingleNode("value") }
|
|
||||||
};
|
|
||||||
string parentNodeName = "tree";
|
|
||||||
|
|
||||||
VkvModifyWhole(ref parentNode, ref parentNodeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void VkvModifyWhole(ref VkvNode node, ref string nodeName)
|
|
||||||
{
|
|
||||||
VkvDisplayNode(node, nodeName);
|
|
||||||
}
|
|
||||||
private static void VkvDisplayNode(in VkvNode? node, in string nodeName, in int indent = 0)
|
|
||||||
{
|
|
||||||
int spaceCount = indent * 4;
|
|
||||||
|
|
||||||
if (node is null) return;
|
|
||||||
else if (node is VkvSingleNode single)
|
|
||||||
{
|
|
||||||
Write(new string(' ', spaceCount) + $"\"{nodeName}\" \"{single.value}\"");
|
|
||||||
}
|
|
||||||
else if (node is VkvTreeNode tree)
|
|
||||||
{
|
|
||||||
Write(new string(' ', spaceCount) + $"\"{nodeName}\"\n" + new string(' ', spaceCount) + "{");
|
|
||||||
foreach (KeyValuePair<string, VkvNode?> subNode in tree)
|
|
||||||
{
|
|
||||||
VkvDisplayNode(subNode.Value, subNode.Key, indent + 1);
|
|
||||||
}
|
|
||||||
Write(new string(' ', spaceCount) + "}");
|
|
||||||
}
|
|
||||||
else return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user