diff --git a/WeeXnes/Core/Global.cs b/WeeXnes/Core/Global.cs index 7223cee..8f81df4 100644 --- a/WeeXnes/Core/Global.cs +++ b/WeeXnes/Core/Global.cs @@ -8,7 +8,7 @@ namespace WeeXnes.Core { public class Information { - public const string Version = "4.5.2"; + public const string Version = "4.5.2.1"; public const string EncryptionHash = "8zf5#RdyQ]$4x4_"; public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest"; } diff --git a/WeeXnes/Views/EncryptedTextEditor/TextEditorView.xaml.cs b/WeeXnes/Views/EncryptedTextEditor/TextEditorView.xaml.cs index 517a09e..927347d 100644 --- a/WeeXnes/Views/EncryptedTextEditor/TextEditorView.xaml.cs +++ b/WeeXnes/Views/EncryptedTextEditor/TextEditorView.xaml.cs @@ -17,6 +17,11 @@ public partial class TextEditorView : Page { InitializeComponent(); } + private void RaiseClickEvent(System.Windows.Controls.Button button) + { + var clickEventArgs = new RoutedEventArgs(System.Windows.Controls.Button.ClickEvent); + button.RaiseEvent(clickEventArgs); + } private void Btn_openFile_OnClick(object sender, RoutedEventArgs e) { @@ -44,19 +49,27 @@ public partial class TextEditorView : Page } } } + private void Btn_saveFile_OnClick(object sender, RoutedEventArgs e) { - if(this.currentFilePath == null) - return; + if (this.currentFilePath == null) + { + RaiseClickEvent(btn_saveFileAs); + } + else + { + Console.WriteLine("Saving file " + currentFilePath); + TextRange textRange = new TextRange(rtb_FileEditor.Document.ContentStart, rtb_FileEditor.Document.ContentEnd); + string plainText = textRange.Text; + string[] lines = plainText.Split(new[] { Environment.NewLine }, StringSplitOptions.None); + string[] encryptedContent = + EncryptionLib.EncryptorLibary.encryptArray(Information.EncryptionHash, lines); + File.WriteAllLines(this.currentFilePath, encryptedContent); + } + + - Console.WriteLine("Saving file " + currentFilePath); - TextRange textRange = new TextRange(rtb_FileEditor.Document.ContentStart, rtb_FileEditor.Document.ContentEnd); - string plainText = textRange.Text; - string[] lines = plainText.Split(new[] { Environment.NewLine }, StringSplitOptions.None); - string[] encryptedContent = - EncryptionLib.EncryptorLibary.encryptArray(Information.EncryptionHash, lines); - File.WriteAllLines(this.currentFilePath, encryptedContent); } private void Btn_saveFileAs_OnClick(object sender, RoutedEventArgs e) diff --git a/WeeXnes/WeeXnes.csproj b/WeeXnes/WeeXnes.csproj index d93b215..6b16eae 100644 --- a/WeeXnes/WeeXnes.csproj +++ b/WeeXnes/WeeXnes.csproj @@ -4,7 +4,7 @@ Debug AnyCPU - 4.5.2 + 4.5.2.1 {4B33CEE7-C74D-43B9-B99A-8B273D5195BC} WinExe WeeXnes