Delete .old 3 directory

This commit is contained in:
Timerix22 2021-07-19 21:35:23 +03:00 committed by GitHub
parent 15111f5be4
commit 87750d4dbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 0 additions and 2894 deletions

View File

@ -1,122 +0,0 @@
using System;
namespace DTLib
{
//
// изменение цвета текста в консоли
//
static public class ColoredText
{
// присвоение цвета тексту
static public ConsoleColor ParseColor(string color)
{
switch (color)
{
//case "magneta":
case "m":
return ConsoleColor.Magenta;
//case "green":
case "g":
return ConsoleColor.Green;
//case "red":
case "r":
return ConsoleColor.Red;
//case "yellow":
case "y":
return ConsoleColor.Yellow;
//case "white":
case "w":
return ConsoleColor.White;
//case "blue":
case "b":
return ConsoleColor.Blue;
//case "cyan":
case "c":
return ConsoleColor.Cyan;
//case "gray":
case "a":
return ConsoleColor.Gray;
//case "black":
case "t":
return ConsoleColor.Black;
default:
throw new Exception("incorrect color: " + color);
}
}
// вывод цветного текста
static public void WriteColored(string[] input)
{
if (input.Length % 2 == 0)
{
string str = "";
for (ushort i = 0; i < input.Length; i++)
{
var c = ParseColor(input[i]);
if (Console.ForegroundColor != c)
{
Console.Write(str);
Console.ForegroundColor = c;
str = "";
}
str += input[++i];
}
if (str != "")
Console.Write(str);
}
else
{
throw new Exception("error in WriteColored(): every text string must have color string before");
}
}
/*static public void WriteColoredB(string[] input)
{
if (input.Length % 3 == 0)
{
string str = "";
for (ushort i = 0; i < input.Length; i++)
{
var f = ParseColor(input[i]);
var b = ParseColor(input[++i]);
if (Console.ForegroundColor != f || Console.BackgroundColor != b)
{
Console.Write(str);
Console.ForegroundColor = f;
Console.BackgroundColor = b;
str = "";
}
str += input[++i];
}
if (str != "")
Console.Write(str);
}
else
{
throw new Exception("error in WriteColored(): every text string must have color string before");
}
}*/
static public void WriteColored(string color, string text)
{
var c = ParseColor(color);
if (Console.ForegroundColor != c)
{
Console.ForegroundColor = c;
}
Console.Write(text);
}
// ввод цветного текста
static public string ReadColored(string color)
{
var c = ParseColor(color);
if (Console.ForegroundColor != c)
{
Console.ForegroundColor = c;
}
string text = Console.ReadLine();
return text;
}
}
}

View File

@ -1,257 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace DTLib.ConsoleGUI
{
//
// создание gui из текста в консоли
//
public class Window
{
public int WindowWidth { get; private set; }
public int WindowHeight { get; private set; }
public char[,] Text;
public char[,] nowText;
public char[,] TextColors;
public char[,] nowTextColors;
public Window(int windowWidth, int windowHeight)
{
WindowWidth = windowWidth;
WindowHeight = windowHeight;
Text = new char[windowWidth, windowHeight];
TextColors = new char[windowWidth, windowHeight];
nowText = new char[windowWidth, windowHeight];
nowTextColors = new char[windowWidth, windowHeight];
Console.WindowWidth = WindowWidth + 1;
Console.WindowHeight = WindowHeight + 1;
Console.BufferWidth = WindowWidth + 1;
Console.BufferHeight = WindowHeight + 1;
Console.OutputEncoding = SimpleConverter.UTF8;
Console.InputEncoding = SimpleConverter.UTF8;
Console.CursorVisible = false;
// заполнение массивов
for (sbyte y = 0; y < WindowHeight; y++)
{
for (sbyte x = 0; x < WindowWidth; x++)
{
Text[x, y] = ' ';
nowText[x, y] = ' ';
TextColors[x, y] = 'w';
nowTextColors[x, y] = 'w';
}
}
}
// считывает массив символов из файла
// ширина и высота текста должны быть как указанные при инициализации объекта этого класса
public void ReadFromFile(string path)
{
var r = new StreamReader(path, SimpleConverter.UTF8);
char[] s = new char[1];
// считывание текста
sbyte y = 0, x = 0;
r.Read(s, 0, 1);
while (!r.EndOfStream && y < WindowHeight)
{
if (x == WindowWidth)
{
r.Read(s, 0, 1);
x = 0;
y++;
}
else
{
Text[x, y] = s[0];
x++;
}
r.Read(s, 0, 1);
}
r.Read(s, 0, 1);
// считывание цвета
// если не находит цвет в файле, оставляет старый
if (s[0] == '\n')
{
r.Read(s, 0, 1);
y = 0;
x = 0;
while (!r.EndOfStream && y < WindowHeight)
{
if (x == WindowWidth)
{
r.Read(s, 0, 1);
x = 0;
y++;
}
else
{
TextColors[x, y] = s[0];
x++;
}
r.Read(s, 0, 1);
}
}
r.Close();
}
public void ResetCursor()
{
Console.SetCursorPosition(0, WindowHeight);
}
// заменяет символ выведенный, использовать после ShowAll()
public void ChangeChar(sbyte x, sbyte y, char ch)
{
Text[x, y] = ch;
nowText[x, y] = ch;
Console.SetCursorPosition(x, y);
ColoredText.WriteColored(TextColors[x, y].ToString(), ch.ToString());
}
public void ChangeColor(sbyte x, sbyte y, char color)
{
TextColors[x, y] = color;
nowTextColors[x, y] = color;
Console.SetCursorPosition(x, y);
ColoredText.WriteColored(color.ToString(), Text[x, y].ToString());
}
public void ChangeCharAndColor(sbyte x, sbyte y, char color, char ch)
{
Text[x, y] = ch;
nowText[x, y] = ch;
TextColors[x, y] = color;
nowTextColors[x, y] = color;
Console.SetCursorPosition(x, y);
ColoredText.WriteColored(color.ToString(), ch.ToString());
}
public void ChangeLine(sbyte x, sbyte y, char color, string line)
{
Console.SetCursorPosition(x, y);
for (sbyte i = 0; i < line.Length; i++)
{
Text[x + i, y] = line[i];
nowText[x + i, y] = line[i];
TextColors[x + i, y] = color;
nowTextColors[x + i, y] = color;
}
ColoredText.WriteColored(color.ToString(), line);
}
// выводит все символы
public void ShowAll()
{
var l = new List<string>();
for (sbyte y = 0; y < WindowHeight; y++)
{
for (sbyte x = 0; x < WindowWidth; x++)
{
l.Add(TextColors[x, y].ToString());
l.Add(Text[x, y].ToString());
nowText[x, y] = Text[x, y];
nowTextColors[x, y] = TextColors[x, y];
}
l.Add("w");
l.Add("\n");
}
ColoredText.WriteColored(l.ToArray());
//Console.WriteLine();
}
public void UpdateAll()
{
for (sbyte y = 0; y < WindowHeight; y++)
{
for (sbyte x = 0; x < WindowWidth; x++)
{
Console.SetCursorPosition(x, y);
if (TextColors[x, y] != nowTextColors[x, y] || Text[x, y] != nowText[x, y])
{
ColoredText.WriteColored(TextColors[x, y].ToString(), Text[x, y].ToString());
nowText[x, y] = Text[x, y];
nowTextColors[x, y] = TextColors[x, y];
}
}
Console.Write('\n');
}
}
public async void ChangeCharAsync(sbyte x, sbyte y, char ch)
{
await Task.Run(() =>
{
ChangeChar(x, y, ch);
});
}
public async void ChangeColorAsync(sbyte x, sbyte y, char color)
{
await Task.Run(() =>
{
ChangeColor(x, y, color);
});
}
public async void ChangeCharAndColorAsync(sbyte x, sbyte y, char color, char ch)
{
await Task.Run(() =>
{
ChangeCharAndColor(x, y, color, ch);
});
}
public async void ChangeLineAsync(sbyte x, sbyte y, char color, string line)
{
await Task.Run(() =>
{
ChangeLine(x, y, color, line);
});
}
public async void ShowAllAsync()
{
await Task.Run(() =>
{
ShowAll();
});
}
public async void UpdateAllAsync()
{
await Task.Run(() =>
{
UpdateAll();
});
}
}
public class Tab
{
public Window Window;
public string Name;
public Tab(Window window)
{
Window = window;
}
}
public class Box
{
public Tab Tab;
public int LeftTopCorner, Width, Heigth;
public Box(Tab tab, int leftTopCorner, int width, int heigth)
{
Tab = tab;
LeftTopCorner = leftTopCorner;
Width = width;
Heigth = heigth;
}
}
}

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DTLib</RootNamespace>
<AssemblyName>DTLib</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Build|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FileWork.cs" />
<Compile Include="ColoredText.cs" />
<Compile Include="NetWork.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SecureHasher.cs" />
<Compile Include="SecureRandom.cs" />
<Compile Include="SimpleConverter.cs" />
<Compile Include="TImer.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -1,43 +0,0 @@
using System;
using System.IO;
namespace DTLib
{
public static class FileWork
{
public static void Log(string logfile, string msg)
{
lock (new object())
{
var st = File.Open(logfile, FileMode.Append);
var writer = new StreamWriter(st, SimpleConverter.UTF8);
string logMsg = $"[{DateTime.Now}]: {msg}";
writer.Write(logMsg);
writer.Close();
st.Close();
}
}
public static void DirExistenceCheck(string dir)
{
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
}
static public string ReadFromConfig(string configfile, string key)
{
var reader = new StreamReader(configfile);
while (!reader.EndOfStream)
{
string st = reader.ReadLine();
if (!st.StartsWith("#") && st.Contains(key + ": "))
{
reader.Close();
return st.Remove(0, st.IndexOf(key + ": ") + key.Length + 2);
}
}
reader.Close();
return null;
}
}
}

