Skip to content

Commit

Permalink
1.分离简易压制和高级压制的编码器配置记忆
Browse files Browse the repository at this point in the history
2.默认的自动联网编码器配置改为银弹配置
3.新增重新校验本地文件完整性功能
  • Loading branch information
YohoYang committed Mar 26, 2023
1 parent a9b7987 commit 120a26c
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 11 deletions.
12 changes: 8 additions & 4 deletions VSGUI/API/UpdateApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,10 @@ private static void CheckLocalVersionJson()
{
continue;
}
JsonObject jsonsubdata = new JsonObject();
jsonsubdata.Add("f", CalculateMD5(file));
JsonObject jsonsubdata = new JsonObject
{
{ "f", CalculateMD5(file) }
};
jsondata.Add(file.Replace(Directory.GetCurrentDirectory(), ""), jsonsubdata);
}
JsonApi.SaveJsonToFile(jsondata, MainWindow.binpath + @"\json\version.json");
Expand All @@ -210,8 +212,10 @@ private static void CheckLocalVersionJson()
}
else
{
JsonObject jsonsubdata = new JsonObject();
jsonsubdata.Add("f", localcoremd5);
JsonObject jsonsubdata = new JsonObject
{
{ "f", localcoremd5 }
};
jsondata.Add(@"\VSGUI.exe", jsonsubdata);
}
JsonApi.SaveJsonToFile(jsondata, MainWindow.binpath + @"\json\version.json");
Expand Down
17 changes: 13 additions & 4 deletions VSGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<TextBlock Text="{DynamicResource video}"/>
<TextBlock Text="{DynamicResource encoderprofiles}"/>
</WrapPanel>
<ComboBox x:Name="simplevideoencoderbox" Grid.Column="1" HorizontalAlignment="Stretch"/>
<ComboBox x:Name="simplevideoencoderbox" Grid.Column="1" HorizontalAlignment="Stretch" SelectionChanged="encoderbox_SelectionChanged"/>
<Button Grid.Column="2" Content="{DynamicResource setting}" Margin="4,0,0,0" Click="VideoEncoderButton_Click"/>
</Grid>
<!--音频编码参数-->
Expand All @@ -81,7 +81,7 @@
<TextBlock Text="{DynamicResource audio}"/>
<TextBlock Text="{DynamicResource encoderprofiles}"/>
</WrapPanel>
<ComboBox x:Name="simpleaudioencoderbox" Grid.Column="1" HorizontalAlignment="Stretch"/>
<ComboBox x:Name="simpleaudioencoderbox" Grid.Column="1" HorizontalAlignment="Stretch" SelectionChanged="encoderbox_SelectionChanged"/>
<Button Grid.Column="2" Content="{DynamicResource setting}" Margin="4,0,0,0" Click="AudioEncoderButton_Click"/>
</Grid>
</hc:UniformSpacingPanel>
Expand Down Expand Up @@ -557,8 +557,17 @@
<ComboBox x:Name="LanguageComboBox" Width="250" Margin="23,0,0,0" SelectionChanged="LanguageComboBox_SelectionChanged"/>
</WrapPanel>
<hc:Divider Margin="0"/>
<CheckBox x:Name="AutoUpdate" Content="{DynamicResource autoupdate}" Checked="ConfigCheckBox_Checked" Unchecked="ConfigCheckBox_Checked"></CheckBox>
<TextBlock Text="{DynamicResource autoupdatedesc}" Margin="23,0,0,0" TextWrapping="Wrap"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<CheckBox x:Name="AutoUpdate" Content="{DynamicResource autoupdate}" Checked="ConfigCheckBox_Checked" Unchecked="ConfigCheckBox_Checked"></CheckBox>
<TextBlock Text="{DynamicResource autoupdatedesc}" Margin="23,5,0,0" TextWrapping="Wrap"/>
</StackPanel>
<Button x:Name="ReScanButton" Content="{DynamicResource rescan}" Grid.Column="1" Margin="5,0,0,0" Click="ReScanLocalFile_Click"></Button>
</Grid>
<hc:Divider Margin="0"/>
<Grid>
<Grid.ColumnDefinitions>
Expand Down
34 changes: 31 additions & 3 deletions VSGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class MainWindow
{
public static string binpath = Directory.GetCurrentDirectory() + @"\bin";
private bool forcedStop = false;
private string coreversion = "v0.3.3";
private string coreversion = "v0.3.4";

public MainWindow()
{
Expand Down Expand Up @@ -133,7 +133,7 @@ private void ResumeConfig()
//自动更新编码器
if (IniApi.IniReadValue("UseNetEncoderJsonBox") == "")
{
UseNetEncoderJsonBox.Text = @"https://cloud.sbsub.com/vsgui/defaultencoderprofiles.json";
UseNetEncoderJsonBox.Text = @"https://cloud.sbsub.com/vsgui/sbsubprofiles.json";
}
else
{
Expand Down Expand Up @@ -161,13 +161,18 @@ private void UpdateEncoderProfiles()
simplevideoencoderbox.ItemsSource = EncoderApi.GetEncoderProfiles("video");
audioencoderbox.ItemsSource = EncoderApi.GetEncoderProfiles("audio");
simpleaudioencoderbox.ItemsSource = EncoderApi.GetEncoderProfiles("audio");
string getconfig = IniApi.IniReadValue("videoencoderboxSelectedIndex");
string getconfig;
getconfig = IniApi.IniReadValue("videoencoderboxSelectedIndex");
if (getconfig == "" || getconfig == "-1") getconfig = "0";
videoencoderbox.SelectedIndex = int.Parse(getconfig);
getconfig = IniApi.IniReadValue("simplevideoencoderboxSelectedIndex");
if (getconfig == "" || getconfig == "-1") getconfig = "0";
simplevideoencoderbox.SelectedIndex = int.Parse(getconfig);
getconfig = IniApi.IniReadValue("audioencoderboxSelectedIndex");
if (getconfig == "" || getconfig == "-1") getconfig = "0";
audioencoderbox.SelectedIndex = int.Parse(getconfig);
getconfig = IniApi.IniReadValue("simpleaudioencoderboxSelectedIndex");
if (getconfig == "" || getconfig == "-1") getconfig = "0";
simpleaudioencoderbox.SelectedIndex = int.Parse(getconfig);
});
}
Expand Down Expand Up @@ -427,6 +432,14 @@ private void encoderbox_SelectionChanged(object sender, SelectionChangedEventArg
}
IniApi.IniWriteValue("videoencoderboxSelectedIndex", videoencoderbox.SelectedIndex.ToString());
}
else if (((ComboBox)sender).Name == "simplevideoencoderbox")
{
if (simplevideoinputbox.Text != "")
{
UpdateEncoderSuffix("video", EncoderApi.GetEncoderSuffix("video", simplevideoencoderbox.SelectedIndex));
}
IniApi.IniWriteValue("simplevideoencoderboxSelectedIndex", simplevideoencoderbox.SelectedIndex.ToString());
}
else if (((ComboBox)sender).Name == "audioencoderbox")
{
if (audioinputbox.Text != "")
Expand All @@ -435,6 +448,14 @@ private void encoderbox_SelectionChanged(object sender, SelectionChangedEventArg
}
IniApi.IniWriteValue("audioencoderboxSelectedIndex", audioencoderbox.SelectedIndex.ToString());
}
else if (((ComboBox)sender).Name == "simpleaudioencoderbox")
{
if (simpleaudioinputbox.Text != "")
{
UpdateEncoderSuffix("audio", EncoderApi.GetEncoderSuffix("audio", simpleaudioencoderbox.SelectedIndex));
}
IniApi.IniWriteValue("simpleaudioencoderboxSelectedIndex", simpleaudioencoderbox.SelectedIndex.ToString());
}
}

