mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-13 21:02:08 +08:00
1.1.0 -> 1.1.1 第6次更新
This commit is contained in:
parent
a90798a22d
commit
9c44edfed9
@ -14,8 +14,5 @@ internal class AboutVersionButtonContentConv : IMultiValueConverter
|
|||||||
return VersionButtonContent + version;
|
return VersionButtonContent + version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -11,35 +11,20 @@ internal class MainContentBoxForegroundConv : IMultiValueConverter
|
|||||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
MainConst.SettingsMode? mode = values[0] as MainConst.SettingsMode?;
|
MainConst.SettingsMode? mode = values[0] as MainConst.SettingsMode?;
|
||||||
bool? isFocused = values[1] as bool?;
|
string? browserPath = values[1] as string;
|
||||||
string? browserPath = values[2] as string;
|
string? upstreamUrl = values[2] as string;
|
||||||
string? upstreamUrl = values[3] as string;
|
string? extraArgs = values[3] as string;
|
||||||
string? extraArgs = values[4] as string;
|
|
||||||
|
|
||||||
if (!(bool)isFocused!)
|
switch (mode)
|
||||||
{
|
{
|
||||||
switch (mode)
|
case MainConst.SettingsMode.BrowserPathMode when browserPath == MainConst.BrowserPathPlaceHolder:
|
||||||
{
|
case MainConst.SettingsMode.UpstreamUrlMode when upstreamUrl == MainConst.UpstreamUrlPlaceHolder:
|
||||||
case MainConst.SettingsMode.BrowserPathMode:
|
case MainConst.SettingsMode.ExtraArgsMode when extraArgs == MainConst.ExtraArgsPlaceHolder:
|
||||||
if (browserPath == MainConst.BrowserPathPlaceHolder)
|
return new SolidColorBrush(Color.FromRgb(191, 205, 219));
|
||||||
return new SolidColorBrush(Color.FromRgb(191, 205, 219));
|
|
||||||
break;
|
|
||||||
case MainConst.SettingsMode.UpstreamUrlMode:
|
|
||||||
if (upstreamUrl == MainConst.UpstreamUrlPlaceHolder)
|
|
||||||
return new SolidColorBrush(Color.FromRgb(191, 205, 219));
|
|
||||||
break;
|
|
||||||
case MainConst.SettingsMode.ExtraArgsMode:
|
|
||||||
if (extraArgs == MainConst.ExtraArgsPlaceHolder)
|
|
||||||
return new SolidColorBrush(Color.FromRgb(191, 205, 219));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SolidColorBrush(Color.FromRgb(0, 0, 0));
|
return new SolidColorBrush(Color.FromRgb(0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -15,41 +15,17 @@ internal class MainContentBoxTextConv : IMultiValueConverter
|
|||||||
string? upstreamUrl = values[3] as string;
|
string? upstreamUrl = values[3] as string;
|
||||||
string? extraArgs = values[4] as string;
|
string? extraArgs = values[4] as string;
|
||||||
|
|
||||||
if (mode == MainConst.SettingsMode.BrowserPathMode)
|
return mode switch
|
||||||
{
|
{
|
||||||
if ((bool)!isFocused! && string.IsNullOrEmpty(browserPath))
|
MainConst.SettingsMode.BrowserPathMode => !isFocused.GetValueOrDefault() && string.IsNullOrEmpty(browserPath) ? MainConst.BrowserPathPlaceHolder :
|
||||||
return MainConst.BrowserPathPlaceHolder;
|
isFocused.GetValueOrDefault() && browserPath == MainConst.BrowserPathPlaceHolder ? string.Empty : browserPath!,
|
||||||
else if ((bool)isFocused! && browserPath == MainConst.BrowserPathPlaceHolder)
|
MainConst.SettingsMode.UpstreamUrlMode => !isFocused.GetValueOrDefault() && string.IsNullOrEmpty(upstreamUrl) ? MainConst.UpstreamUrlPlaceHolder :
|
||||||
return string.Empty;
|
isFocused.GetValueOrDefault() && upstreamUrl == MainConst.UpstreamUrlPlaceHolder ? string.Empty : upstreamUrl!,
|
||||||
else
|
MainConst.SettingsMode.ExtraArgsMode => !isFocused.GetValueOrDefault() && string.IsNullOrEmpty(extraArgs) ? MainConst.ExtraArgsPlaceHolder :
|
||||||
return browserPath!;
|
isFocused.GetValueOrDefault() && extraArgs == MainConst.ExtraArgsPlaceHolder ? string.Empty : extraArgs!,
|
||||||
}
|
_ => throw new UnreachableException(),
|
||||||
else if (mode == MainConst.SettingsMode.UpstreamUrlMode)
|
};
|
||||||
{
|
|
||||||
if ((bool)!isFocused! && string.IsNullOrEmpty(upstreamUrl))
|
|
||||||
return MainConst.UpstreamUrlPlaceHolder;
|
|
||||||
else if ((bool)isFocused! && upstreamUrl == MainConst.UpstreamUrlPlaceHolder)
|
|
||||||
return string.Empty;
|
|
||||||
else
|
|
||||||
return upstreamUrl!;
|
|
||||||
}
|
|
||||||
else if (mode == MainConst.SettingsMode.ExtraArgsMode)
|
|
||||||
{
|
|
||||||
if ((bool)!isFocused! && string.IsNullOrEmpty(extraArgs))
|
|
||||||
return MainConst.ExtraArgsPlaceHolder;
|
|
||||||
else if ((bool)isFocused! && extraArgs == MainConst.ExtraArgsPlaceHolder)
|
|
||||||
return string.Empty;
|
|
||||||
else
|
|
||||||
return extraArgs!;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new UnreachableException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -12,18 +12,14 @@ internal class MainFunctionButtonContentConv : IValueConverter
|
|||||||
{
|
{
|
||||||
MainConst.SettingsMode? mode = value as MainConst.SettingsMode?;
|
MainConst.SettingsMode? mode = value as MainConst.SettingsMode?;
|
||||||
|
|
||||||
if (mode == MainConst.SettingsMode.BrowserPathMode)
|
return mode switch
|
||||||
return MainConst.FunctionButtonBrowserPathContent;
|
{
|
||||||
else if (mode == MainConst.SettingsMode.UpstreamUrlMode)
|
MainConst.SettingsMode.BrowserPathMode => MainConst.FunctionButtonBrowserPathContent,
|
||||||
return MainConst.FunctionButtonUpstreamUrlContent;
|
MainConst.SettingsMode.UpstreamUrlMode => MainConst.FunctionButtonUpstreamUrlContent,
|
||||||
else if (mode == MainConst.SettingsMode.ExtraArgsMode)
|
MainConst.SettingsMode.ExtraArgsMode => MainConst.FunctionButtonExtraArgsContent,
|
||||||
return MainConst.FunctionButtonExtraArgsContent;
|
_ => throw new UnreachableException()
|
||||||
|
};
|
||||||
throw new UnreachableException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -13,14 +13,8 @@ internal class MainStartCealButtonIsEnabledConv : IMultiValueConverter
|
|||||||
string? browserPath = values[0] as string;
|
string? browserPath = values[0] as string;
|
||||||
string? extraArgs = values[1] as string;
|
string? extraArgs = values[1] as string;
|
||||||
|
|
||||||
if (File.Exists(browserPath) && Path.GetFileName(browserPath).ToLower().EndsWith(".exe") && (MainConst.ExtraArgsRegex().IsMatch(extraArgs!) || extraArgs == MainConst.ExtraArgsPlaceHolder))
|
return File.Exists(browserPath) && Path.GetFileName(browserPath).ToLower().EndsWith(".exe") && (MainConst.ExtraArgsRegex().IsMatch(extraArgs!) || extraArgs == MainConst.ExtraArgsPlaceHolder);
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using Sheas_Cealer.Consts;
|
using Sheas_Cealer.Consts;
|
||||||
@ -12,18 +11,14 @@ internal class MainSwitchModeButtonContentConv : IValueConverter
|
|||||||
{
|
{
|
||||||
MainConst.SettingsMode? mode = value as MainConst.SettingsMode?;
|
MainConst.SettingsMode? mode = value as MainConst.SettingsMode?;
|
||||||
|
|
||||||
if (mode == MainConst.SettingsMode.BrowserPathMode)
|
return mode switch
|
||||||
return MainConst.SwitchModeButtonBrowserPathContent;
|
{
|
||||||
else if (mode == MainConst.SettingsMode.UpstreamUrlMode)
|
MainConst.SettingsMode.BrowserPathMode => MainConst.SwitchModeButtonBrowserPathContent,
|
||||||
return MainConst.SwitchModeButtonUpstreamUrlContent;
|
MainConst.SettingsMode.UpstreamUrlMode => MainConst.SwitchModeButtonUpstreamUrlContent,
|
||||||
else if (mode == MainConst.SettingsMode.ExtraArgsMode)
|
MainConst.SettingsMode.ExtraArgsMode => MainConst.SwitchModeButtonExtraArgsContent,
|
||||||
return MainConst.SwitchModeButtonExtraArgsContent;
|
_ => throw new NotImplementedException()
|
||||||
|
};
|
||||||
throw new UnreachableException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -11,14 +11,8 @@ internal class MainUpdateHostButtonIsEnabledConv : IValueConverter
|
|||||||
{
|
{
|
||||||
string? upstreamUrl = value as string;
|
string? upstreamUrl = value as string;
|
||||||
|
|
||||||
if (MainConst.UpstreamUrlRegex().IsMatch(upstreamUrl!))
|
return MainConst.UpstreamUrlRegex().IsMatch(upstreamUrl!);
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -32,7 +32,7 @@ internal partial class MainPres : ObservableObject
|
|||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string browserPath;
|
private string browserPath;
|
||||||
private partial void OnBrowserPathChanged(string value)
|
partial void OnBrowserPathChanged(string value)
|
||||||
{
|
{
|
||||||
if (File.Exists(value) && Path.GetFileName(value).ToLower().EndsWith(".exe"))
|
if (File.Exists(value) && Path.GetFileName(value).ToLower().EndsWith(".exe"))
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ internal partial class MainPres : ObservableObject
|
|||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string upstreamUrl;
|
private string upstreamUrl;
|
||||||
private partial void OnUpstreamUrlChanged(string value)
|
partial void OnUpstreamUrlChanged(string value)
|
||||||
{
|
{
|
||||||
if (MainConst.UpstreamUrlRegex().IsMatch(value))
|
if (MainConst.UpstreamUrlRegex().IsMatch(value))
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ internal partial class MainPres : ObservableObject
|
|||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string extraArgs;
|
private string extraArgs;
|
||||||
private partial void OnExtraArgsChanged(string value)
|
partial void OnExtraArgsChanged(string value)
|
||||||
{
|
{
|
||||||
if (MainConst.ExtraArgsRegex().IsMatch(value))
|
if (MainConst.ExtraArgsRegex().IsMatch(value))
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,6 @@
|
|||||||
</MultiBinding.Converter>
|
</MultiBinding.Converter>
|
||||||
|
|
||||||
<Binding Path="Mode" />
|
<Binding Path="Mode" />
|
||||||
<Binding Path="IsFocused" RelativeSource="{RelativeSource Self}" />
|
|
||||||
<Binding Path="BrowserPath" />
|
<Binding Path="BrowserPath" />
|
||||||
<Binding Path="UpstreamUrl" />
|
<Binding Path="UpstreamUrl" />
|
||||||
<Binding Path="ExtraArgs" />
|
<Binding Path="ExtraArgs" />
|
||||||
|
@ -37,11 +37,7 @@ public partial class MainWin : Window
|
|||||||
|
|
||||||
private void MainWin_DragEnter(object sender, DragEventArgs e)
|
private void MainWin_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
e.Effects = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Link : DragDropEffects.None;
|
||||||
e.Effects = DragDropEffects.Link;
|
|
||||||
else
|
|
||||||
e.Effects = DragDropEffects.None;
|
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
private void MainWin_Drop(object sender, DragEventArgs e)
|
private void MainWin_Drop(object sender, DragEventArgs e)
|
||||||
@ -82,12 +78,13 @@ public partial class MainWin : Window
|
|||||||
}
|
}
|
||||||
private void SwitchModeButton_Click(object sender, RoutedEventArgs e)
|
private void SwitchModeButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (MainPres!.Mode == MainConst.SettingsMode.BrowserPathMode)
|
MainPres!.Mode = MainPres!.Mode switch
|
||||||
MainPres!.Mode = MainConst.SettingsMode.UpstreamUrlMode;
|
{
|
||||||
else if (MainPres!.Mode == MainConst.SettingsMode.UpstreamUrlMode)
|
MainConst.SettingsMode.BrowserPathMode => MainConst.SettingsMode.UpstreamUrlMode,
|
||||||
MainPres!.Mode = MainConst.SettingsMode.ExtraArgsMode;
|
MainConst.SettingsMode.UpstreamUrlMode => MainConst.SettingsMode.ExtraArgsMode,
|
||||||
else if (MainPres!.Mode == MainConst.SettingsMode.ExtraArgsMode)
|
MainConst.SettingsMode.ExtraArgsMode => MainConst.SettingsMode.BrowserPathMode,
|
||||||
MainPres!.Mode = MainConst.SettingsMode.BrowserPathMode;
|
_ => throw new UnreachableException()
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartCealButton_Click(object sender, RoutedEventArgs e)
|
private void StartCealButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user