View File

@ -1,370 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace DTLib
{
//
// некоторые полезные методы для работы с TCP сокетами (Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
//
static public class NetWork
{
public delegate void LogDelegate(string[] msg);
// можно присвоить методы этому делегату чтоб выводить логи
static public LogDelegate Log;
static void LogSimple(string color, string msg)
{
Log(new string[] { color, msg });
}
// правильно закрывает сокет
static public void CloseSocket(this Socket socket)
{
socket.Shutdown(SocketShutdown.Both);
socket.Close();
}
// получение информации (сокет должен быть в режиме Listen)
static public byte[] GetData(this Socket socket)
{
List<byte> output = new List<byte>();
byte[] data = new byte[256];
do
{
int amount = socket.Receive(data, data.Length, 0);
for (int i = 0; i < amount; i++)
output.Add(data[i]);
}
while (socket.Available > 0);
return output.ToArray();
}
// отправка запроса и получение ответа на него (сокет должен быть в режиме Listen)
static public byte[] Request(this Socket socket, string request)
{
socket.Send(request.ToBytes());
return GetData(socket);
}
static public byte[] Request(this Socket socket, byte[] request)
{
socket.Send(request);
return GetData(socket);
}
/*static public MessageObject SplitMessage(byte[] recieved)
{
if (recieved.Length != 2284) throw new Exception("incorrect message length: " + recieved.Length);
var msg = new MessageObject();
msg.Number = recieved[2];
for (byte i = 3; i < 9; i++)
{
msg.Number = msg.Number * 10 + recieved[i];
}
msg.Datetime = new DateTime(recieved[9] * 100 + recieved[10], recieved[11], recieved[12],
recieved[13], recieved[14], recieved[15]);
for (byte i = 16; i < 22; i++)
{
msg.Sender = msg.Sender * 10 + recieved[i];
}
for (byte i = 22; i < 28; i++)
{
msg.Channel = msg.Channel * 10 + recieved[i];
}
List<byte> text = new List<byte>();
for (short i = 28; i < 2028; i++)
{
text.Add(recieved[i]);
}
msg.Text = text.ToStr();
Log($"message <{msg.Number}> is had recieved");
return msg;
}*/
static public void FtpDownload(string address, string login, string password, string outfile)
{
try
{
// debug
Log(new string[] {
"y", "file on server: <", "c",address, "y",">\nfile on client: <",
"c",outfile,"y", ">\n"});
// создание запроса
// "ftp://m1net.keenetic.pro:20000/" + @infile
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(address);
request.Credentials = new NetworkCredential(login, password);
request.Method = WebRequestMethods.Ftp.DownloadFile;
// получение ответа на запрос
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
FileStream fs = new FileStream(@Directory.GetCurrentDirectory() + '\\' + @outfile, FileMode.Create);
byte[] buffer = new byte[64];
int size = 0;
while ((size = responseStream.Read(buffer, 0, buffer.Length)) > 0)
{
fs.Write(buffer, 0, size);
}
fs.Close();
response.Close();
}
catch (WebException e)
{
throw new Exception("ftp error:\n" + ((FtpWebResponse)e.Response).StatusDescription + '\n');
}
}
static public ServerObject[] RequestServersList(Socket centralServer)
{
List<ServerObject> servers = new List<ServerObject>();
string[] lines = Request(centralServer, "a356a4257dbf9d87c77cf87c3c694b30160b6ddfd3db82e7f62320207109e352").ToStr().Split('\n');
for (int i = 0; i < lines.Length; i++)
{
string[] properties = lines[i].Split(',');
servers.Add(new ServerObject(properties[0], properties[1], properties[2]));
}
return servers.ToArray();
}
static public string PingIP(string address)
{
Process proc = new Process();
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/c @echo off & chcp 65001 >nul & ping -n 5 " + address;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
var outStream = proc.StandardOutput;
var rezult = outStream.ReadToEnd();
rezult = rezult.Remove(0, rezult.LastIndexOf('=') + 2);
return rezult.Remove(rezult.Length - 4);
}
static public bool Ping(this Socket socket)
{
var rec = Request(socket, "ab53bf045004875fb17086f7f992b0514fb96c038f336e0bfc21609b20303f07");
if (rec.ToStr() == "91b5c0383b75fb1708f00486f7f9b96c038ab3bfc21059b20176f603692b05e0")
{
return true;
}
else return false;
}
static public void FSP_Download(this Socket mainSocket, FSP_FileObject file)
{
Log(new string[] { "c", $"remote socket accepted download request: {file.ClientFilePath}\n" });
mainSocket.Send("requesting file download".ToBytes());
string answ = mainSocket.GetPackageClear(64, "<", ">").ToStr();
if (answ != "download request accepted")
throw new Exception($"FSP_Download() error: a download socket recieved an incorrect message: {answ}\n");
mainSocket.SendPackage(276, file.ServerFilePath.ToBytes(), "<filename>", "<filename>");
file.Size = Convert.ToUInt32(mainSocket.GetPackageClear(64, "<filesize>", "<filesize>").ToStr());
file.Hash = mainSocket.GetPackageClear(64, "<filehash>", "<filehash>");
mainSocket.SendPackage(64, "ready".ToBytes(), "<", ">");
file.Stream = File.Open(file.ClientFilePath, FileMode.Create, FileAccess.Write);
int packagesCount = 0;
byte[] buffer = new byte[5120];
var hashstr = file.Hash.HashToString();
int fullPackagesCount = SimpleConverter.Truncate(file.Size / buffer.Length);
// рассчёт скорости
int seconds = 0;
var speedCounter = new Timer(true, 1000, () =>
{
seconds++;
LogSimple("c", $"speed= {packagesCount * buffer.Length / (seconds * 1000)} kb/s\n");
});
// получение файла
for (; packagesCount < fullPackagesCount; packagesCount++)
{
string header = $"<{packagesCount}>";
buffer = mainSocket.GetPackageRaw(buffer.Length + 2 + header.Length, header, "<>");
file.Stream.Write(buffer, 0, buffer.Length);
file.Stream.Flush();
}
Log(new string[] { "y", " full packages recieved\n" });
speedCounter.Stop();
// получение остатка
mainSocket.SendPackage(64, "remain request".ToBytes(), "<", ">");
buffer = mainSocket.GetPackageRaw(Convert.ToInt32(file.Size - fullPackagesCount * 5120) + 16, "<remain>", "<remain>");
file.Stream.Write(buffer, 0, buffer.Length);
file.Stream.Flush();
file.Stream.Close();
Log(new string[] { "g", $" file {file.ClientFilePath} ({packagesCount * 5120 + buffer.Length} of {file.Size} bytes) downloaded.\n" });
}
static public void FSP_Upload(this Socket mainSocket)
{
mainSocket.SendPackage(64, "download request accepted".ToBytes(), "<", ">");
var file = new FSP_FileObject();
file.ServerFilePath = mainSocket.GetPackageClear(276, "<filename>", "<filename>").ToStr();
file.Size = new FileInfo(file.ServerFilePath).Length;
file.Hash = new SecureHasher(256).HashFile(file.ServerFilePath);
mainSocket.SendPackage(64, file.Size.ToString().ToBytes(), "<filesize>", "<filesize>");
mainSocket.SendPackage(64, file.Hash, "<filehash>", "<filehash>");
if (mainSocket.GetPackageClear(64, "<", ">").ToStr() != "ready")
throw new Exception("user socket isn't ready");
Log(new string[] { "c", $"local socket accepted file download request: {file.ServerFilePath}\n" });
file.Stream = new FileStream(file.ServerFilePath, FileMode.Open, FileAccess.Read);
byte[] buffer = new byte[5120];
var hashstr = file.Hash.HashToString();
int packagesCount = 0;
int seconds = 0;
// рассчёт скорости
var speedCounter = new Timer(true, 1000, () =>
{
seconds++;
LogSimple("c", $"speed= {packagesCount * buffer.Length / (seconds * 1000)} kb/s\n");
});
// отправка файла
int fullPackagesCount = SimpleConverter.Truncate(file.Size / buffer.Length);
for (; packagesCount < fullPackagesCount; packagesCount++)
{
string header = $"<{packagesCount}>";
file.Stream.Read(buffer, 0, buffer.Length);
try { mainSocket.SendPackage(buffer.Length + 2 + header.Length, buffer, header, "<>"); }
catch (Exception ex) { Log(new string[] { "r", "FSP_Upload() error: " + ex.Message + "\n" + ex.StackTrace + '\n' }); }
}
Log(new string[] { "y", " full packages send\n" });
speedCounter.Stop();
// досылка остатка
var req = mainSocket.GetPackageClear(64, "<", ">");
if (req.ToStr() != "remain request")
{
throw new Exception("FSP_Upload() error: didn't get remain request");
}
buffer = new byte[Convert.ToInt32(file.Size - file.Stream.Position)];
file.Stream.Read(buffer, 0, buffer.Length);
mainSocket.SendPackage(buffer.Length + 16, buffer, "<remain>", "<remain>");
file.Stream.Close();
Log(new string[] { "g", $" file {file.ServerFilePath} ({packagesCount * 5120 + buffer.Length} of {file.Size} bytes) uploaded.\n" });
}
// убирает пустые байты в конце пакета
static public byte[] GetPackageClear(this Socket socket, int packageSize, string startsWith, string endsWith)
{
byte[] data = socket.GetPackageRaw(packageSize, startsWith, endsWith);
bool clean = false;
for (int i = 0; !clean; i++)
{
if (data[i] != 00)
{
if (i != 0) data = data.Remove(0, i);
clean = true;
}
else clean = i == data.Length - 1;
}
return data;
}
//не убирает пустые байты в конце пакета
static public byte[] GetPackageRaw(this Socket socket, int packageSize, string startsWith, string endsWith)
{
byte[] data = new byte[packageSize];
//Log(new string[] { "y", $"GetPackage() packegesize=<","c",packageSize.ToString(),
// "y", "> startsWith=<", "c", startsWith, "y", "> endsWith=<", "c", endsWith, "y", ">\n" });
for (short s = 0; s < 2000; s += 10)
{
if (socket.Available >= packageSize)
{
socket.Receive(data, packageSize, 0);
if (data.StartsWith(startsWith) & data.EndsWith(endsWith))
{
data = data.Remove(0, startsWith.ToBytes().Length);
data = data.Remove(data.Length - endsWith.ToBytes().Length, endsWith.ToBytes().Length);
return data;
}
else throw new Exception($"GetPackage() error: has got incorrect package\n");
}
else Thread.Sleep(10);
}
throw new Exception($"GetPackage() error: timeout\n");
}
static public void SendPackage(this Socket socket, int length, byte[] data, string startsWith, string endsWith)
{
var list = new List<byte>();
list.AddRange(startsWith.ToBytes());
int i = startsWith.ToBytes().Length + endsWith.ToBytes().Length + data.Length;
//Log(new string[] { "y", $"SendPackage() length=<","c",length.ToString(),"y", "> packegesize=<","c",i.ToString(),
// "y", "> data.Length=<","c",data.Length.ToString(), "y", "> startsWith=<", "c", startsWith, "y", "> endsWith=<", "c", endsWith, "y", ">\n" });
if (i > length) throw new Exception("SendPackage() error: int length is too small\n");
for (; i < length; i++)
list.Add(0);
list.AddRange(data);
list.AddRange(endsWith.ToBytes());
socket.Send(list.ToArray());
}
}
public class FSP_FileObject
{
public string ServerFilePath;
public string ClientFilePath;
public long Size;
public byte[] Hash;
public Stream Stream;
public FSP_FileObject(string serverFile, string clientFile)
{
ServerFilePath = serverFile;
ClientFilePath = clientFile;
}
public FSP_FileObject() { }
}
public class ServerObject
{
public string Address;
public string Name;
public string Speed;
public ServerObject(string address, string name, string speed)
{
Address = address;
Name = name;
Speed = speed;
}
}
public class MessageObject
{
public uint Number;
public DateTime Datetime;
public int Sender;
public int Channel;
public string Text;
public MessageObject() { }
public MessageObject(byte[] recieved)
{
if (recieved.Length != 2284) throw new Exception("incorrect message length: " + recieved.Length);
Number = recieved[2];
for (byte i = 3; i < 9; i++)
{
Number = Number * 10 + recieved[i];
}
Datetime = new DateTime(recieved[9] * 100 + recieved[10], recieved[11], recieved[12],
recieved[13], recieved[14], recieved[15]);
for (byte i = 16; i < 22; i++)
{
Sender = Sender * 10 + recieved[i];
}
for (byte i = 22; i < 28; i++)
{
Channel = Channel * 10 + recieved[i];
}
List<byte> text = new List<byte>();
for (short i = 28; i < 2028; i++)
{
text.Add(recieved[i]);
}
Text = text.ToStr();
//Log($"message <{Number}> is had recieved");
}
}
}