private void UpdateEncoderSuffix(string type, string suffixstr)
Expand Down Expand Up @@ -1171,6 +1192,13 @@ private void NetEncoderJsonBoxSave_Click(object sender, RoutedEventArgs e)
ReCheckEncoderProfiles();
}

private void ReScanLocalFile_Click(object sender, RoutedEventArgs e)
{
ReScanButton.IsEnabled = false;
CommonApi.TryDeleteFile(binpath + @"\json\version.json");
UpdateApi.UpdateCheck(UpdateProgressCall);
}

private void UpdateProgressCall(string message)
{
Dispatcher.Invoke(() =>
Expand Down
1 change: 1 addition & 0 deletions VSGUI/Properties/Langs/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,6 @@
<system:String x:Key="useSystemEnvironmentWarningVsEditor">You have enabled the system environment feature, but you are still associated with the built-in VsEditor editor. The built-in editors always use the built-in Python and Vapoursynth, it is recommended that you disassociate and install additional editors yourself.</system:String>
<system:String x:Key="cutstrFormatError">Audio Cut Format Error</system:String>
<system:String x:Key="fpsstrFormatError">fps text empty</system:String>
<system:String x:Key="rescan">重新校验软件完整性</system:String>

</ResourceDictionary>
1 change: 1 addition & 0 deletions VSGUI/Properties/Langs/zh-cn.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,6 @@
<system:String x:Key="useSystemEnvironmentWarningVsEditor">您启用了系统环境功能,但您依然关联了内置VsEditor编辑器。内置的编辑器始终使用内置的Python和Vapoursynth,建议您取消关联并自行另外安装编辑器。</system:String>
<system:String x:Key="cutstrFormatError">音频切割格式异常</system:String>
<system:String x:Key="fpsstrFormatError">fps为空</system:String>
<system:String x:Key="rescan">联网校验软件完整性</system:String>

</ResourceDictionary>

0 comments on commit 120a26c

Please sign in to comment.