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:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<SolidColorBrush x:Key="MyBackgroundColor" Color="#232328"/>
<SolidColorBrush x:Key="MyDarkTr"
Opacity="0.8"
Color="#141419" />
@ -30,7 +31,7 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border x:Name="rectangle"
Width="8"
Width="6"
Height="{TemplateBinding Height}"
Background="{DynamicResource MyGray}"
SnapsToDevicePixels="True" />
@ -178,11 +179,26 @@
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Background" Value="{DynamicResource MyDarkTr}" />
<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}" />
<!-->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>
<ControlTemplate x:Key="MyComboBox" TargetType="ComboBox">
<Grid>
<ToggleButton Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">

View File

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

View File

@ -11,9 +11,9 @@ public partial class LauncherWindow : Window
InitializeComponent();
LogBox.Text = Logger.Buffer;
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)=>
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.MouseLeave += (s,e)=>LogfileLabel.Foreground=App.MyWhite;
LibraryButton.TabGrid = LibraryGrid;
@ -89,7 +89,7 @@ public partial class LauncherWindow : Window
DescriptionBox.Text = selectedProg.Description;
BackgroundImage.Source =
new BitmapImage(new Uri(
$"{Directory.GetCurrent()}{Path.Sep}backgrounds{Path.Sep}{selectedProg.BackgroundFile}",
$"{Directory.GetCurrent()}{Путь.Разд}backgrounds{Путь.Разд}{selectedProg.BackgroundFile}",
UriKind.Absolute));
ProgramSettingsViever.Content = selectedProg.SettingsPanel;
DisplayingProgram = selectedProg;

View File

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

View File

@ -4,8 +4,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:launcher_client_win.GUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="30"
d:DesignWidth="100"
d:DesignHeight="30"
mc:Ignorable="d"
Background="Transparent">
<Grid>
@ -15,7 +15,9 @@
</Grid.ColumnDefinitions>
<Label Name="KeyLabel" Grid.Column="0"
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"
HorizontalScrollBarVisibility="Auto"
Style="{DynamicResource MyTextBoxStyle}"

View File

@ -7,23 +7,34 @@ public partial class ProgramSettingsPanelItem : UserControl
public static readonly DependencyProperty SettingKeyProp = DependencyProperty.Register(
"SettingKey",
typeof(string),
typeof(TabButton));
typeof(ProgramSettingsPanelItem));
public string SettingKey
{
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(
"SettingValue",
typeof(string),
typeof(TabButton));
typeof(ProgramSettingsPanelItem));
public string SettingValue
{
get => (string)GetValue(SettingValueProp);
set => SetValue(SettingValueProp, value);
}
public event Action<ProgramSettingsPanelItem> UpdatedEvent;
public ProgramSettingsPanelItem(string key, string value)
{
InitializeComponent();
@ -31,6 +42,4 @@ public partial class ProgramSettingsPanelItem : UserControl
SettingValue = value;
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("installed");
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"));
CurrentLauncherWindow = new();
CurrentLauncherWindow.Show();

View File

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

View File

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

View File

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

View File

@ -95,7 +95,7 @@ static class Server
hasher.HashCycled(handlerSocket.GetPackage(), 64).HashToString(),
":\n{\n\tusername: \"", handlerSocket.GetPackage().ToString(),
"\";\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);
Logger.LogAsync("b", $"text wrote to file <", "c", $"registration_requests\\{filepath}", "b", ">");
break;
@ -126,7 +126,7 @@ static class Server
{
lock (manifestLocker) fsp.UploadFile("share\\manifest.dtsod");
}
else fsp.UploadFile("share\\" + file);
else fsp.UploadFile($"share\\{file}");
break;
case "requesting uuid":
Logger.LogAsync("b", $"user ", "c", user.name, "b", " requested uuid");
@ -134,7 +134,8 @@ static class Server
break;
case "excess files found":
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;
case "sending launcher error":
Logger.LogAsync("y", "user ", "c", user.name, "y", "is sending error:");
@ -176,19 +177,19 @@ static class Server
{
lock (manifestLocker)
{
Directory.Create("share\\download_if_not_exist");
Directory.Create("share\\sync_always");
Directory.Create("share\\sync_and_remove");
Directory.Create($"share\\download_if_not_exist");
Directory.Create($"share\\sync_always");
Directory.Create($"share\\sync_and_remove");
FSP.CreateManifest("share\\download_if_not_exist");
FSP.CreateManifest("share\\sync_always");
FSP.CreateManifest($"share\\download_if_not_exist");
FSP.CreateManifest($"share\\sync_always");
foreach (string dir in Directory.GetDirectories("share\\sync_and_remove"))
FSP.CreateManifest(dir);
File.WriteAllText("share\\sync_and_remove\\dirlist.dtsod",
File.WriteAllText($"share\\sync_and_remove\\dirlist.dtsod",
$"dirs: [\""+
Directory.GetDirectories("share\\sync_and_remove")
.MergeToString("\",\"")
.Replace("share\\sync_and_remove\\", "")+
.Replace($"share\\sync_and_remove\\", "")+
"\"];");
};
}

View File

@ -7,12 +7,14 @@
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<DebugType>full</DebugType>
<Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\DTLib\DTLib.Network\DTLib.Network.csproj" />
<ProjectReference Include="..\..\DTLib\DTLib.Dtsod\DTLib.Dtsod.csproj" />
<ProjectReference Include="..\..\DTLib\DTLib\DTLib.csproj" />
<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>
<ItemGroup>