View File

@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанные со сборкой.
[assembly: AssemblyTitle("DTLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DTLib")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("ce793497-2d5c-42d8-b311-e9b32af9cdfb")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Редакция
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,97 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
namespace DTLib
{
//
// создаёт хеши из массива байт, двух массивов байт, стрима
//
public class SecureHasher
{
private dynamic hasher;
// можно указать размер хеша (по умолчанию 256 байт)
public SecureHasher(short type)
{
switch (type)
{
case 256:
hasher = SHA256.Create();
break;
case 384:
hasher = SHA384.Create();
break;
case 512:
hasher = SHA512.Create();
break;
default:
throw new Exception("unknown hash algorithm type: " + type + "\nin shouid be 256, 384 or 512\n");
}
}
public SecureHasher()
{
hasher = SHA256.Create();
}
// просто хеш
public byte[] Hash(byte[] input)
{
return hasher.ComputeHash(input);
}
// хеш из двух массивов
public byte[] HashSalt(byte[] input, byte[] salt)
{
List<byte> rez = new List<byte>();
rez.AddRange(input);
rez.AddRange(salt);
return hasher.ComputeHash(rez.ToArray());
}
// читает стрим и вычисляет хеш всей инфы в нём
public byte[] HashStream(Stream st)
{
byte[] data = new byte[1024];
List<byte> rez = new List<byte>();
int offset = 0;
while (offset < st.Length)
{
offset += st.Read(data, offset, 1024);
rez.AddRange(hasher.ComputeHash(data));
}
return hasher.ComputeHash(rez.ToArray());
}
// Хеш двух массивов в цикле.
// Работает быстро, так что вполне можно использовать количество циклов до 8к
public byte[] HashSaltCycled(byte[] input, byte[] salt, ushort cycles)
{
for (uint i = 0; i < cycles; i++)
{
input = HashSalt(input, salt);
}
return input;
}
public byte[] HashCycled(byte[] input, ushort cycles)
{
for (uint i = 0; i < cycles; i++)
{
input = Hash(input);
}
return input;
}
public byte[] HashFile(string filename)
{
var md5 = MD5.Create();
var stream = File.OpenRead(filename);
var hash = HashSaltCycled(md5.ComputeHash(stream), filename.ToBytes(), 512);
stream.Close();
return hash;
}
}
}

View File

@ -1,37 +0,0 @@
using System.Security.Cryptography;
namespace DTLib
{
//
// Вычисление псевдослучайного числа из множества параметров.
// Работает медленнее чем класс System.Random, но производит более случайные значения
//
public class SecureRandom
{
private RNGCryptoServiceProvider crypt = new RNGCryptoServiceProvider();
// получение массива случайных байтов
public byte[] NextBytes(uint length)
{
byte[] output = new byte[length];
crypt.GetNonZeroBytes(output);
return output;
}
// получение случайного числа от 0 до 2147483647
/*public int NextInt(uint from, int to)
{
int output = 0;
int rez = 0;
while (true)
{
rez = output * 10 + NextBytes(1)[0];
if (rez < to && rez > from)
{
output = rez;
return output;
}
}
}*/
}
}

View File

@ -1,82 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DTLib
{
//
// содержит методы расширения для конвертации байт в строку и наоборот
//
public static class SimpleConverter
{
static public Encoding UTF8 = new UTF8Encoding(false);
// байты в кодировке UTF8 в строку
static public string ToStr(this byte[] bytes)
{
return UTF8.GetString(bytes);
}
static public string ToStr(this List<byte> bytes)
{
return UTF8.GetString(bytes.ToArray());
}
static public List<byte> ToList(this byte[] input)
{
var list = new List<byte>();
list.AddRange(input);
return list;
}
static public byte[] Remove(this byte[] input, int startIndex, int count)
{
List<byte> list = input.ToList();
list.RemoveRange(startIndex, count);
return list.ToArray();
}
// строку в байты
static public byte[] ToBytes(this string str)
{
return UTF8.GetBytes(str);
}
// хеш в виде массива байт в строку (хеш изначально не в кодировке UTF8, так что метод выше не работает с ним)
static public string HashToString(this byte[] hash)
{
var builder = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
builder.Append(hash[i].ToString("x2"));
}
return builder.ToString();
}
static public bool StartsWith(this byte[] source, byte[] startsWith)
{
for (int i = 0; i < startsWith.Length; i++)
{
if (source[i] != startsWith[i])
return false;
}
return true;
}
static public bool StartsWith(this byte[] source, string startsWith)
=> StartsWith(source, startsWith.ToBytes());
static public bool EndsWith(this byte[] source, byte[] endsWith)
{
for (int i = 0; i < endsWith.Length; i++)
{
if (source[source.Length - endsWith.Length + i] != endsWith[i])
return false;
}
return true;
}
static public bool EndsWith(this byte[] source, string endsWith)
=> EndsWith(source, endsWith.ToBytes());
static public int Truncate(decimal number)
=> Convert.ToInt32(Math.Truncate(number));
}
}

