file editor fix
This commit is contained in:
parent
55c753dead
commit
111c511ac9
3 changed files with 24 additions and 11 deletions
|
@ -8,7 +8,7 @@ namespace WeeXnes.Core
|
||||||
{
|
{
|
||||||
public class Information
|
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 EncryptionHash = "8zf5#RdyQ]$4x4_";
|
||||||
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,11 @@ public partial class TextEditorView : Page
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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)
|
private void Btn_openFile_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -45,18 +50,26 @@ public partial class TextEditorView : Page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Btn_saveFile_OnClick(object sender, RoutedEventArgs e)
|
private void Btn_saveFile_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if(this.currentFilePath == null)
|
if (this.currentFilePath == null)
|
||||||
return;
|
{
|
||||||
|
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)
|
private void Btn_saveFileAs_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<Version>4.5.2</Version>
|
<Version>4.5.2.1</Version>
|
||||||
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
|
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>WeeXnes</RootNamespace>
|
<RootNamespace>WeeXnes</RootNamespace>
|
||||||
|
|
Loading…
Add table
Reference in a new issue