Fully added File Editor
This commit is contained in:
parent
5cb3c52ba7
commit
55c753dead
5 changed files with 21 additions and 10 deletions
|
@ -8,7 +8,7 @@ namespace WeeXnes.Core
|
||||||
{
|
{
|
||||||
public class Information
|
public class Information
|
||||||
{
|
{
|
||||||
public const string Version = "4.5.1.7";
|
public const string Version = "4.5.2";
|
||||||
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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
xmlns:profile="clr-namespace:WeeXnes.Views.ProfileView"
|
xmlns:profile="clr-namespace:WeeXnes.Views.ProfileView"
|
||||||
xmlns:EncryptedTextEditor="clr-namespace:WeeXnes.Views.EncryptedTextEditor"
|
xmlns:EncryptedTextEditor="clr-namespace:WeeXnes.Views.EncryptedTextEditor"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Height="400"
|
Height="540"
|
||||||
Width="500"
|
Width="500"
|
||||||
Title="WeeXnes"
|
Title="WeeXnes"
|
||||||
Background="{DynamicResource ApplicationBackgroundBrush}"
|
Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||||
|
@ -92,8 +92,7 @@
|
||||||
Name="ButtonPwGen"
|
Name="ButtonPwGen"
|
||||||
PageTag="Gen"
|
PageTag="Gen"
|
||||||
PageType="{x:Type passwordGenerator:PasswordGenView}"/>
|
PageType="{x:Type passwordGenerator:PasswordGenView}"/>
|
||||||
<ui:NavigationItem
|
<ui:NavigationItem
|
||||||
Visibility="Collapsed"
|
|
||||||
Content="Editor"
|
Content="Editor"
|
||||||
Icon="DocumentOnePage24"
|
Icon="DocumentOnePage24"
|
||||||
Name="ButtonEncryptedFileEditor"
|
Name="ButtonEncryptedFileEditor"
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace WeeXnes
|
||||||
{
|
{
|
||||||
if(!App.DebugMode)
|
if(!App.DebugMode)
|
||||||
return;
|
return;
|
||||||
ButtonEncryptedFileEditor.Visibility = Visibility.Visible;
|
//Code to be enabled in Debug mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,16 @@ public partial class TextEditorView : Page
|
||||||
var fileContent = string.Empty;
|
var fileContent = string.Empty;
|
||||||
var filePath = string.Empty;
|
var filePath = string.Empty;
|
||||||
|
|
||||||
|
Console.WriteLine("Calling OpenFileDialog");
|
||||||
using (OpenFileDialog openFileDialog = new OpenFileDialog())
|
using (OpenFileDialog openFileDialog = new OpenFileDialog())
|
||||||
{
|
{
|
||||||
openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
//openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
openFileDialog.Filter = "WXN Text Files (*.wtf)|*.wtf";
|
openFileDialog.Filter = "WXN Text Files (*.wtf)|*.wtf";
|
||||||
openFileDialog.RestoreDirectory = true;
|
openFileDialog.RestoreDirectory = true;
|
||||||
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Opening file " + openFileDialog.FileName);
|
||||||
this.currentFilePath = openFileDialog.FileName;
|
this.currentFilePath = openFileDialog.FileName;
|
||||||
string[] FileContent = File.ReadAllLines(openFileDialog.FileName);
|
string[] FileContent = File.ReadAllLines(openFileDialog.FileName);
|
||||||
string[] decryptedContent = EncryptorLibary.decryptArray(Information.EncryptionHash, FileContent);
|
string[] decryptedContent = EncryptorLibary.decryptArray(Information.EncryptionHash, FileContent);
|
||||||
|
@ -47,19 +49,29 @@ public partial class TextEditorView : Page
|
||||||
{
|
{
|
||||||
if(this.currentFilePath == null)
|
if(this.currentFilePath == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Calling SaveFileDialog");
|
||||||
using (SaveFileDialog saveFileDialog = new SaveFileDialog())
|
using (SaveFileDialog saveFileDialog = new SaveFileDialog())
|
||||||
{
|
{
|
||||||
this.currentFilePath = saveFileDialog.FileName;
|
//saveFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
saveFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
|
||||||
saveFileDialog.Filter = "WXN Text Files (*.wtf)|*.wtf";
|
saveFileDialog.Filter = "WXN Text Files (*.wtf)|*.wtf";
|
||||||
saveFileDialog.RestoreDirectory = true ;
|
saveFileDialog.RestoreDirectory = true;
|
||||||
|
|
||||||
if(saveFileDialog.ShowDialog() == DialogResult.OK)
|
if(saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Saving file " + saveFileDialog.FileName);
|
||||||
|
this.currentFilePath = saveFileDialog.FileName;
|
||||||
TextRange textRange = new TextRange(rtb_FileEditor.Document.ContentStart, rtb_FileEditor.Document.ContentEnd);
|
TextRange textRange = new TextRange(rtb_FileEditor.Document.ContentStart, rtb_FileEditor.Document.ContentEnd);
|
||||||
string plainText = textRange.Text;
|
string plainText = textRange.Text;
|
||||||
string[] lines = plainText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
string[] lines = plainText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
||||||
|
|
|
@ -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.1.7</Version>
|
<Version>4.5.2</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