View File

@ -1,31 +0,0 @@
using System;
using System.Threading;
namespace DTLib
{
public class Timer
{
public Thread TimerThread;
bool Repeat;
public Timer(bool repeat, int delay, Action method)
{
Repeat = repeat;
TimerThread = new Thread(() =>
{
do
{
Thread.Sleep(delay);
method();
} while (Repeat);
});
TimerThread.Start();
}
public void Stop()
{
Repeat = false;
//throw new Exception("thread stop\n");
TimerThread.Abort();
}
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

View File

@ -1,166 +0,0 @@
<Application x:Class="dtlauncher_client_win.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:dtlauncher_client_win"
StartupUri="LoginWindow.xaml">
<Application.Resources>
<ControlTemplate x:Key="myScrollBar" TargetType="{x:Type ScrollBar}">
<Grid x:Name="Bg" SnapsToDevicePixels="True">
<Border BorderBrush="Transparent" BorderThickness="0"
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="1"/>
<Track x:Name="PART_Track" IsDirectionReversed="True" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="1">
<Track.Thumb>
<Thumb>
<Thumb.Style>
<Style TargetType="{x:Type Thumb}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border x:Name="rectangle" CornerRadius="2" Background="#FF9A9FC5" Height="{TemplateBinding Height}" SnapsToDevicePixels="True" Width="{TemplateBinding Width}"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="rectangle" Value="#FF9A9FC5"/>
</Trigger>
<Trigger Property="IsDragging" Value="True">
<Setter Property="Background" TargetName="rectangle" Value="#FF515ED1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Thumb.Style>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="myScrollViewer" TargetType="{x:Type ScrollViewer}">
<Grid x:Name="Grid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
<ScrollBar Template="{DynamicResource myScrollBar}" Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}" x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
<ScrollBar Template="{DynamicResource myScrollBar}" Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}" x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="myTabControl" TargetType="{x:Type TabControl}">
<Grid KeyboardNavigation.TabNavigation="Local">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TabPanel
Name="HeaderPanel"
Grid.Row="0"
Panel.ZIndex="1"
Margin="0,0,4,0"
IsItemsHost="True"
KeyboardNavigation.TabIndex="1"
Background="Transparent" />
<Border
Name="Border"
Grid.Row="1"
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="0"
CornerRadius="2"
KeyboardNavigation.TabNavigation="Local"
KeyboardNavigation.DirectionalNavigation="Contained"
KeyboardNavigation.TabIndex="2" >
<ContentPresenter
Name="PART_SelectedContentHost"
Margin="4"
ContentSource="SelectedContent"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#FFF0F0F0" />
<Setter TargetName="Border" Property="BorderBrush" Value="Transparent" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="myTabItem" TargetType="{x:Type TabItem}">
<Grid>
<Border
x:Name="Border"
Margin="0,0,-4,0"
Background="#FF4D4D4D"
BorderBrush="#FF73C300"
BorderThickness="2,2,2,2"
CornerRadius="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" >
<ContentPresenter x:Name="ContentSite"
VerticalAlignment="Center"
HorizontalAlignment="Center"
ContentSource="Header"
Margin="12,2,12,2"
RecognizesAccessKey="True"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Panel.ZIndex" Value="100" />
<Setter TargetName="Border" Property="Background" Value="#FF0A11A2" />
<Setter TargetName="Border" Property="BorderThickness" Value="3,3,3,3" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Background" Value="Transparent" />
<Setter TargetName="Border" Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="white" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="myTextBox" TargetType="{x:Type TextBoxBase}">
<Border
Name="Border"
Padding="2"
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
BorderBrush="Transparent"
BorderThickness="1" >
<ScrollViewer Margin="0" x:Name="PART_ContentHost" Template="{DynamicResource myScrollViewer}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Background" Value="Black"/>
<Setter TargetName="Border" Property="BorderBrush" Value="White"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="roundedButton" TargetType="Button">
<Border x:Name="Border"
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
BorderBrush="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}"
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}}"
CornerRadius="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}">
<ContentPresenter Margin="2" HorizontalAlignment="Center"
VerticalAlignment="Center" RecognizesAccessKey="True"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Background" Value="#FF4E4E59"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="Border" Property="Background" Value="#FF38384F"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Application.Resources>
</Application>

