some old changes

This commit is contained in:
Timerix22 2022-06-30 22:05:52 +03:00
parent 87f17669c3
commit a5b7e0479d
12 changed files with 73 additions and 41 deletions

View File

@ -2,6 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources> <Application.Resources>
<SolidColorBrush x:Key="MyBackgroundColor" Color="#232328"/>
<SolidColorBrush x:Key="MyDarkTr" <SolidColorBrush x:Key="MyDarkTr"
Opacity="0.8" Opacity="0.8"
Color="#141419" /> Color="#141419" />
@ -30,7 +31,7 @@
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}"> <ControlTemplate TargetType="{x:Type Thumb}">
<Border x:Name="rectangle" <Border x:Name="rectangle"
Width="8" Width="6"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
Background="{DynamicResource MyGray}" Background="{DynamicResource MyGray}"
SnapsToDevicePixels="True" /> SnapsToDevicePixels="True" />
@ -172,17 +173,32 @@
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
<Style x:Key="MyLabelStyle" TargetType="Label"> <Style x:Key="MyLabelStyle" TargetType="Label">
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Background" Value="{DynamicResource MyDarkTr}" /> <Setter Property="Background" Value="{DynamicResource MyDarkTr}" />
<Setter Property="FontFamily" Value="Unispace" /> <Setter Property="FontFamily" Value="Unispace" />
<Setter Property="FontSize" Value="15" /> <Setter Property="FontStyle" Value="Normal" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="{DynamicResource MyWhite}" /> <Setter Property="Foreground" Value="{DynamicResource MyWhite}" />
<!-->disables some shit which removes underscores from Content<!-->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Label}">
<Border Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="False" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> </Style>
<ControlTemplate x:Key="MyComboBox" TargetType="ComboBox"> <ControlTemplate x:Key="MyComboBox" TargetType="ComboBox">
<Grid> <Grid>
<ToggleButton Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"> <ToggleButton Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">

View File

@ -9,7 +9,7 @@
Height="500" Height="500"
MinWidth="800" MinWidth="800"
MinHeight="500" MinHeight="500"
Background="#232328" Background="{DynamicResource MyBackgroundColor}"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -72,7 +72,7 @@
<ColumnDefinition Width="5" /> <ColumnDefinition Width="5" />
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="5" /> <ColumnDefinition Width="5" />
<ColumnDefinition Width="200" /> <ColumnDefinition Width="220" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ScrollViewer Grid.Column="0" <ScrollViewer Grid.Column="0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"

View File

@ -11,9 +11,9 @@ public partial class LauncherWindow : Window
InitializeComponent(); InitializeComponent();
LogBox.Text = Logger.Buffer; LogBox.Text = Logger.Buffer;
Logger.MessageSent += LogHandler; Logger.MessageSent += LogHandler;
LogfileLabel.Content = Logger.Logfile.Remove(0,Logger.Logfile.LastIndexOf(Path.Sep)+1); LogfileLabel.Content = Logger.Logfile.Remove(0,Logger.Logfile.LastIndexOf(Путь.Разд)+1);
LogfileLabel.MouseLeftButtonDown += (s,e)=> LogfileLabel.MouseLeftButtonDown += (s,e)=>
Process.Start("explorer.exe", Logger.Logfile.Remove(Logger.Logfile.LastIndexOf(Path.Sep))); Process.Start("explorer.exe", Logger.Logfile.Remove(Logger.Logfile.LastIndexOf(Путь.Разд)));
LogfileLabel.MouseEnter += (s,e)=>LogfileLabel.Foreground=App.MySelectionColor; LogfileLabel.MouseEnter += (s,e)=>LogfileLabel.Foreground=App.MySelectionColor;
LogfileLabel.MouseLeave += (s,e)=>LogfileLabel.Foreground=App.MyWhite; LogfileLabel.MouseLeave += (s,e)=>LogfileLabel.Foreground=App.MyWhite;
LibraryButton.TabGrid = LibraryGrid; LibraryButton.TabGrid = LibraryGrid;
@ -89,7 +89,7 @@ public partial class LauncherWindow : Window
DescriptionBox.Text = selectedProg.Description; DescriptionBox.Text = selectedProg.Description;
BackgroundImage.Source = BackgroundImage.Source =
new BitmapImage(new Uri( new BitmapImage(new Uri(
$"{Directory.GetCurrent()}{Path.Sep}backgrounds{Path.Sep}{selectedProg.BackgroundFile}", $"{Directory.GetCurrent()}{Путь.Разд}backgrounds{Путь.Разд}{selectedProg.BackgroundFile}",
UriKind.Absolute)); UriKind.Absolute));
ProgramSettingsViever.Content = selectedProg.SettingsPanel; ProgramSettingsViever.Content = selectedProg.SettingsPanel;
DisplayingProgram = selectedProg; DisplayingProgram = selectedProg;

