Add files via upload

This commit is contained in:
Belim 2020-09-19 17:30:33 +02:00 committed by GitHub
parent 001e0fecf2
commit 3c1976330a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 69 deletions

View file

@ -17,27 +17,6 @@ namespace Privatezilla
{ {
public partial class MainWindow : Form public partial class MainWindow : Form
{ {
private readonly string _successApply = Properties.Resources.statusSuccessApply;
private readonly string _failedApply = Properties.Resources.statusFailedApply;
private readonly string _successConfigure = Properties.Resources.statusSuccessConfigure;
private readonly string _failedConfigure = Properties.Resources.statusFailedConfigure;
private readonly string _finishApply = Properties.Resources.statusFinishApply;
private readonly string _finishUndo = Properties.Resources.statusFinishUndo;
private readonly string _finishAnalyze = Properties.Resources.statusFinishAnalyze;
private readonly string _doWait = Properties.Resources.statusDoWait;
private readonly string _undoSettings = Properties.Resources.statusUndoSettings;
private readonly string _helpApp = Properties.Resources.helpApp.Replace("\\r\\n", "\r\n");
// Script strings (optional)
private readonly string _psSelect = Properties.Resources.msgPSSelect;
private readonly string _psInfo = Properties.Resources.PSInfo.Replace("\\r\\n", "\r\n");
private readonly string _psSuccess = Properties.Resources.msgPSSuccess;
private readonly string _psSave = Properties.Resources.msgPSSave;
private readonly string _infoApp = "Privatezilla" + "\nVersion " + Program.GetCurrentVersionTostring() + " (Phoenix)\r\n" +
Properties.Resources.infoApp.Replace("\\t", "\t");
// Setting progress // Setting progress
private int _progress = 0; private int _progress = 0;
@ -47,9 +26,6 @@ namespace Privatezilla
// Update // Update
private readonly string _releaseURL = "https://raw.githubusercontent.com/builtbybel/privatezilla/master/latest.txt"; private readonly string _releaseURL = "https://raw.githubusercontent.com/builtbybel/privatezilla/master/latest.txt";
private readonly string _releaseUpToDate = Properties.Resources.releaseUpToDate;
private readonly string _releaseUnofficial = Properties.Resources.releaseUnofficial;
public Version CurrentVersion = new Version(Application.ProductVersion); public Version CurrentVersion = new Version(Application.ProductVersion);
public Version LatestVersion; public Version LatestVersion;
@ -79,11 +55,11 @@ namespace Privatezilla
if (equals == 0) if (equals == 0)
{ {
MessageBox.Show(_releaseUpToDate, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); // Up-to-date MessageBox.Show(Properties.Resources.releaseUpToDate, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); // Up-to-date
} }
else if (equals < 0) else if (equals < 0)
{ {
MessageBox.Show(_releaseUnofficial, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); // Unofficial MessageBox.Show(Properties.Resources.releaseUnofficial, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); // Unofficial
} }
else // New release available! else // New release available!
{ {
@ -119,6 +95,7 @@ namespace Privatezilla
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
// Initilize settings // Initilize settings
@ -132,6 +109,8 @@ namespace Privatezilla
// GUI localization // GUI localization
Globalization(); Globalization();
} }
public void InitializeSettings() public void InitializeSettings()
@ -357,7 +336,7 @@ namespace Privatezilla
private async void BtnSettingsAnalyze_Click(object sender, EventArgs e) private async void BtnSettingsAnalyze_Click(object sender, EventArgs e)
{ {
Reset(); Reset();
LblStatus.Text = _doWait; LblStatus.Text = Properties.Resources.statusDoWait;
BtnSettingsAnalyze.Enabled = false; BtnSettingsAnalyze.Enabled = false;
LvwStatus.BeginUpdate(); LvwStatus.BeginUpdate();
@ -374,12 +353,12 @@ namespace Privatezilla
if (shouldPerform) if (shouldPerform)
{ {
state.SubItems.Add(_failedConfigure); state.SubItems.Add(Properties.Resources.statusFailedConfigure);
state.BackColor = Color.LavenderBlush; state.BackColor = Color.LavenderBlush;
} }
else else
{ {
state.SubItems.Add(_successConfigure); state.SubItems.Add(Properties.Resources.statusSuccessConfigure);
state.BackColor = Color.Honeydew; state.BackColor = Color.Honeydew;
} }
@ -391,7 +370,7 @@ namespace Privatezilla
DoProgress(100); DoProgress(100);
// Summary // Summary
LblStatus.Text = _finishAnalyze; LblStatus.Text = Properties.Resources.statusFinishAnalyze;
BtnSettingsAnalyze.Enabled = true; BtnSettingsAnalyze.Enabled = true;
LvwStatus.EndUpdate(); LvwStatus.EndUpdate();
@ -410,7 +389,7 @@ namespace Privatezilla
foreach (SettingNode node in treeNodes) foreach (SettingNode node in treeNodes)
{ {
// Add status info // Add status info
LblStatus.Text = _doWait + " (" + node.Text + ")"; LblStatus.Text = Properties.Resources.statusDoWait + " (" + node.Text + ")";
var setting = node.Setting; var setting = node.Setting;
ConfiguredTaskAwaitable<bool> performTask = Task<bool>.Factory.StartNew(() => setting.DoSetting()).ConfigureAwait(true); ConfiguredTaskAwaitable<bool> performTask = Task<bool>.Factory.StartNew(() => setting.DoSetting()).ConfigureAwait(true);
@ -420,12 +399,12 @@ namespace Privatezilla
var listItem = new ListViewItem(setting.ID()); var listItem = new ListViewItem(setting.ID());
if (result) if (result)
{ {
listItem.SubItems.Add(_successApply); listItem.SubItems.Add(Properties.Resources.statusSuccessApply);
listItem.BackColor = Color.Honeydew; listItem.BackColor = Color.Honeydew;
} }
else else
{ {
listItem.SubItems.Add(_failedApply); listItem.SubItems.Add(Properties.Resources.statusFailedApply);
listItem.BackColor = Color.LavenderBlush; listItem.BackColor = Color.LavenderBlush;
} }
@ -435,7 +414,7 @@ namespace Privatezilla
DoProgress(100); DoProgress(100);
LblStatus.Text = _finishApply; LblStatus.Text = Properties.Resources.statusFinishApply;
BtnSettingsDo.Enabled = true; BtnSettingsDo.Enabled = true;
LvwStatus.EndUpdate(); LvwStatus.EndUpdate();
@ -447,7 +426,7 @@ namespace Privatezilla
/// </summary> /// </summary>
private async void UndoSettings(List<SettingNode> treeNodes) private async void UndoSettings(List<SettingNode> treeNodes)
{ {
LblStatus.Text = _doWait; LblStatus.Text = Properties.Resources.statusDoWait;
BtnSettingsUndo.Enabled = false; BtnSettingsUndo.Enabled = false;
LvwStatus.BeginUpdate(); LvwStatus.BeginUpdate();
@ -461,12 +440,12 @@ namespace Privatezilla
var listItem = new ListViewItem(setting.ID()); var listItem = new ListViewItem(setting.ID());
if (result) if (result)
{ {
listItem.SubItems.Add(_successApply); listItem.SubItems.Add(Properties.Resources.statusSuccessApply);
listItem.BackColor = Color.Honeydew; listItem.BackColor = Color.Honeydew;
} }
else else
{ {
listItem.SubItems.Add(_failedApply); listItem.SubItems.Add(Properties.Resources.statusFailedApply);
listItem.BackColor = Color.LavenderBlush; listItem.BackColor = Color.LavenderBlush;
} }
@ -476,7 +455,7 @@ namespace Privatezilla
DoProgress(100); DoProgress(100);
LblStatus.Text = _finishUndo; LblStatus.Text = Properties.Resources.statusFinishUndo;
BtnSettingsUndo.Enabled = true; BtnSettingsUndo.Enabled = true;
LvwStatus.EndUpdate(); LvwStatus.EndUpdate();
@ -493,7 +472,7 @@ namespace Privatezilla
private void BtnSettingsUndo_Click(object sender, EventArgs e) private void BtnSettingsUndo_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show(_undoSettings, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes) if (MessageBox.Show(Properties.Resources.statusUndoSettings, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{ {
Reset(); Reset();
@ -504,7 +483,8 @@ namespace Privatezilla
private void Info_Click(object sender, EventArgs e) private void Info_Click(object sender, EventArgs e)
{ {
MessageBox.Show(_infoApp, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Privatezilla" + "\nVersion " + Program.GetCurrentVersionTostring() + " (Phoenix)\r\n" +
Properties.Resources.infoApp.Replace("\\t", "\t"), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
private void LblMainMenu_Click(object sender, EventArgs e) private void LblMainMenu_Click(object sender, EventArgs e)
@ -514,7 +494,7 @@ namespace Privatezilla
private void Help_Click(object sender, EventArgs e) private void Help_Click(object sender, EventArgs e)
{ {
MessageBox.Show(_helpApp, Help.Text, MessageBoxButtons.OK, MessageBoxIcon.Question); MessageBox.Show(Properties.Resources.helpApp.Replace("\\r\\n", "\r\n"), Help.Text, MessageBoxButtons.OK, MessageBoxIcon.Question);
} }
/// <summary> /// <summary>
@ -596,7 +576,7 @@ namespace Privatezilla
TxtConsolePS.Text = content.ToString(); TxtConsolePS.Text = content.ToString();
// View Info // View Info
TxtPSInfo.Text = _psInfo + string.Join(Environment.NewLine, System.IO.File.ReadAllLines(psdir).Where(s => s.StartsWith("###")).Select(s => s.Substring(3).Replace("###", "\r\n\n"))); TxtPSInfo.Text = Properties.Resources.PSInfo.Replace("\\r\\n", "\r\n") + string.Join(Environment.NewLine, System.IO.File.ReadAllLines(psdir).Where(s => s.StartsWith("###")).Select(s => s.Substring(3).Replace("###", "\r\n\n")));
} }
} }
catch { } catch { }
@ -609,7 +589,7 @@ namespace Privatezilla
{ {
if (LstPS.CheckedItems.Count == 0) if (LstPS.CheckedItems.Count == 0)
{ {
MessageBox.Show(_psSelect, BtnDoPS.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(Properties.Resources.msgPSSelect, BtnDoPS.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
for (int i = 0; i < LstPS.Items.Count; i++) for (int i = 0; i < LstPS.Items.Count; i++)
@ -637,7 +617,7 @@ namespace Privatezilla
} }
// Done! // Done!
MessageBox.Show("Script " + "\"" + LstPS.Text + "\" " + _psSuccess, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Script " + "\"" + LstPS.Text + "\" " + Properties.Resources.msgPSSuccess, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
} }
} }
@ -702,7 +682,7 @@ namespace Privatezilla
{ {
if (ChkCodePS.Checked == false) if (ChkCodePS.Checked == false)
{ {
MessageBox.Show(_psSave, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(Properties.Resources.msgPSSave, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
else else
{ {

View file

@ -162,6 +162,7 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<EmbeddedResource Include="Properties\Resources.zh-CN.resx" />
<None Include="app.manifest" /> <None Include="app.manifest" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>

View file

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben: // indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.40.0")] [assembly: AssemblyVersion("0.40.1")]
[assembly: AssemblyFileVersion("0.40.0")] [assembly: AssemblyFileVersion("0.40.1")]

View file

@ -1471,7 +1471,7 @@ namespace Privatezilla.Properties {
} }
/// <summary> /// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Do you really want to revert all selected settings to Windows 10 default state?&quot; ähnelt. /// Sucht eine lokalisierte Zeichenfolge, die Do you really want to revert all selected settings to Windows 10 default state? ähnelt.
/// </summary> /// </summary>
internal static string statusUndoSettings { internal static string statusUndoSettings {
get { get {

View file

@ -718,7 +718,7 @@ You can also follow me on
<value>Configured</value> <value>Configured</value>
</data> </data>
<data name="statusUndoSettings" xml:space="preserve"> <data name="statusUndoSettings" xml:space="preserve">
<value>Do you really want to revert all selected settings to Windows 10 default state?"</value> <value>Do you really want to revert all selected settings to Windows 10 default state?</value>
</data> </data>
<data name="TxtPSInfo" xml:space="preserve"> <data name="TxtPSInfo" xml:space="preserve">
<value>Welcome to the Modern Policy Editor, which allows you to apply group policies and custom settings in the form of PowerShell scripts and templates (bundled scripts). <value>Welcome to the Modern Policy Editor, which allows you to apply group policies and custom settings in the form of PowerShell scripts and templates (bundled scripts).

View file

@ -59,46 +59,46 @@
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata"> <xsd:element name="metadata">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0"/> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string"/> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string"/> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string"/> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space"/> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
<xsd:complexType> <xsd:complexType>
<xsd:attribute name="alias" type="xsd:string"/> <xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string"/> <xsd:attribute name="name" type="xsd:string" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="data"> <xsd:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space"/> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/> <xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:choice> </xsd:choice>
@ -591,9 +591,6 @@
<data name="statusDoPSProcessing" xml:space="preserve"> <data name="statusDoPSProcessing" xml:space="preserve">
<value>处理中</value> <value>处理中</value>
</data> </data>
<data name="statusDoSettings" xml:space="preserve">
<value>您真的想要将所有选定的设置还原到 Windows 10 默认状态吗?</value>
</data>
<data name="statusDoWait" xml:space="preserve"> <data name="statusDoWait" xml:space="preserve">
<value>请稍候...</value> <value>请稍候...</value>
</data> </data>
@ -618,6 +615,9 @@
<data name="statusSuccessConfigure" xml:space="preserve"> <data name="statusSuccessConfigure" xml:space="preserve">
<value>已配置</value> <value>已配置</value>
</data> </data>
<data name="statusUndoSettings" xml:space="preserve">
<value>您真的想要将所有选定的设置还原到 Windows 10 默认状态吗?</value>
</data>
<data name="TxtPSInfo" xml:space="preserve"> <data name="TxtPSInfo" xml:space="preserve">
<value>欢迎使用现代政策编辑器,它将允许您以 PowerShell 脚本和模板(捆绑脚本)的形式应用组策略和自定义设置 <value>欢迎使用现代政策编辑器,它将允许您以 PowerShell 脚本和模板(捆绑脚本)的形式应用组策略和自定义设置