View File

@ -1,11 +0,0 @@
using System.Windows;
namespace dtlauncher_client_win
{
/// <summary>
/// Логика взаимодействия для App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@ -1,91 +0,0 @@
<Window x:Class="dtlauncher_client_win.LauncherWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:dtlauncher_client_win"
mc:Ignorable="d"
Title="LauncherWindow" Width="800" Height="500" MinWidth="800" MinHeight="500" Background="#FF232328">
<Grid x:Name="MainGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10"/>
<RowDefinition Height="40"/>
<RowDefinition Height="8"/>
<RowDefinition/>
<RowDefinition Height="10"/>
</Grid.RowDefinitions>
<Grid Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="8"/>
<ColumnDefinition/>
<ColumnDefinition Width="8"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button x:Name="HomeButton" Content="Home" FontWeight="Bold" FontFamily="Unispace" FontSize="20"
Grid.Column="0" Background="Transparent" Foreground="#FF2CDA11"
BorderThickness="3" Template="{DynamicResource roundedButton}" Tag="14"/>
<Button x:Name="LogButton" Content="Log" FontWeight="Bold" FontFamily="Unispace" FontSize="20"
Grid.Column="2" Background="Transparent" Foreground="#FFF0F0F0"
BorderThickness="3" Template="{DynamicResource roundedButton}" Tag="14"/>
<Button x:Name="SettingsButton" Content="Settings" FontWeight="Bold" FontFamily="Unispace" FontSize="20"
Grid.Column="4" Background="Transparent" Foreground="#FFF0F0F0"
BorderThickness="3" Template="{DynamicResource roundedButton}" Tag="14"/>
</Grid>
<Grid x:Name="HomeGrid" Visibility="Visible" Grid.Row="3" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="220"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="220"/>
</Grid.ColumnDefinitions>
<ScrollViewer x:Name="ProgramsScrollViever" Template="{DynamicResource myScrollViewer}"
Grid.Column="0" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<StackPanel x:Name="ProgramsPanel">
</StackPanel>
</ScrollViewer>
<Image x:Name="BackgroundImage" Grid.Column="2" HorizontalAlignment="Stretch" Stretch="Fill" Margin="0,40,0,0" />
<Label x:Name="NameLabel" Content="name" Grid.Column="2" Grid.Row="0" Margin="0,0,0,361"
FontSize="16" FontWeight="Bold" FontFamily="Unispace" Foreground="#FFF0F0F0"/>
<Button x:Name="LaunchButton" Content="Launch" FontWeight="Bold" FontFamily="Unispace" FontSize="17"
Grid.Column="2" Background="#FFB97523" Foreground="#FFF0F0F0"
BorderThickness="3" Template="{DynamicResource roundedButton}" Tag="14" Margin="0,67,10,0" HorizontalAlignment="Right" Width="123" Height="37" VerticalAlignment="Top"/>
<TextBox x:Name="DescriptionBox" Template="{DynamicResource myTextBox}" Opacity="0.8"
VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" BorderThickness="0"
Background="#FF141419" Foreground="#FFF0F0F0" SelectionBrush="#FF3E759E"
FontSize="14" IsReadOnly="True" Grid.Column="2" Grid.Row="0" Margin="0,121,0,0"/>
<Border BorderBrush="#FF141419" BorderThickness="1" Grid.Column="2" Grid.Row="0" Margin="0,121,0,0"/>
<ScrollViewer x:Name="DownloadsScrollViever" Template="{DynamicResource myScrollViewer}" VerticalContentAlignment="Top"
Grid.Column="4" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<StackPanel x:Name="DownloadsPanel">
</StackPanel>
</ScrollViewer>
</Grid>
<Grid x:Name="LogGrid" Visibility="Hidden" Grid.Row="3" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="34"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Label x:Name="LogfileLabel" Content="logfile" Grid.Column="0" Grid.Row="0"
FontSize="20" FontWeight="Bold" FontFamily="Unispace" Foreground="#FFF0F0F0"/>
<TextBox x:Name="LogBox" Template="{DynamicResource myTextBox}"
VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" BorderThickness="0"
Background="#FF141419" Foreground="#FFF0F0F0" SelectionBrush="#FF3E759E"
FontSize="14" IsReadOnly="True" Grid.Column="0" Grid.Row="1"/>
</Grid>
<Grid x:Name="SettingsGrid" Visibility="Hidden" Grid.Row="3" Grid.Column="1">
</Grid>
<local:ProgramName Content="text" Grid.Column="1" Grid.Row="3" Foreground="AliceBlue" Margin="134,132,350,190"/>
</Grid>
</Window>

View File

@ -1,91 +0,0 @@
using DTLib;
using System;
using System.IO;
using System.Net.Sockets;
using System.Windows;
namespace dtlauncher_client_win
{
/// <summary>
/// Логика взаимодействия для LauncherWindow.xaml
/// </summary>
public partial class LauncherWindow : Window
{
Socket socket;
string logfile;
public delegate void LaunchDel();
public LaunchDel Launch;
public ProgramLabel[] programsArray;
public int PreviousProgramNum = 0;
public LauncherWindow(Socket _socket, string _logfile)
{
InitializeComponent();
socket = _socket;
logfile = _logfile;
NetWork.Log += Log;
// переключение вкладок кнопками
var green = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(44, 220, 17));
var white = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(240, 240, 240));
HomeButton.Click += (s, e) =>
{
LogGrid.Visibility = Visibility.Hidden;
SettingsGrid.Visibility = Visibility.Hidden;
HomeGrid.Visibility = Visibility.Visible;
LogButton.Foreground = white;
SettingsButton.Foreground = white;
HomeButton.Foreground = green;
};
LogButton.Click += (s, e) =>
{
HomeGrid.Visibility = Visibility.Hidden;
SettingsGrid.Visibility = Visibility.Hidden;
LogGrid.Visibility = Visibility.Visible;
HomeButton.Foreground = white;
SettingsButton.Foreground = white;
LogButton.Foreground = green;
};
SettingsButton.Click += (s, e) =>
{
HomeGrid.Visibility = Visibility.Hidden;
LogGrid.Visibility = Visibility.Hidden;
SettingsGrid.Visibility = Visibility.Visible;
HomeButton.Foreground = white;
LogButton.Foreground = white;
SettingsButton.Foreground = green;
};
// считывание дескрипторов программ
var descriptors = Directory.GetFiles("programs", "*.desc");
programsArray = new ProgramLabel[descriptors.Length];
Log(descriptors.Length + " descriptors found\n");
for (int i = 0; i < descriptors.Length; i++)
{
Log(descriptors[i] + '\n');
//programsArray[i] = new ProgramLabel(descriptors[i], i, this);
//ProgramsPanel.Children.Add(programsArray[i]);
//Log(programsArray[i].Text + " added to ProgramsPanel\n");
}
LaunchButton.Click += (s, e) => Launch();
//mainSocket.FSP_Download(new FSP_FileObject("share\\file.arc", "downloads\\file.arc"));
}
public void Log(string msg)
{
msg = "[" + DateTime.Now.ToString() + "]: " + msg;
FileWork.Log(logfile, msg);
LogBox.Text += msg;
}
public void Log(string[] input)
{
if (input.Length % 2 == 0)
{
string str = "";
for (ushort i = 0; i < input.Length; i++)
str += input[++i];
Log(str);
}
else throw new Exception("error in Log(): every text string must have color string before");
}
}
}