View File

@ -10,7 +10,7 @@ public partial class ProgramLabel : UserControl
InitializeComponent(); InitializeComponent();
NameLabel.Content = label; NameLabel.Content = label;
IconImage.Source = new BitmapImage(new Uri( IconImage.Source = new BitmapImage(new Uri(
$"{Directory.GetCurrent()}{Path.Sep}icons{Path.Sep}{icon}", $"{Directory.GetCurrent()}{Путь.Разд}icons{Путь.Разд}{icon}",
UriKind.Absolute)); UriKind.Absolute));
} }
} }

View File

@ -4,8 +4,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:launcher_client_win.GUI" xmlns:local="clr-namespace:launcher_client_win.GUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="30"
d:DesignWidth="100" d:DesignWidth="100"
d:DesignHeight="30"
mc:Ignorable="d" mc:Ignorable="d"
Background="Transparent"> Background="Transparent">
<Grid> <Grid>
@ -15,7 +15,9 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Name="KeyLabel" Grid.Column="0" <Label Name="KeyLabel" Grid.Column="0"
Content="{Binding SettingKey, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ProgramSettingsPanelItem}}" Content="{Binding SettingKey, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ProgramSettingsPanelItem}}"
Style="{DynamicResource MyLabelStyle}" /> Style="{DynamicResource MyLabelStyle}"
FontFamily="default"
FontSize="16"/>
<TextBox Name="ValueBox" Grid.Column="1" <TextBox Name="ValueBox" Grid.Column="1"
HorizontalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
Style="{DynamicResource MyTextBoxStyle}" Style="{DynamicResource MyTextBoxStyle}"

View File

@ -7,22 +7,33 @@ public partial class ProgramSettingsPanelItem : UserControl
public static readonly DependencyProperty SettingKeyProp = DependencyProperty.Register( public static readonly DependencyProperty SettingKeyProp = DependencyProperty.Register(
"SettingKey", "SettingKey",
typeof(string), typeof(string),
typeof(TabButton)); typeof(ProgramSettingsPanelItem));
public string SettingKey public string SettingKey
{ {
get => (string)GetValue(SettingKeyProp); get => (string)GetValue(SettingKeyProp);
set => SetValue(SettingKeyProp, value); set
{
SetValue(SettingKeyProp, value);
KeyLabel.ToolTip = new ToolTip
{
Content = value,
Foreground = App.MyWhite,
Background = App.MySoftDark
};
}
} }
public static readonly DependencyProperty SettingValueProp = DependencyProperty.Register( public static readonly DependencyProperty SettingValueProp = DependencyProperty.Register(
"SettingValue", "SettingValue",
typeof(string), typeof(string),
typeof(TabButton)); typeof(ProgramSettingsPanelItem));
public string SettingValue public string SettingValue
{ {
get => (string)GetValue(SettingValueProp); get => (string)GetValue(SettingValueProp);
set => SetValue(SettingValueProp, value); set => SetValue(SettingValueProp, value);
} }
public event Action<ProgramSettingsPanelItem> UpdatedEvent;
public ProgramSettingsPanelItem(string key, string value) public ProgramSettingsPanelItem(string key, string value)
{ {
@ -31,6 +42,4 @@ public partial class ProgramSettingsPanelItem : UserControl
SettingValue = value; SettingValue = value;
ValueBox.TextChanged += (_,_)=> UpdatedEvent?.Invoke(this); ValueBox.TextChanged += (_,_)=> UpdatedEvent?.Invoke(this);
} }
public event Action<ProgramSettingsPanelItem> UpdatedEvent;
} }

