mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-09-14 13:56:56 +08:00
1.1.0 -> 1.1.1 第3次更新
This commit is contained in:
parent
a834b7589e
commit
987a97802b
@ -12,7 +12,7 @@ namespace Sheas_Cealer.Consts
|
|||||||
[GeneratedRegex(@"^\r$")]
|
[GeneratedRegex(@"^\r$")]
|
||||||
internal static partial Regex HostRegex();
|
internal static partial Regex HostRegex();
|
||||||
|
|
||||||
[GeneratedRegex(@"^((((ht|f)tps?):\/\/)?[a-zA-Z0-9](-*[a-zA-Z0-9])*(\.[a-zA-Z0-9](-*[a-zA-Z0-9])*)*(:\d{1,5})?(\/[a-zA-Z0-9.-_\~\!\$\&\'\(\)\*\+\,\;\=\:\@\%]*)*)?$")]
|
[GeneratedRegex(@"^((((ht|f)tps?):\/\/)?[a-zA-Z0-9](-*[a-zA-Z0-9])*(\.[a-zA-Z0-9](-*[a-zA-Z0-9])*)*(:\d{1,5})?(\/[a-zA-Z0-9.\-_\~\!\$\&\'\(\)\*\+\,\;\=\:\@\%]*)*)?$")]
|
||||||
internal static partial Regex UrlRegex();
|
internal static partial Regex UrlRegex();
|
||||||
|
|
||||||
[GeneratedRegex(@"^(--[a-z](-?[a-z])*( --[a-z](-?[a-z])*)*)?$")]
|
[GeneratedRegex(@"^(--[a-z](-?[a-z])*( --[a-z](-?[a-z])*)*)?$")]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using Sheas_Cealer.Consts;
|
using Sheas_Cealer.Consts;
|
||||||
|
|
||||||
@ -18,9 +19,9 @@ namespace Sheas_Cealer.Convs
|
|||||||
|
|
||||||
if (mode == MainConst.Mode.browserPathMode)
|
if (mode == MainConst.Mode.browserPathMode)
|
||||||
{
|
{
|
||||||
if((bool)!isFocused! && string.IsNullOrEmpty(browserPath))
|
if ((bool)!isFocused! && string.IsNullOrEmpty(browserPath))
|
||||||
return MainConst.BrowserPathPlaceHolder;
|
return MainConst.BrowserPathPlaceHolder;
|
||||||
else if((bool)isFocused! && browserPath == MainConst.BrowserPathPlaceHolder)
|
else if ((bool)isFocused! && browserPath == MainConst.BrowserPathPlaceHolder)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
else
|
else
|
||||||
return browserPath!;
|
return browserPath!;
|
||||||
@ -45,7 +46,7 @@ namespace Sheas_Cealer.Convs
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("Invalid mode");
|
throw new UnreachableException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
Convs/MainStartCealButtonIsEnabledConv.cs
Normal file
28
Convs/MainStartCealButtonIsEnabledConv.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using Sheas_Cealer.Consts;
|
||||||
|
|
||||||
|
namespace Sheas_Cealer.Convs
|
||||||
|
{
|
||||||
|
internal class MainStartCealButtonIsEnabledConv : IMultiValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string? browserPath = values[0] as string;
|
||||||
|
string? upstreamUrl = values[1] as string;
|
||||||
|
string? extraArgs = values[2] as string;
|
||||||
|
|
||||||
|
if (File.Exists(browserPath) && Path.GetFileName(browserPath).ToLower().EndsWith(".exe") && MainConst.UrlRegex().IsMatch(upstreamUrl!) && MainConst.ArgsRegex().IsMatch(extraArgs!))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,10 +14,10 @@ namespace Sheas_Cealer.Wins
|
|||||||
|
|
||||||
private void AboutButton_Click(object sender, RoutedEventArgs e)
|
private void AboutButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender == VersionButton)
|
if (sender as Button == VersionButton)
|
||||||
MessageBox.Show("密码: 3wnj");
|
MessageBox.Show("密码: 3wnj");
|
||||||
|
|
||||||
ProcessStartInfo processStartInfo = new(sender == EmailButton ? "mailto:" : string.Empty + (sender as Button)!.ToolTip) { UseShellExecute = true };
|
ProcessStartInfo processStartInfo = new(sender as Button == EmailButton ? "mailto:" : string.Empty + (sender as Button)!.ToolTip) { UseShellExecute = true };
|
||||||
Process.Start(processStartInfo);
|
Process.Start(processStartInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<TextBox utils:FocusExtension.IsFocused="{Binding IsContentBoxFocused}"
|
<TextBox x:Name="ContentText" utils:FocusExtension.IsFocused="{Binding IsContentBoxFocused}"
|
||||||
Grid.Column="0" Margin="5" VerticalContentAlignment="Center"
|
Grid.Column="0" Margin="5" VerticalContentAlignment="Center"
|
||||||
TextChanged="ContentBox_TextChanged" PreviewDragOver="MainWin_DragEnter">
|
TextChanged="ContentBox_TextChanged" PreviewDragOver="MainWin_DragEnter">
|
||||||
<TextBox.Text>
|
<TextBox.Text>
|
||||||
@ -70,7 +70,21 @@
|
|||||||
|
|
||||||
<Button IsDefault="True"
|
<Button IsDefault="True"
|
||||||
Grid.Row="1" Margin="5" Content="{Binding StartCealButtonContent, Source={StaticResource MainConst}}"
|
Grid.Row="1" Margin="5" Content="{Binding StartCealButtonContent, Source={StaticResource MainConst}}"
|
||||||
Click="StartCealButton_Click" />
|
Click="StartCealButton_Click">
|
||||||
|
|
||||||
|
<Button.IsEnabled>
|
||||||
|
<MultiBinding>
|
||||||
|
<MultiBinding.Converter>
|
||||||
|
<convs:MainStartCealButtonIsEnabledConv />
|
||||||
|
</MultiBinding.Converter>
|
||||||
|
|
||||||
|
<Binding Path="BrowserPath" />
|
||||||
|
<Binding Path="UpstreamUrl" />
|
||||||
|
<Binding Path="ExtraArgs" />
|
||||||
|
|
||||||
|
</MultiBinding>
|
||||||
|
</Button.IsEnabled>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Grid Grid.Row="2">
|
<Grid Grid.Row="2">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
@ -61,18 +61,14 @@ namespace Sheas_Cealer.Wins
|
|||||||
{
|
{
|
||||||
TextBox? ContentBox = sender as TextBox;
|
TextBox? ContentBox = sender as TextBox;
|
||||||
|
|
||||||
switch (MainPres!.Mode)
|
if (MainPres!.Mode == MainConst.Mode.browserPathMode)
|
||||||
{
|
MainPres.BrowserPath = ContentBox!.Text;
|
||||||
case MainConst.Mode.browserPathMode:
|
else if (MainPres!.Mode == MainConst.Mode.upstreamUrlMode)
|
||||||
MainPres.BrowserPath = ContentBox!.Text;
|
MainPres.UpstreamUrl = ContentBox!.Text;
|
||||||
return;
|
else if (MainPres!.Mode == MainConst.Mode.extraArgsMode)
|
||||||
case MainConst.Mode.upstreamUrlMode:
|
MainPres.ExtraArgs = ContentBox!.Text;
|
||||||
MainPres.UpstreamUrl = ContentBox!.Text;
|
else
|
||||||
return;
|
throw new UnreachableException();
|
||||||
case MainConst.Mode.extraArgsMode:
|
|
||||||
MainPres.ExtraArgs = ContentBox!.Text;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
private void BrowseButton_Click(object sender, RoutedEventArgs e)
|
private void BrowseButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -123,7 +119,6 @@ namespace Sheas_Cealer.Wins
|
|||||||
private async void UpdateHostButton_Click(object sender, RoutedEventArgs e)
|
private async void UpdateHostButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string hostUrl = MainPres!.UpstreamUrl;
|
string hostUrl = MainPres!.UpstreamUrl;
|
||||||
|
|
||||||
string UpdateHostString = await Http.GetAsync<string>(hostUrl, MainClient);
|
string UpdateHostString = await Http.GetAsync<string>(hostUrl, MainClient);
|
||||||
StreamReader hostLocalStreamReader = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"));
|
StreamReader hostLocalStreamReader = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"));
|
||||||
string hostLocalString = hostLocalStreamReader.ReadToEnd();
|
string hostLocalString = hostLocalStreamReader.ReadToEnd();
|
||||||
|
Loading…
Reference in New Issue
Block a user