View File

@ -1,42 +0,0 @@
<Window x:Class="dtlauncher_client_win.LoginWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:dtlauncher_client_win"
mc:Ignorable="d"
Title="DTLauncher login" Width="500" Height="350" Background="#FF232328" MinWidth="500" MinHeight="350">
<Grid ScrollViewer.VerticalScrollBarVisibility="Disabled" Margin="0" MinWidth="492" MinHeight="320">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="25*"/>
<RowDefinition Height="174*"/>
<RowDefinition Height="23*"/>
<RowDefinition Height="72*"/>
<RowDefinition Height="25*"/>
</Grid.RowDefinitions>
<Canvas Height="200" Margin="20,14,20,8" Width="450" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.ColumnSpan="3" Grid.RowSpan="3">
<TextBox x:Name="LoginBox" HorizontalAlignment="Center" Height="30" TextWrapping="Wrap" Text="" VerticalAlignment="Center" Width="300" RenderTransformOrigin="0.534,-0.193" Background="#FF4B4B5A" Foreground="#FFF0F0F0" SelectionBrush="#FF2E628B" FontSize="17" BorderThickness="2" IsUndoEnabled="False" MaxLength="25" MaxLines="1" BorderBrush="#FFF0F0F0" MinWidth="300" MinHeight="29" Canvas.Left="130" Canvas.Top="21"/>
<PasswordBox x:Name="PasswBox" HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" Height="30" FontSize="17" Background="#FF4B4B5A" Foreground="#FFF0F0F0" SelectionBrush="#FF2E628B" MaxLength="25" BorderThickness="2" BorderBrush="#FFF0F0F0" MinWidth="300" MinHeight="30" Canvas.Left="130" Canvas.Top="83"/>
<Label Content="login:" HorizontalAlignment="Center" VerticalAlignment="Center" Height="40" Width="90" Foreground="#FFF0F0F0" FontSize="20" FontWeight="Bold" RenderTransformOrigin="0.764,0.578" FontFamily="Unispace" MinWidth="74" MinHeight="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Canvas.Left="34" Canvas.Top="17"/>
<Label Content="password:" HorizontalAlignment="Center" VerticalAlignment="Center" Height="40" Width="119" Foreground="#FFF0F0F0" FontSize="20" FontWeight="Bold" FontFamily="Unispace" MinHeight="40" MinWidth="111" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Canvas.Left="1" Canvas.Top="77"/>
<Button x:Name="RegisterButton" Content="register" Width="117" Height="40" FontSize="20"
FontWeight="Bold" Foreground="#FFF0F0F0" Background="#FF383844"
FontFamily="Unispace" BorderThickness="3" MinHeight="40" MinWidth="117" HorizontalAlignment="Center"
VerticalAlignment="Center" Canvas.Left="71" Canvas.Top="138" Template="{DynamicResource roundedButton}" Tag="10"/>
<Button x:Name="LoginButton" Content="login" Width="117" Height="40" FontSize="20" FontWeight="Bold"
Foreground="#FFF0F0F0" Background="#FFB97523" FontFamily="Unispace"
BorderThickness="3" MinHeight="40" MinWidth="117" HorizontalAlignment="Center" VerticalAlignment="Center"
Canvas.Left="272" Canvas.Top="138" Template="{DynamicResource roundedButton}" Tag="10"/>
</Canvas>
<TextBox x:Name="LogBox" Template="{DynamicResource myTextBox}"
VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" BorderThickness="0"
Background="Transparent" Foreground="#FFF0F0F0" SelectionBrush="#FF3E759E"
FontSize="14" IsReadOnly="True" Grid.Column="1" Grid.Row="3"/>
</Grid>
</Window>

View File

@ -1,144 +0,0 @@
using DTLib;
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Windows;
using static DTLib.NetWork;
namespace dtlauncher_client_win
{
/// <summary>
/// Логика взаимодействия для LoginWindow.xaml
/// </summary>
public partial class LoginWindow : Window
{
public Socket mainSocket { private set; get; } = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
public string logfile { private set; get; } = $"logs\\client-{DateTime.Now}.log".Replace(':', '-').Replace(' ', '_');
public LoginWindow()
{
InitializeComponent();
try
{
FileWork.DirExistenceCheck("logs");
FileWork.DirExistenceCheck("downloads");
NetWork.Log += Log;
LoginButton.Click += Login;
RegisterButton.Click += Register;
Closed += CloseWindow;
Log("launcher is starting\n");
// подключение к серверу
mainSocket.Connect(new IPEndPoint(Dns.GetHostAddresses(
FileWork.ReadFromConfig("client.cfg", "central server ip"))[0],
Convert.ToInt32(FileWork.ReadFromConfig("client.cfg", "central server port"))));
mainSocket.ReceiveTimeout = 2000;
Log("connecting to the main server...");
string recieved = mainSocket.Request("new user connection try").ToStr();
if (recieved != "new user connection created")
throw new Exception("can't connect to the main server");
Log("connected to the main server");
//NetWork.RequestServersList(mainSocket);
}
catch (Exception e)
{
Log("\nerror:\n" + e.Message + "\n" + e.StackTrace + '\n');
}
}
void Log(string msg)
{
msg = "[" + DateTime.Now.ToString() + "]: " + msg;
FileWork.Log(logfile, msg);
LogBox.Text += msg;
}
void Log(string[] input)
{
if (input.Length % 2 == 0)
{
string str = "";
for (ushort i = 0; i < input.Length; i++)
str += input[++i];
Log(str);
}
else throw new Exception("error in Log(): every text string must have color string before");
}
void Register(object sender, EventArgs e)
{
try
{
string login = LoginBox.Text;
string password = PasswBox.Password;
string filename = $"register-{login}.req";
var hasher = new SecureHasher(256);
if (File.Exists(filename)) File.Delete(filename);
var writer = File.CreateText(filename);
writer.Write(login + " $" +
hasher.HashSaltCycled(password.ToBytes(), login.ToBytes(), 4096)
.HashToString());
writer.Close();
Log($"request file created:{Directory.GetCurrentDirectory()}\\{filename}");
}
catch (Exception ex)
{
Log("registration error: " + ex.Message);
}
}
void Login(object sender, EventArgs e)
{
try
{
/*// пересоздание сокета
if (mainSocket.IsBound)
{
mainSocket.Shutdown(SocketShutdown.Both);
mainSocket.Close();
mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
}
var hasher = new SecureHasher(256);
// подключение к серверу
mainSocket.Connect(new IPEndPoint(Dns.GetHostAddresses("m1net.keenetic.pro")[0], 20008));
mainSocket.ReceiveTimeout = 5000;
// авторизация
string login = LoginBox.Text;
string password = PasswBox.Password;
string recievedString = NetWork.Request(mainSocket, login).ToStr();
if (recievedString != "2e9b7473ce473cdbb9b9e68aa444f5146b1b415a05917aceecd3861804cc2fd8")
{
throw new Exception("incorrect login\n");
}
recievedString = NetWork.Request(mainSocket,hasher.HashSaltCycled(password.ToBytes(), login.ToBytes(), 4096)).ToStr();
if (recievedString != "82c8e541601e0883ea189a285e514adfa6c2da05c83285359bbcf73bd3a8518b")
{
throw new Exception("incorrect password");
}*/
Log("succesfully login\n");
var lauWin = new LauncherWindow(mainSocket, logfile);
//CloseSocket(null, null);
lauWin.Show();
Hide();
lauWin.Closed += CloseWindow;
}
catch (Exception ex)
{
Log("login error: " + ex.Message + '\n' + ex.StackTrace);
}
}
void CloseWindow(object sender, EventArgs e)
{
Log("DTchat closed");
Close();
App.Current.Shutdown();
}
}
}

View File