View File

@ -31,7 +31,7 @@ public static class Launcher
Directory.Create("backgrounds"); Directory.Create("backgrounds");
Directory.Create("installed"); Directory.Create("installed");
Directory.Create("settings"); Directory.Create("settings");
File.WriteAllText($"descriptors{Path.Sep}default.descriptor.template", File.WriteAllText($"descriptors{Путь.Разд}default.descriptor.template",
ReadResource("launcher_client_win.Resources.default.descriptor.template")); ReadResource("launcher_client_win.Resources.default.descriptor.template"));
CurrentLauncherWindow = new(); CurrentLauncherWindow = new();
CurrentLauncherWindow.Show(); CurrentLauncherWindow.Show();

View File

@ -26,7 +26,7 @@ public class LauncherConfig
if (File.Exists(configFile)) if (File.Exists(configFile))
{ {
DtsodV23 oldConfig = new(File.ReadAllText(configFile)); DtsodV23 oldConfig = new(File.ReadAllText(configFile));
updatedConfig = DtsodFunctions.UpdateByDefault(oldConfig, updatedDefault); updatedConfig = DtsodConverter.UpdateByDefault(oldConfig, updatedDefault);
} }
else updatedConfig = updatedDefault; else updatedConfig = updatedDefault;

View File

@ -1,6 +1,5 @@
using System.Windows.Controls; using System.Windows.Controls;
using launcher_client_win.GUI; using launcher_client_win.GUI;
using Path = DTLib.Filesystem.Path;
namespace launcher_client_win; namespace launcher_client_win;
@ -40,9 +39,9 @@ public class Program
ProgramLabel = new ProgramLabel(Name, IconFile); ProgramLabel = new ProgramLabel(Name, IconFile);
ProgramLabel.MouseLeftButtonDown += (_, _) => ProgramSelectedEvent?.Invoke(this); ProgramLabel.MouseLeftButtonDown += (_, _) => ProgramSelectedEvent?.Invoke(this);
SettingsFile = $"settings{Path.Sep}{Directory}.settings"; SettingsFile = $"settings{Путь.Разд}{Directory}.settings";
Settings = File.Exists(SettingsFile) Settings = File.Exists(SettingsFile)
? DtsodFunctions.UpdateByDefault( ? DtsodConverter.UpdateByDefault(
new DtsodV23(File.ReadAllText(SettingsFile)), new DtsodV23(File.ReadAllText(SettingsFile)),
descriptor["default_settings"]) descriptor["default_settings"])
: descriptor["default_settings"]; : descriptor["default_settings"];

View File

@ -10,13 +10,10 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<ApplicationIcon>Resources\logo-D.ico</ApplicationIcon> <ApplicationIcon>Resources\logo-D.ico</ApplicationIcon>
<TargetCulture Label="Invariant" /> <TargetCulture Label="Invariant" />
<Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\DTLib\DTLib.Dtsod\DTLib.Dtsod.csproj" />
<ProjectReference Include="..\..\DTLib\DTLib\DTLib.csproj" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ApplicationDefinition Include="GUI\App.xaml"> <ApplicationDefinition Include="GUI\App.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@ -28,4 +25,10 @@
<EmbeddedResource Include="Resources\*" /> <EmbeddedResource Include="Resources\*" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.dll" />
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Dtsod.dll" />
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Network.dll" />
</ItemGroup>
</Project> </Project>

View File

