some little changes
This commit is contained in:
parent
ef6a55b385
commit
d2631fef96
@ -22,7 +22,7 @@ namespace DTLib.ConsoleGUI
|
|||||||
|
|
||||||
void ParseLayoutFile(string layout_file)
|
void ParseLayoutFile(string layout_file)
|
||||||
{
|
{
|
||||||
DtsodV22 layout = new(File.ReadAllText(layout_file));
|
DtsodV23 layout = new(File.ReadAllText(layout_file));
|
||||||
AnchorPoint = (layout[Name]["anchor"][0], layout[Name]["anchor"][1]);
|
AnchorPoint = (layout[Name]["anchor"][0], layout[Name]["anchor"][1]);
|
||||||
Width = layout[Name]["width"];
|
Width = layout[Name]["width"];
|
||||||
Height = layout[Name]["height"];
|
Height = layout[Name]["height"];
|
||||||
|
|||||||
@ -40,6 +40,7 @@
|
|||||||
<Compile Include="ConsoleGUI\Window.cs" />
|
<Compile Include="ConsoleGUI\Window.cs" />
|
||||||
<Compile Include="ConsoleGUI\WindowOld.cs" />
|
<Compile Include="ConsoleGUI\WindowOld.cs" />
|
||||||
<Compile Include="Dtsod\DtsodV22.cs" />
|
<Compile Include="Dtsod\DtsodV22.cs" />
|
||||||
|
<Compile Include="Dtsod\DtsodV23.cs" />
|
||||||
<Compile Include="Dtsod\DtsodV21.cs" />
|
<Compile Include="Dtsod\DtsodV21.cs" />
|
||||||
<Compile Include="cs9somefix.cs" />
|
<Compile Include="cs9somefix.cs" />
|
||||||
<Compile Include="Dtsod\ValueTypes.cs" />
|
<Compile Include="Dtsod\ValueTypes.cs" />
|
||||||
@ -53,6 +54,7 @@
|
|||||||
<Compile Include="Network\OldNetwork.cs" />
|
<Compile Include="Network\OldNetwork.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Hasher.cs" />
|
<Compile Include="Hasher.cs" />
|
||||||
|
<Compile Include="SafeMutex.cs" />
|
||||||
<Compile Include="SecureRandom.cs" />
|
<Compile Include="SecureRandom.cs" />
|
||||||
<Compile Include="SimpleConverter.cs" />
|
<Compile Include="SimpleConverter.cs" />
|
||||||
<Compile Include="TImer.cs" />
|
<Compile Include="TImer.cs" />
|
||||||
|
|||||||
@ -168,7 +168,7 @@ namespace DTLib.Network
|
|||||||
if (!dirOnClient.EndsWith("\\")) dirOnClient += "\\";
|
if (!dirOnClient.EndsWith("\\")) dirOnClient += "\\";
|
||||||
if (!dirOnServer.EndsWith("\\")) dirOnServer += "\\";
|
if (!dirOnServer.EndsWith("\\")) dirOnServer += "\\";
|
||||||
Debug("b", "downloading manifest <", "c", dirOnServer + "manifest.dtsod", "b", ">\n");
|
Debug("b", "downloading manifest <", "c", dirOnServer + "manifest.dtsod", "b", ">\n");
|
||||||
var manifest = new DtsodV22(DownloadFileToMemory(dirOnServer + "manifest.dtsod").ToStr());
|
var manifest = new DtsodV23(DownloadFileToMemory(dirOnServer + "manifest.dtsod").ToStr());
|
||||||
Debug("g", $"found {manifest.Values.Count} files in manifest\n");
|
Debug("g", $"found {manifest.Values.Count} files in manifest\n");
|
||||||
var hasher = new Hasher();
|
var hasher = new Hasher();
|
||||||
foreach (string fileOnServer in manifest.Keys)
|
foreach (string fileOnServer in manifest.Keys)
|
||||||
@ -211,7 +211,7 @@ namespace DTLib.Network
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateManifest(string dir)
|
public static DtsodV23 CreateManifest(string dir)
|
||||||
{
|
{
|
||||||
if (!dir.EndsWith("\\")) dir += "\\";
|
if (!dir.EndsWith("\\")) dir += "\\";
|
||||||
Log($"b", $"creating manifest of {dir}\n");
|
Log($"b", $"creating manifest of {dir}\n");
|
||||||
@ -227,15 +227,15 @@ namespace DTLib.Network
|
|||||||
manifestBuilder.Append(hash.HashToString());
|
manifestBuilder.Append(hash.HashToString());
|
||||||
manifestBuilder.Append("\";\n");
|
manifestBuilder.Append("\";\n");
|
||||||
}
|
}
|
||||||
File.WriteAllText(dir + "manifest.dtsod", manifestBuilder.ToString());
|
Debug($"g", $" manifest of {dir} created\n");
|
||||||
Log($"g", $" manifest of {dir} created\n");
|
return new DtsodV23(manifestBuilder.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Debug(params string[] msg)
|
static void Debug(params string[] msg)
|
||||||
{
|
{
|
||||||
if (debug) Log(msg);
|
if (debug) Log(msg);
|
||||||
}
|
}
|
||||||
void DebugNoTime(params string[] msg)
|
static void DebugNoTime(params string[] msg)
|
||||||
{
|
{
|
||||||
if (debug) LogNoTime(msg);
|
if (debug) LogNoTime(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,5 +53,11 @@ namespace DTLib.Network
|
|||||||
var rec = socket.GetPackage().ToStr();
|
var rec = socket.GetPackage().ToStr();
|
||||||
if (rec != answer) throw new Exception($"GetAnswer() error: invalid answer: <{rec}>");
|
if (rec != answer) throw new Exception($"GetAnswer() error: invalid answer: <{rec}>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte[] RequestPackage(this Socket socket, byte[] request)
|
||||||
|
{
|
||||||
|
socket.SendPackage(request);
|
||||||
|
return socket.GetPackage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user