@ -1,33 +0,0 @@
<UserControl x:Class="dtlauncher_client_win.ProgramLabel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:dtlauncher_client_win"
mc:Ignorable="d"
d:DesignHeight="40" d:DesignWidth="140" BorderThickness="0">
<UserControl.Template>
<ControlTemplate TargetType="UserControl">
<ContentPresenter />
</ControlTemplate>
</UserControl.Template>
<Grid x:Name="grid">
<!--Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition/>
</>
<Border x:Name="Border" Grid.ColumnSpan="2"
Background="{Binding Background, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"
CornerRadius="{Binding CornerRadius, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"/>
<Image x:Name="IconImage" Grid.Column="0" Stretch="Fill" Margin="3,3,3,3"
Source="{Binding Icon, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"/>
<Label Name="NameLabel" Grid.Column="1" VerticalContentAlignment="Center"
Content="{Binding Text, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"
FontSize="{Binding FontSize, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"
FontFamily="{Binding FontFamily,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"
FontWeight="{Binding FontWeight, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"/-->
</Grid>
</UserControl>

View File

@ -1,75 +0,0 @@
using System.Windows.Controls;
namespace dtlauncher_client_win
{
/// <summary>
/// Логика взаимодействия для ProgramLabel.xaml
/// </summary>
public partial class ProgramLabel : UserControl
{
/*static public DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(ProgramLabel));
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
static public DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(System.Windows.Media.Imaging.BitmapImage), typeof(ProgramLabel));
public System.Windows.Media.Imaging.BitmapImage Icon
{
get { return (System.Windows.Media.Imaging.BitmapImage)GetValue(IconProperty); }
set { SetValue(IconProperty, value); }
}
static public DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(ProgramLabel));
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}*/
public string BackgroundImage;
public string ScriptServerPath;
public string InstallDir;
public string LaunchFile;
public string Arguments;
public string Description;
public int Number;
LauncherWindow Window;
public ProgramLabel() { }
/*public ProgramLabel(string descriptorPath, int number, LauncherWindow window)
{
Window = window;
Number = number;
//grid.MouseLeftButtonDown += (s, e) => ProgramShow();
Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(240, 240, 240));
var text = FileWork.ReadFromConfig(descriptorPath, "name");
Window.Log(text + '\n');
Text = text;
//Text = (string)NameLabel.Content;
//IconImage.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Directory.GetCurrentDirectory() + "\\programs\\" + FileWork.ReadFromConfig(descriptorPath, "icon"), UriKind.Absolute));
//BackgroundImage = Directory.GetCurrentDirectory() + "\\programs\\" + FileWork.ReadFromConfig(descriptorPath, "background");
//ScriptServerPath = FileWork.ReadFromConfig(descriptorPath, "scriptserverpath");
//InstallDir = FileWork.ReadFromConfig(descriptorPath, "installdir");
//LaunchFile = FileWork.ReadFromConfig(descriptorPath, "launchfile");
//if (LaunchFile.Contains("%installdir%")) LaunchFile = LaunchFile.Replace("%installdir%", InstallDir);
//Arguments = FileWork.ReadFromConfig(descriptorPath, "arguments");
//Description = FileWork.ReadFromConfig(descriptorPath, "description").Replace("\\n", "\r\n");
//Window.Log(Text + " " + Icon + " " + Number);
}
void ProgramShow()
{
Window.programsArray[Window.PreviousProgramNum].Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(240, 240, 240));
Window.PreviousProgramNum = Number;
Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(170, 170, 240));
Window.Log(Directory.GetCurrentDirectory() + '\\' + BackgroundImage + '\n');
Window.BackgroundImage.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(BackgroundImage, UriKind.Absolute));
Window.Launch = () => {
Process.Start(LaunchFile, Arguments);
};
}*/
}
}

View File

@ -1,19 +0,0 @@
<UserControl x:Class="dtlauncher_client_win.ProgramName"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:dtlauncher_client_win"
mc:Ignorable="d"
d:DesignHeight="40" d:DesignWidth="140" BorderThickness="0">
<Grid>
<!--Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition/>
</>
<Image x:Name="IconImage" Grid.Column="0" Stretch="Fill" Margin="3,3,3,3"
Source="{Binding Icon, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"/-->
<Label Name="NameLabel" Grid.Column="1" VerticalContentAlignment="Center" FontSize="22" Foreground="AliceBlue"
Content="{Binding Content, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:ProgramLabel}}}"/>
</Grid>
</UserControl>

View File

@ -1,15 +0,0 @@
using System.Windows.Controls;
namespace dtlauncher_client_win
{
/// <summary>
/// Логика взаимодействия для ProgramName.xaml
/// </summary>
public partial class ProgramName : UserControl
{
public ProgramName()
{
InitializeComponent();
}
}
}

View File