@ -95,7 +95,7 @@ static class Server
hasher.HashCycled(handlerSocket.GetPackage(), 64).HashToString(), hasher.HashCycled(handlerSocket.GetPackage(), 64).HashToString(),
":\n{\n\tusername: \"", handlerSocket.GetPackage().ToString(), ":\n{\n\tusername: \"", handlerSocket.GetPackage().ToString(),
"\";\n\tuuid: \"null\";\n};"); "\";\n\tuuid: \"null\";\n};");
string filepath = $"registration_requests\\{DateTime.Now.ToString(CultureInfo.InvariantCulture).NormalizeAsPath()}.req"; string filepath = $"registration_requests\\{DateTime.Now.ToString(CultureInfo.InvariantCulture).НормализоватьДляПути()}.req";
File.WriteAllText(filepath, req); File.WriteAllText(filepath, req);
Logger.LogAsync("b", $"text wrote to file <", "c", $"registration_requests\\{filepath}", "b", ">"); Logger.LogAsync("b", $"text wrote to file <", "c", $"registration_requests\\{filepath}", "b", ">");
break; break;
@ -126,7 +126,7 @@ static class Server
{ {
lock (manifestLocker) fsp.UploadFile("share\\manifest.dtsod"); lock (manifestLocker) fsp.UploadFile("share\\manifest.dtsod");
} }
else fsp.UploadFile("share\\" + file); else fsp.UploadFile($"share\\{file}");
break; break;
case "requesting uuid": case "requesting uuid":
Logger.LogAsync("b", $"user ", "c", user.name, "b", " requested uuid"); Logger.LogAsync("b", $"user ", "c", user.name, "b", " requested uuid");
@ -134,7 +134,8 @@ static class Server
break; break;
case "excess files found": case "excess files found":
Logger.LogAsync("b", $"user ", "c", user.name, "b", " sent excess files list"); Logger.LogAsync("b", $"user ", "c", user.name, "b", " sent excess files list");
fsp.DownloadFile($"excesses\\{user.name}-{DateTime.Now.ToString(CultureInfo.InvariantCulture).NormalizeAsPath()}.txt"); fsp.DownloadFile($"excesses\\{user.name}-" +
$"{DateTime.Now.ToString(CultureInfo.InvariantCulture).НормализоватьДляПути()}.txt");
break; break;
case "sending launcher error": case "sending launcher error":
Logger.LogAsync("y", "user ", "c", user.name, "y", "is sending error:"); Logger.LogAsync("y", "user ", "c", user.name, "y", "is sending error:");
@ -176,19 +177,19 @@ static class Server
{ {
lock (manifestLocker) lock (manifestLocker)
{ {
Directory.Create("share\\download_if_not_exist"); Directory.Create($"share\\download_if_not_exist");
Directory.Create("share\\sync_always"); Directory.Create($"share\\sync_always");
Directory.Create("share\\sync_and_remove"); Directory.Create($"share\\sync_and_remove");
FSP.CreateManifest("share\\download_if_not_exist"); FSP.CreateManifest($"share\\download_if_not_exist");
FSP.CreateManifest("share\\sync_always"); FSP.CreateManifest($"share\\sync_always");
foreach (string dir in Directory.GetDirectories("share\\sync_and_remove")) foreach (string dir in Directory.GetDirectories("share\\sync_and_remove"))
FSP.CreateManifest(dir); FSP.CreateManifest(dir);
File.WriteAllText("share\\sync_and_remove\\dirlist.dtsod", File.WriteAllText($"share\\sync_and_remove\\dirlist.dtsod",
$"dirs: [\""+ $"dirs: [\""+
Directory.GetDirectories("share\\sync_and_remove") Directory.GetDirectories("share\\sync_and_remove")
.MergeToString("\",\"") .MergeToString("\",\"")
.Replace("share\\sync_and_remove\\", "")+ .Replace($"share\\sync_and_remove\\", "")+
"\"];"); "\"];");
}; };
} }

View File

@ -7,12 +7,14 @@
<ImplicitUsings>disable</ImplicitUsings> <ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\DTLib\DTLib.Network\DTLib.Network.csproj" /> <Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.dll" />
<ProjectReference Include="..\..\DTLib\DTLib.Dtsod\DTLib.Dtsod.csproj" /> <Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Dtsod.dll" />
<ProjectReference Include="..\..\DTLib\DTLib\DTLib.csproj" /> <Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Network.dll" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>