fixed dependencies
This commit is contained in:
parent
538db682f3
commit
c201f11ce1
63
.gitattributes
vendored
63
.gitattributes
vendored
@ -1,63 +0,0 @@
|
|||||||
###############################################################################
|
|
||||||
# Set default behavior to automatically normalize line endings.
|
|
||||||
###############################################################################
|
|
||||||
* text=auto
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Set default behavior for command prompt diff.
|
|
||||||
#
|
|
||||||
# This is need for earlier builds of msysgit that does not have it on by
|
|
||||||
# default for csharp files.
|
|
||||||
# Note: This is only used by command line
|
|
||||||
###############################################################################
|
|
||||||
#*.cs diff=csharp
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Set the merge driver for project and solution files
|
|
||||||
#
|
|
||||||
# Merging from the command prompt will add diff markers to the files if there
|
|
||||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
|
||||||
# the diff markers are never inserted). Diff markers may cause the following
|
|
||||||
# file extensions to fail to load in VS. An alternative would be to treat
|
|
||||||
# these files as binary and thus will always conflict and require user
|
|
||||||
# intervention with every merge. To do so, just uncomment the entries below
|
|
||||||
###############################################################################
|
|
||||||
#*.sln merge=binary
|
|
||||||
#*.csproj merge=binary
|
|
||||||
#*.vbproj merge=binary
|
|
||||||
#*.vcxproj merge=binary
|
|
||||||
#*.vcproj merge=binary
|
|
||||||
#*.dbproj merge=binary
|
|
||||||
#*.fsproj merge=binary
|
|
||||||
#*.lsproj merge=binary
|
|
||||||
#*.wixproj merge=binary
|
|
||||||
#*.modelproj merge=binary
|
|
||||||
#*.sqlproj merge=binary
|
|
||||||
#*.wwaproj merge=binary
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# behavior for image files
|
|
||||||
#
|
|
||||||
# image files are treated as binary by default.
|
|
||||||
###############################################################################
|
|
||||||
#*.jpg binary
|
|
||||||
#*.png binary
|
|
||||||
#*.gif binary
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# diff behavior for common document formats
|
|
||||||
#
|
|
||||||
# Convert binary document formats to text before diffing them. This feature
|
|
||||||
# is only available from the command line. Turn it on by uncommenting the
|
|
||||||
# entries below.
|
|
||||||
###############################################################################
|
|
||||||
#*.doc diff=astextplain
|
|
||||||
#*.DOC diff=astextplain
|
|
||||||
#*.docx diff=astextplain
|
|
||||||
#*.DOCX diff=astextplain
|
|
||||||
#*.dot diff=astextplain
|
|
||||||
#*.DOT diff=astextplain
|
|
||||||
#*.pdf diff=astextplain
|
|
||||||
#*.PDF diff=astextplain
|
|
||||||
#*.rtf diff=astextplain
|
|
||||||
#*.RTF diff=astextplain
|
|
||||||
@ -87,7 +87,7 @@ namespace dtlauncher_client_win
|
|||||||
public void Log(string msg)
|
public void Log(string msg)
|
||||||
{
|
{
|
||||||
if (LogBox.Text[LogBox.Text.Length - 1] == '\n') msg = "[" + DateTime.Now.ToString() + "]: " + msg;
|
if (LogBox.Text[LogBox.Text.Length - 1] == '\n') msg = "[" + DateTime.Now.ToString() + "]: " + msg;
|
||||||
OldFilework.LogToFile(logfile, msg);
|
File.AppendAllText(logfile, msg);
|
||||||
LogBox.Text += msg;
|
LogBox.Text += msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using DTLib;
|
|||||||
using DTLib.Dtsod;
|
using DTLib.Dtsod;
|
||||||
using DTLib.Filesystem;
|
using DTLib.Filesystem;
|
||||||
using DTLib.Network;
|
using DTLib.Network;
|
||||||
|
using DTLib.Extensions;
|
||||||
|
|
||||||
namespace dtlauncher_client_win
|
namespace dtlauncher_client_win
|
||||||
{
|
{
|
||||||
@ -126,7 +127,7 @@ namespace dtlauncher_client_win
|
|||||||
public void Log(string msg)
|
public void Log(string msg)
|
||||||
{
|
{
|
||||||
if (LogBox.Text[LogBox.Text.Length - 1] == '\n') msg = "[" + DateTime.Now.ToString() + "]: " + msg;
|
if (LogBox.Text[LogBox.Text.Length - 1] == '\n') msg = "[" + DateTime.Now.ToString() + "]: " + msg;
|
||||||
OldFilework.LogToFile(logfile, msg);
|
File.AppendAllText(logfile, msg);
|
||||||
LogBox.Text += msg;
|
LogBox.Text += msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -98,6 +98,9 @@
|
|||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<None Include="client.dtsod">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
@ -107,7 +110,7 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\DTLib\DTLib.csproj">
|
<ProjectReference Include="..\..\DTLib\DTLib\DTLib.csproj">
|
||||||
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
|
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
|
||||||
<Name>DTLib</Name>
|
<Name>DTLib</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
@ -122,8 +125,7 @@
|
|||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>del /f /q dtlauncher-client-win.exe.config
|
<PostBuildEvent>del /f /q dtlauncher-client-win.exe.config
|
||||||
copy dtlauncher-client-win.exe C:\projects\c#\dtlauncher\dtlauncher-server-win\bin\share\client\dtlauncher-client-win.exe
|
copy dtlauncher-client-win.exe ..\..\dtlauncher-server-win\bin\share\client\dtlauncher-client-win.exe
|
||||||
copy C:\projects\c#\dtlauncher\dtlauncher-client-win\client.dtsod client.dtsod
|
copy client.dtsod ..\..\dtlauncher-server-win\bin\share\client\client.dtsod</PostBuildEvent>
|
||||||
copy client.dtsod C:\projects\c#\dtlauncher\dtlauncher-server-win\bin\share\client\client.dtsod</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -8,6 +8,7 @@ using DTLib;
|
|||||||
using DTLib.Dtsod;
|
using DTLib.Dtsod;
|
||||||
using DTLib.Filesystem;
|
using DTLib.Filesystem;
|
||||||
using DTLib.Network;
|
using DTLib.Network;
|
||||||
|
using DTLib.Extensions;
|
||||||
|
|
||||||
namespace dtlauncher_server
|
namespace dtlauncher_server
|
||||||
{
|
{
|
||||||
@ -16,6 +17,7 @@ namespace dtlauncher_server
|
|||||||
static readonly string logfile = $"logs\\dtlauncher-server-{DateTime.Now}.log".Replace(':', '-').Replace(' ', '_');
|
static readonly string logfile = $"logs\\dtlauncher-server-{DateTime.Now}.log".Replace(':', '-').Replace(' ', '_');
|
||||||
static readonly Socket mainSocket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
static readonly Socket mainSocket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
static DtsodV21 config;
|
static DtsodV21 config;
|
||||||
|
static DTLib.Loggers.DefaultLogger Info = new("logs", "dtlaunchet_server");
|
||||||
|
|
||||||
//static readonly Dictionary<Socket, Thread> users = new();
|
//static readonly Dictionary<Socket, Thread> users = new();
|
||||||
|
|
||||||
@ -26,8 +28,8 @@ namespace dtlauncher_server
|
|||||||
Console.Title = "dtlauncher server";
|
Console.Title = "dtlauncher server";
|
||||||
Console.InputEncoding = Encoding.Unicode;
|
Console.InputEncoding = Encoding.Unicode;
|
||||||
Console.OutputEncoding = Encoding.Unicode;
|
Console.OutputEncoding = Encoding.Unicode;
|
||||||
PublicLog.LogEvent += Log;
|
PublicLog.LogEvent += Info.Log;
|
||||||
PublicLog.LogNoTimeEvent += Log;
|
PublicLog.LogNoTimeEvent += Info.Log;
|
||||||
/*var outBuilder = new StringBuilder();
|
/*var outBuilder = new StringBuilder();
|
||||||
string time = DateTime.Now.ToString().Replace(':', '-').Replace(' ', '_');
|
string time = DateTime.Now.ToString().Replace(':', '-').Replace(' ', '_');
|
||||||
foreach (var _file in Directory.GetFiles(@"D:\!dtlauncher-server\share\public\Conan_Exiles"))
|
foreach (var _file in Directory.GetFiles(@"D:\!dtlauncher-server\share\public\Conan_Exiles"))
|
||||||
@ -47,15 +49,15 @@ namespace dtlauncher_server
|
|||||||
outBuilder.Append(file);
|
outBuilder.Append(file);
|
||||||
outBuilder.Append("\");\n");
|
outBuilder.Append("\");\n");
|
||||||
}
|
}
|
||||||
Log("c", "\n\n" + outBuilder.ToString() + "\n\n");*/
|
Info.Log("c", "\n\n" + outBuilder.ToString() + "\n\n");*/
|
||||||
config = config = new(File.ReadAllText("server.dtsod"));
|
config = config = new(File.ReadAllText("server.dtsod"));
|
||||||
int f = (int)config["server_port"];
|
int f = (int)config["server_port"];
|
||||||
Log("b", "local address: <", "c", config["server_ip"], "b",
|
Info.Log("b", "local address: <", "c", config["server_ip"], "b",
|
||||||
">\npublic address: <", "c", OldNetwork.GetPublicIP(), "b",
|
">\npublic address: <", "c", OldNetwork.GetPublicIP(), "b",
|
||||||
">\nport: <", "c", config["server_port"].ToString(), "b", ">\n");
|
">\nport: <", "c", config["server_port"].ToString(), "b", ">\n");
|
||||||
mainSocket.Bind(new IPEndPoint(IPAddress.Parse(config["server_ip"]), (int)config["server_port"]));
|
mainSocket.Bind(new IPEndPoint(IPAddress.Parse(config["server_ip"]), (int)config["server_port"]));
|
||||||
mainSocket.Listen(1000);
|
mainSocket.Listen(1000);
|
||||||
Log("g", "server started succesfully\n");
|
Info.Log("g", "server started succesfully\n");
|
||||||
//
|
//
|
||||||
/*DTLib.Timer userCkeckTimer = new(true, 3000, () =>
|
/*DTLib.Timer userCkeckTimer = new(true, 3000, () =>
|
||||||
{
|
{
|
||||||
@ -63,7 +65,7 @@ namespace dtlauncher_server
|
|||||||
{
|
{
|
||||||
if (usr.)
|
if (usr.)
|
||||||
{
|
{
|
||||||
Log("y", $"closing unused user <{usr.RemoteEndPoint.Serialize()[0]}> thread\n");
|
Info.Log("y", $"closing unused user <{usr.RemoteEndPoint.Serialize()[0]}> thread\n");
|
||||||
users[usr].Abort();
|
users[usr].Abort();
|
||||||
users.Remove(usr);
|
users.Remove(usr);
|
||||||
}
|
}
|
||||||
@ -80,36 +82,18 @@ namespace dtlauncher_server
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log("r", $"dtlauncher_server.Main() error:\n{ex.Message}\n{ex.StackTrace}\n");
|
Info.Log("r", $"dtlauncher_server.Main() error:\n{ex.Message}\n{ex.StackTrace}\n");
|
||||||
mainSocket.Close();
|
mainSocket.Close();
|
||||||
}
|
}
|
||||||
Log("press any key to close... ");
|
Info.Log("press any key to close... ");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
Log("gray", "\n");
|
Info.Log("gray", "\n");
|
||||||
}
|
|
||||||
|
|
||||||
// вывод лога в консоль и файл
|
|
||||||
public static void Log(params string[] msg)
|
|
||||||
{
|
|
||||||
if (msg.Length == 1) msg[0] = "[" + DateTime.Now.ToString() + "]: " + msg[0];
|
|
||||||
else msg[1] = "[" + DateTime.Now.ToString() + "]: " + msg[1];
|
|
||||||
LogNoTime(msg);
|
|
||||||
}
|
|
||||||
public static void LogNoTime(params string[] msg)
|
|
||||||
{
|
|
||||||
lock (new object())
|
|
||||||
{
|
|
||||||
if (msg.Length == 1) OldFilework.LogToFile(logfile, msg[0]);
|
|
||||||
else if (msg.Length % 2 != 0) throw new Exception("incorrect array to log\n");
|
|
||||||
else OldFilework.LogToFile(logfile, msg.MergeToString());
|
|
||||||
ColoredConsole.Write(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// запускается для каждого юзера в отдельном потоке
|
// запускается для каждого юзера в отдельном потоке
|
||||||
static void UserHandle(Socket handlerSocket)
|
static void UserHandle(Socket handlerSocket)
|
||||||
{
|
{
|
||||||
Log("b", "user connecting... ");
|
Info.Log("b", "user connecting... ");
|
||||||
//Socket fspSocket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
//Socket fspSocket = new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
//fspSocket.Bind()
|
//fspSocket.Bind()
|
||||||
FSP fsp = new(handlerSocket);
|
FSP fsp = new(handlerSocket);
|
||||||
@ -120,9 +104,9 @@ namespace dtlauncher_server
|
|||||||
// запрос от апдейтера
|
// запрос от апдейтера
|
||||||
if (hash.HashToString() == "ffffffffffffffff")
|
if (hash.HashToString() == "ffffffffffffffff")
|
||||||
{
|
{
|
||||||
LogNoTime("c", "client is updater\n");
|
Info.LogNoTime("c", "client is updater\n");
|
||||||
CreateManifest("share\\client\\");
|
CreateManifest("share\\client\\");
|
||||||
Log("g", "client files manifest created\n");
|
Info.Log("g", "client files manifest created\n");
|
||||||
handlerSocket.SendPackage("updater".ToBytes());
|
handlerSocket.SendPackage("updater".ToBytes());
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -137,16 +121,16 @@ namespace dtlauncher_server
|
|||||||
fsp.UploadFile(filepath);
|
fsp.UploadFile(filepath);
|
||||||
break;
|
break;
|
||||||
case "register new user":
|
case "register new user":
|
||||||
Log("b", "new user registration requested\n");
|
Info.Log("b", "new user registration requested\n");
|
||||||
handlerSocket.SendPackage("ok".ToBytes());
|
handlerSocket.SendPackage("ok".ToBytes());
|
||||||
//filepath = handlerSocket.GetPackage().BytesToString();
|
//filepath = handlerSocket.GetPackage().BytesToString();
|
||||||
//if (!filePath.EndsWith(".req")) throw new Exception($"wrong registration request file: <{filepath}>");
|
//if (!filePath.EndsWith(".req")) throw new Exception($"wrong registration request file: <{filepath}>");
|
||||||
//Log("b", $"downloading file registration_requests\\{filepath}\n");
|
//Info.Log("b", $"downloading file registration_requests\\{filepath}\n");
|
||||||
//handlerSocket.FSP_Download($"registration_requests\\{filepath}");
|
//handlerSocket.FSP_Download($"registration_requests\\{filepath}");
|
||||||
recieved = handlerSocket.GetPackage().BytesToString();
|
recieved = handlerSocket.GetPackage().BytesToString();
|
||||||
filepath = $"registration_requests\\{recieved.Remove(0, recieved.IndexOf(':') + 2)}.req";
|
filepath = $"registration_requests\\{recieved.Remove(0, recieved.IndexOf(':') + 2)}.req";
|
||||||
File.WriteAllText(filepath, recieved);
|
File.WriteAllText(filepath, recieved);
|
||||||
Log("b", $"text wrote to file <", "c", "registration_requests\\{filepath}", "b", ">\n");
|
Info.Log("b", $"text wrote to file <", "c", "registration_requests\\{filepath}", "b", ">\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception("unknown request: " + request);
|
throw new Exception("unknown request: " + request);
|
||||||
@ -158,14 +142,14 @@ namespace dtlauncher_server
|
|||||||
// запрос от лаунчера
|
// запрос от лаунчера
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogNoTime("c", "client is launcher\n");
|
Info.LogNoTime("c", "client is launcher\n");
|
||||||
string login;
|
string login;
|
||||||
lock (new object())
|
lock (new object())
|
||||||
{
|
{
|
||||||
login = OldFilework.ReadFromConfig("users.db", hash.HashToString());
|
login = OldFilework.ReadFromConfig("users.db", hash.HashToString());
|
||||||
}
|
}
|
||||||
handlerSocket.SendPackage("success".ToBytes());
|
handlerSocket.SendPackage("success".ToBytes());
|
||||||
Log("g", "user <", "c", login, "g", "> succesfully logined\n");
|
Info.Log("g", "user <", "c", login, "g", "> succesfully logined\n");
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (handlerSocket.Available >= 64)
|
if (handlerSocket.Available >= 64)
|
||||||
@ -194,7 +178,7 @@ namespace dtlauncher_server
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log("y", $"UserStart() error:\n message:\n {ex.Message}\n{ex.StackTrace}\n");
|
Info.Log("y", $"UserStart() error:\n message:\n {ex.Message}\n{ex.StackTrace}\n");
|
||||||
handlerSocket.Shutdown(SocketShutdown.Both);
|
handlerSocket.Shutdown(SocketShutdown.Both);
|
||||||
handlerSocket.Close();
|
handlerSocket.Close();
|
||||||
Thread.CurrentThread.Abort();
|
Thread.CurrentThread.Abort();
|
||||||
|
|||||||
@ -83,7 +83,9 @@
|
|||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
<None Include="server.dtsod" />
|
<None Include="server.dtsod">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
@ -101,14 +103,13 @@
|
|||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\DTLib\DTLib.csproj">
|
<ProjectReference Include="..\..\DTLib\DTLib\DTLib.csproj">
|
||||||
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
|
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
|
||||||
<Name>DTLib</Name>
|
<Name>DTLib</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>del /f /q dtlauncher-server-win.exe.config
|
<PostBuildEvent>del /f /q dtlauncher-server-win.exe.config</PostBuildEvent>
|
||||||
copy C:\projects\c#\dtlauncher\dtlauncher-server-win\server.dtsod server.dtsod</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -17,7 +17,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "updater", "updater\updater.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dtscript", "dtscript\dtscript.csproj", "{E02EA967-FD29-47D2-B25B-BA684B784AEE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dtscript", "dtscript\dtscript.csproj", "{E02EA967-FD29-47D2-B25B-BA684B784AEE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DTLib", "..\DTLib\DTLib.csproj", "{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DTLib", "..\DTLib\DTLib\DTLib.csproj", "{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sulution Files", "Sulution Files", "{09AA971D-CD70-4D93-BBA9-810C842830D8}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
.gitignore = .gitignore
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -32,8 +37,8 @@ Global
|
|||||||
{4784D974-A342-4202-9430-90FE5AC00FC7}.Build|Any CPU.Build.0 = Build|Any CPU
|
{4784D974-A342-4202-9430-90FE5AC00FC7}.Build|Any CPU.Build.0 = Build|Any CPU
|
||||||
{E02EA967-FD29-47D2-B25B-BA684B784AEE}.Build|Any CPU.ActiveCfg = Build|Any CPU
|
{E02EA967-FD29-47D2-B25B-BA684B784AEE}.Build|Any CPU.ActiveCfg = Build|Any CPU
|
||||||
{E02EA967-FD29-47D2-B25B-BA684B784AEE}.Build|Any CPU.Build.0 = Build|Any CPU
|
{E02EA967-FD29-47D2-B25B-BA684B784AEE}.Build|Any CPU.Build.0 = Build|Any CPU
|
||||||
{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.Build|Any CPU.ActiveCfg = Build|Any CPU
|
{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.Build|Any CPU.ActiveCfg = Release-net48|Any CPU
|
||||||
{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.Build|Any CPU.Build.0 = Build|Any CPU
|
{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.Build|Any CPU.Build.0 = Release-net48|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -2,17 +2,19 @@
|
|||||||
using DTLib;
|
using DTLib;
|
||||||
using DTLib.Filesystem;
|
using DTLib.Filesystem;
|
||||||
|
|
||||||
namespace DTScript
|
namespace DTScript;
|
||||||
{
|
|
||||||
public class MainClass
|
public class MainClass
|
||||||
{
|
{
|
||||||
|
static DTLib.Loggers.DefaultLogger Info = new("logs", "dtlaunchet_server");
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Directory.Create("dtscript-logs");
|
Directory.Create("dtscript-logs");
|
||||||
PublicLog.LogEvent += Log;
|
PublicLog.LogEvent += Info.Log;
|
||||||
PublicLog.LogNoTimeEvent += Log;
|
PublicLog.LogNoTimeEvent += Info.Log;
|
||||||
var scripter = new ScriptRunner();
|
var scripter = new ScriptRunner();
|
||||||
if (args.Length == 0 || args.Length > 2) throw new Exception("enter script file path\n");
|
if (args.Length == 0 || args.Length > 2) throw new Exception("enter script file path\n");
|
||||||
else if (args.Length == 1) scripter.RunScriptFile(args[0]);
|
else if (args.Length == 1) scripter.RunScriptFile(args[0]);
|
||||||
@ -25,31 +27,7 @@ namespace DTScript
|
|||||||
else throw new Exception("unknown args\n");
|
else throw new Exception("unknown args\n");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{ Info.Log("r", $"dtscript.Main() error:\n{ex.Message}\n{ex.StackTrace}\n"); }
|
||||||
Log("r", $"dtscript.Main() error:\n{ex.Message}\n{ex.StackTrace}\n");
|
Info.Log("gray", " \n");
|
||||||
}
|
|
||||||
Log("gray", " \n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// вывод лога в консоль и файл
|
|
||||||
static readonly string logfile = $"dtscript-logs\\dtscript-{DateTime.Now}.log".Replace(':', '-').Replace(' ', '_');
|
|
||||||
|
|
||||||
static void Log(params string[] msg)
|
|
||||||
{
|
|
||||||
if (msg.Length == 1)
|
|
||||||
{
|
|
||||||
msg[0] = "[" + DateTime.Now.ToString() + "]: " + msg[0];
|
|
||||||
OldFilework.LogToFile(logfile, msg[0]);
|
|
||||||
}
|
|
||||||
else if (msg.Length % 2 != 0) throw new Exception("incorrect array to log\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg[1] = "[" + DateTime.Now.ToString() + "]: " + msg[1];
|
|
||||||
var str = new System.Text.StringBuilder();
|
|
||||||
for (int i = 0; i < msg.Length; i++) str.Append(msg[++i]);
|
|
||||||
OldFilework.LogToFile(logfile, str.ToString());
|
|
||||||
}
|
|
||||||
ColoredConsole.Write(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using System.Linq;
|
||||||
using DTLib;
|
using DTLib;
|
||||||
using DTLib.Filesystem;
|
using DTLib.Filesystem;
|
||||||
using DTLib.Network;
|
using DTLib.Network;
|
||||||
|
|
||||||
namespace DTScript
|
namespace DTScript;
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// основной класс скриптового интерпретатора
|
// основной класс скриптового интерпретатора
|
||||||
//
|
//
|
||||||
@ -223,8 +224,7 @@ namespace DTScript
|
|||||||
i++;
|
i++;
|
||||||
rezult += expr[i];
|
rezult += expr[i];
|
||||||
}
|
}
|
||||||
else if (i == 0) rezult = expr[0];
|
else rezult = i == 0 ? expr[0] : throw new Exception($"error in Calc(): arg {expr[i]}\n");
|
||||||
else throw new Exception($"error in Calc(): arg {expr[i]}\n");
|
|
||||||
}
|
}
|
||||||
if (rezult.Contains("\\n")) rezult = rezult.Replace("\\n", "\n");
|
if (rezult.Contains("\\n")) rezult = rezult.Replace("\\n", "\n");
|
||||||
if (rezult.Contains("\"")) rezult = rezult.Replace("\"", "");
|
if (rezult.Contains("\"")) rezult = rezult.Replace("\"", "");
|
||||||
@ -463,4 +463,3 @@ namespace DTScript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<Content Include="dtscript_doc.txt" />
|
<Content Include="dtscript_doc.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\DTLib\DTLib.csproj">
|
<ProjectReference Include="..\..\DTLib\DTLib\DTLib.csproj">
|
||||||
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
|
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
|
||||||
<Name>DTLib</Name>
|
<Name>DTLib</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
@ -89,7 +89,7 @@
|
|||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>del /q /f dtscript.exe.config
|
<PostBuildEvent>del /q /f dtscript.exe.config
|
||||||
copy dtscript.exe C:\projects\c#\dtlauncher\dtlauncher-server-win\bin\share\client\dtscript.exe</PostBuildEvent>
|
copy dtscript.exe ..\..\dtlauncher-server-win\bin\share\client\dtscript.exe</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
|
|||||||
@ -6,6 +6,7 @@ using System.Text;
|
|||||||
using DTLib;
|
using DTLib;
|
||||||
using DTLib.Filesystem;
|
using DTLib.Filesystem;
|
||||||
using DTLib.Network;
|
using DTLib.Network;
|
||||||
|
using DTLib.Extensions;
|
||||||
|
|
||||||
namespace updater
|
namespace updater
|
||||||
{
|
{
|
||||||
@ -87,9 +88,9 @@ namespace updater
|
|||||||
{
|
{
|
||||||
lock (new object())
|
lock (new object())
|
||||||
{
|
{
|
||||||
if (msg.Length == 1) OldFilework.LogToFile(logfile, msg[0]);
|
if (msg.Length == 1) File.AppendAllText(logfile, msg[0]);
|
||||||
else if (msg.Length % 2 != 0) throw new Exception("incorrect array to log\n");
|
else if (msg.Length % 2 != 0) throw new Exception("incorrect array to log\n");
|
||||||
else OldFilework.LogToFile(logfile, msg.MergeToString());
|
else File.AppendAllText(logfile, msg.MergeToString());
|
||||||
ColoredConsole.Write(msg);
|
ColoredConsole.Write(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,7 +76,7 @@
|
|||||||
<Content Include="logo-D.ico" />
|
<Content Include="logo-D.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\DTLib\DTLib.csproj">
|
<ProjectReference Include="..\..\DTLib\DTLib\DTLib.csproj">
|
||||||
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
|
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
|
||||||
<Name>DTLib</Name>
|
<Name>DTLib</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
@ -84,10 +84,10 @@
|
|||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>del /f /q dtlauncher.exe.config
|
<PostBuildEvent>del /f /q dtlauncher.exe.config
|
||||||
copy dtlauncher.exe C:\projects\c#\dtlauncher\dtlauncher-server-win\bin\share\client\dtlauncher.exe
|
copy dtlauncher.exe ..\..\dtlauncher-server-win\bin\share\client\dtlauncher.exe
|
||||||
copy DTLib.dll C:\projects\c#\dtlauncher\dtlauncher-server-win\bin\share\client\DTLib.dll
|
copy DTLib.dll ..\..\dtlauncher-server-win\bin\share\client\DTLib.dll
|
||||||
copy dtlauncher.exe C:\projects\c#\dtlauncher\release\dtlauncher.exe
|
copy dtlauncher.exe ..\..\release\dtlauncher.exe
|
||||||
copy DTLib.dll C:\projects\c#\dtlauncher\release\DTLib.dll
|
copy DTLib.dll ..\..\release\DTLib.dll
|
||||||
|
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user