@ -1,53 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// Общие сведения об этой сборке предоставляются следующим набором
// набор атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("dtlauncher-client-win")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("dtlauncher-client-win")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// из модели COM, установите атрибут ComVisible для этого типа в значение true.
[assembly: ComVisible(false)]
//Чтобы начать создание локализуемых приложений, задайте
//<UICulture>CultureYouAreCodingWith</UICulture> в файле .csproj
//в <PropertyGroup>. Например, при использовании английского (США)
//в своих исходных файлах установите <UICulture> в en-US. Затем отмените преобразование в комментарий
//атрибута NeutralResourceLanguage ниже. Обновите "en-US" в
//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
//(используется, если ресурс не найден на странице,
// или в словарях ресурсов приложения)
ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
//(используется, если ресурс не найден на странице,
// в приложении или в каких-либо словарях ресурсов для конкретной темы)
)]
// Сведения о версии для сборки включают четыре следующих значения:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Номер редакции
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,70 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код был создан программным средством.
// Версия среды выполнения: 4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
// код создан повторно.
// </auto-generated>
//------------------------------------------------------------------------------
namespace dtlauncher_client_win.Properties
{
/// <summary>
/// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
/// </summary>
// Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
// класс с помощью таких средств, как ResGen или Visual Studio.
// Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
// с параметром /str или заново постройте свой VS-проект.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("dtlauncher_client_win.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Переопределяет свойство CurrentUICulture текущего потока для всех
/// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,29 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace dtlauncher_client_win.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 437 KiB

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{367793EE-4757-4ADD-BF7E-960DC9EB6DF9}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>dtlauncher_client_win</RootNamespace>
<AssemblyName>dtlauncher-client-win</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Build|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>dtlauncher_client_win.App</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="LauncherWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LoginWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="LauncherWindow.xaml.cs">
<DependentUpon>LauncherWindow.xaml</DependentUpon>
</Compile>
<Compile Include="LoginWindow.xaml.cs">
<DependentUpon>LoginWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="ProgramLabel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProgramName.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="ProgramLabel.xaml.cs">
<DependentUpon>ProgramLabel.xaml</DependentUpon>
</Compile>
<Compile Include="ProgramName.xaml.cs">
<DependentUpon>ProgramName.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DTLib\DTLib.csproj">
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
<Name>DTLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="divinity2devcut_background.jpg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del /f /q dtlauncher-client-win.exe.config</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

View File

@ -1,94 +0,0 @@
<Application x:Class="dtlauncher_server_win.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:dtlauncher_server_win"
StartupUri="ServerWindow.xaml">
<Application.Resources>
<ControlTemplate x:Key="myScrollBar" TargetType="{x:Type ScrollBar}">
<Grid x:Name="Bg" SnapsToDevicePixels="True">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Row="1"/>
<Track x:Name="PART_Track" IsDirectionReversed="True" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageUpCommand">
<RepeatButton.Style>
<Style TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</RepeatButton.Style>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageDownCommand">
<RepeatButton.Style>
<Style TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</RepeatButton.Style>
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb>
<Thumb.Style>
<Style TargetType="{x:Type Thumb}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Rectangle x:Name="rectangle" Fill="#FFCDCDCD" Height="{TemplateBinding Height}" SnapsToDevicePixels="True" Width="{TemplateBinding Width}"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Fill" TargetName="rectangle" Value="#FFA6A6A6"/>
</Trigger>
<Trigger Property="IsDragging" Value="True">
<Setter Property="Fill" TargetName="rectangle" Value="#FF606060"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Thumb.Style>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="myScrollViewer" TargetType="{x:Type ScrollViewer}">
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
<ScrollBar Template="{DynamicResource myScrollBar}" Background="#FF6D8B8B" x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
<ScrollBar Template="{DynamicResource myScrollBar}" Background="#FF6D8B8B" x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
</Grid>
</ControlTemplate>
</Application.Resources>
</Application>

View File

@ -1,11 +0,0 @@
using System.Windows;
namespace dtlauncher_server_win
{
/// <summary>
/// Логика взаимодействия для App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@ -1,53 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// Общие сведения об этой сборке предоставляются следующим набором
// набор атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("dtlauncher-server-win")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("dtlauncher-server-win")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// из модели COM, установите атрибут ComVisible для этого типа в значение true.
[assembly: ComVisible(false)]
//Чтобы начать создание локализуемых приложений, задайте
//<UICulture>CultureYouAreCodingWith</UICulture> в файле .csproj
//в <PropertyGroup>. Например, при использовании английского (США)
//в своих исходных файлах установите <UICulture> в en-US. Затем отмените преобразование в комментарий
//атрибута NeutralResourceLanguage ниже. Обновите "en-US" в
//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
//(используется, если ресурс не найден на странице,
// или в словарях ресурсов приложения)
ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
//(используется, если ресурс не найден на странице,
// в приложении или в каких-либо словарях ресурсов для конкретной темы)
)]
// Сведения о версии для сборки включают четыре следующих значения:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Номер редакции
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,70 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код был создан программным средством.
// Версия среды выполнения: 4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
// код создан повторно.
// </auto-generated>
//------------------------------------------------------------------------------
namespace dtlauncher_server_win.Properties
{
/// <summary>
/// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
/// </summary>
// Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
// класс с помощью таких средств, как ResGen или Visual Studio.
// Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
// с параметром /str или заново постройте свой VS-проект.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("dtlauncher_server_win.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Переопределяет свойство CurrentUICulture текущего потока для всех
/// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,29 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace dtlauncher_server_win.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -1,12 +0,0 @@
<Window x:Class="dtlauncher_server_win.ServerWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:dtlauncher_server_win"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>

View File

@ -1,116 +0,0 @@
using DTLib;
using System;
using System.Net.Sockets;
using System.Threading;
using System.Windows;
using static DTLib.NetWork;
namespace dtlauncher_server_win
{
/// <summary>
/// Логика взаимодействия для ServerWindow.xaml
/// </summary>
public partial class ServerWindow : Window
{
static string logfile = $"logs\\server-{DateTime.Now}.log".Replace(':', '-').Replace(' ', '_');
static Socket mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
public ServerWindow()
{
InitializeComponent();
/*while (true)
{
try
{
FileWork.DirExistenceCheck("logs");
FileWork.DirExistenceCheck("share");
NetWork.Log += Log;
Log($"<{FileWork.ReadFromConfig("server.cfg", "server ip")}> : <{Convert.ToInt32(FileWork.ReadFromConfig("server.cfg", "server port"))}>\n");
mainSocket.Bind(new IPEndPoint(IPAddress.Parse(FileWork.ReadFromConfig("server.cfg", "server ip")), Convert.ToInt32(FileWork.ReadFromConfig("server.cfg", "server port"))));
Log("server started succesfully\n");
try
{
mainSocket.Listen(200);
while (true)
{
var userSocket = mainSocket.Accept();
var userThread = new Thread(new ParameterizedThreadStart(UserStart));
userThread.Start(userSocket);
}
}
catch (Exception ex)
{
Log($"handler error:\n message:\n {ex.Message}\nmethod:\n {ex.TargetSite}\n");
}
}
catch (Exception ex)
{
if (mainSocket.IsBound) mainSocket.CloseSocket();
Log($"Main() error:\n message:\n {ex.Message}\nmethod:\n {ex.TargetSite}\n");
}
Thread.Sleep(1500);
}*/
}
void Log(string msg)
{
msg = "[" + DateTime.Now.ToString() + "]: " + msg;
FileWork.Log(logfile, msg);
//LogBox.Text += msg;
}
void Log(string[] input)
{
if (input.Length % 2 == 0)
{
string str = "";
for (ushort i = 0; i < input.Length; i++)
str += input[++i];
Log(str);
}
else throw new Exception("error in Log(): every text string must have color string before");
}
void UserStart(dynamic _handlerSocket)
{
Socket handlerSocket = (Socket)_handlerSocket;
Log("user connected\n");
try
{
string recieved = handlerSocket.GetData().ToStr();
if (recieved == "new user connection try")
{
handlerSocket.Send("new user connection created".ToBytes());
while (true)
{
recieved = handlerSocket.GetData().ToStr();
switch (recieved)
{
// ответ на NetWork.Ping()
case "ping":
handlerSocket.Send("pong".ToBytes());
break;
// отправка списка активных серверов
case "requesting servers list":
break;
// отправка файла
case "requesting file download":
handlerSocket.FSP_Upload();
break;
default:
throw new Exception("unknown request: " + recieved);
}
}
}
else throw new Exception("incorrect connection try");
}
catch (Exception ex)
{
Log($"UserStart() error:\n message:\n {ex.Message}\n{ex.StackTrace}\n");
handlerSocket.CloseSocket();
Thread.CurrentThread.Abort();
}
}
}
}

View File

@ -1,127 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8B9889A7-93DC-4914-92D1-8209BD3BA71A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>dtlauncher_server_win</RootNamespace>
<AssemblyName>dtlauncher-server-win</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Build|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>dtlauncher_server_win.App</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="ServerWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="ServerWindow.xaml.cs">
<DependentUpon>ServerWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DTLib\DTLib.csproj">
<Project>{ce793497-2d5c-42d8-b311-e9b32af9cdfb}</Project>
<Name>DTLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 и x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del /f /q dtlauncher-server-win.exe.config</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -1,36 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DTLib", "..\DTLib\DTLib.csproj", "{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dtlauncher-client-win", "dtlauncher-client-win\dtlauncher-client-win.csproj", "{367793EE-4757-4ADD-BF7E-960DC9EB6DF9}"
ProjectSection(ProjectDependencies) = postProject
{CE793497-2D5C-42D8-B311-E9B32AF9CDFB} = {CE793497-2D5C-42D8-B311-E9B32AF9CDFB}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dtlauncher-server-win", "dtlauncher-server-win\dtlauncher-server-win.csproj", "{8B9889A7-93DC-4914-92D1-8209BD3BA71A}"
ProjectSection(ProjectDependencies) = postProject
{CE793497-2D5C-42D8-B311-E9B32AF9CDFB} = {CE793497-2D5C-42D8-B311-E9B32AF9CDFB}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Build|Any CPU = Build|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.Build|Any CPU.ActiveCfg = Build|Any CPU
{CE793497-2D5C-42D8-B311-E9B32AF9CDFB}.Build|Any CPU.Build.0 = Build|Any CPU
{367793EE-4757-4ADD-BF7E-960DC9EB6DF9}.Build|Any CPU.ActiveCfg = Build|Any CPU
{367793EE-4757-4ADD-BF7E-960DC9EB6DF9}.Build|Any CPU.Build.0 = Build|Any CPU
{8B9889A7-93DC-4914-92D1-8209BD3BA71A}.Build|Any CPU.ActiveCfg = Build|Any CPU
{8B9889A7-93DC-4914-92D1-8209BD3BA71A}.Build|Any CPU.Build.0 = Build|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E6569C0C-DD32-4F7D-AD4C-DBC5434D2F8C}
EndGlobalSection
EndGlobal