mirror of
https://github.com/HistacomUnity/Histacom2-old.git
synced 2025-01-22 09:02:01 -05:00
Some tweaks
This commit is contained in:
parent
579ed261e4
commit
d31cd4fbce
7 changed files with 191 additions and 226 deletions
|
@ -20,6 +20,7 @@
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
|
|
|
@ -207,23 +207,7 @@ public static void CreateWindowsFile(string filepath, string filename, string co
|
||||||
|
|
||||||
public static void UpdateDirectoryInfo(string path, THFileInfo newfile)
|
public static void UpdateDirectoryInfo(string path, THFileInfo newfile)
|
||||||
{
|
{
|
||||||
newfile.DOSName = newfile.Name.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(" ", "");
|
SetDOSName(ref newfile);
|
||||||
if (newfile.DOSName.Contains("."))
|
|
||||||
{
|
|
||||||
string[] dos = newfile.DOSName.Split('.');
|
|
||||||
|
|
||||||
if (dos.Count() > 2)
|
|
||||||
{
|
|
||||||
List<string> dosb = dos.ToList();
|
|
||||||
dosb.RemoveRange(1, dos.Count() - 2);
|
|
||||||
dos = dosb.ToArray();
|
|
||||||
}
|
|
||||||
dos[1] = dos[1].Substring(0, 3);
|
|
||||||
if (dos[0].Length > 8) dos[0] = dos[0].Substring(0, 6) + "~1";
|
|
||||||
|
|
||||||
newfile.DOSName = dos[0] + "." + dos[1];
|
|
||||||
}
|
|
||||||
else if (newfile.DOSName.Length > 8) newfile.DOSName = newfile.DOSName.Substring(0, 6) + "~1";
|
|
||||||
|
|
||||||
if (File.ReadAllText(Path.Combine(path, "_data.info")).Contains(newfile.DOSName)) return;
|
if (File.ReadAllText(Path.Combine(path, "_data.info")).Contains(newfile.DOSName)) return;
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info")));
|
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info")));
|
||||||
|
@ -250,6 +234,85 @@ public static void RemoveFileFromDirectory(string path, string filename)
|
||||||
File.WriteAllText(Path.Combine(path, "_data.info"), toWrite);
|
File.WriteAllText(Path.Combine(path, "_data.info"), toWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RemoveSubDirFromDirectory(string path, string dirname)
|
||||||
|
{
|
||||||
|
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info")));
|
||||||
|
THDirInfo di = fsfi.SubDirs.Find((THDirInfo f) => { return f.Name == dirname; });
|
||||||
|
if (di == null) return;
|
||||||
|
|
||||||
|
// Find the bytesize of the folder
|
||||||
|
|
||||||
|
FileSystemFolderInfo dirfsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info")));
|
||||||
|
|
||||||
|
fsfi.ByteSize -= dirfsfi.ByteSize;
|
||||||
|
CurrentSave.BytesLeft += dirfsfi.ByteSize;
|
||||||
|
|
||||||
|
fsfi.SubDirs.Remove(di);
|
||||||
|
string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented);
|
||||||
|
|
||||||
|
File.WriteAllText(Path.Combine(path, "_data.info"), toWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string SetDOSName(ref THFileInfo file)
|
||||||
|
{
|
||||||
|
file.DOSName = file.Name.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(" ", "");
|
||||||
|
if (file.DOSName.Contains("."))
|
||||||
|
{
|
||||||
|
string[] dos = file.DOSName.Split('.');
|
||||||
|
|
||||||
|
if (dos.Count() > 2)
|
||||||
|
{
|
||||||
|
List<string> dosb = dos.ToList();
|
||||||
|
dosb.RemoveRange(1, dos.Count() - 2);
|
||||||
|
dos = dosb.ToArray();
|
||||||
|
}
|
||||||
|
dos[1] = dos[1].Substring(0, 3);
|
||||||
|
if (dos[0].Length > 8) dos[0] = dos[0].Substring(0, 6) + "~1";
|
||||||
|
|
||||||
|
file.DOSName = dos[0] + "." + dos[1];
|
||||||
|
}
|
||||||
|
else if (file.DOSName.Length > 8) file.DOSName = file.DOSName.Substring(0, 6) + "~1";
|
||||||
|
return file.DOSName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RenameDirectory(string path, string dirname, string newname)
|
||||||
|
{
|
||||||
|
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info")));
|
||||||
|
THDirInfo di = fsfi.SubDirs.Find((THDirInfo f) => { return f.Name == dirname; });
|
||||||
|
if (di == null) return;
|
||||||
|
|
||||||
|
THDirInfo newDi = di;
|
||||||
|
|
||||||
|
newDi.Name = newname;
|
||||||
|
|
||||||
|
THFileInfo tmpfi = new THFileInfo();
|
||||||
|
newDi.DOSName = SetDOSName(ref tmpfi);
|
||||||
|
fsfi.SubDirs.Remove(di);
|
||||||
|
fsfi.SubDirs.Add(newDi);
|
||||||
|
string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented);
|
||||||
|
|
||||||
|
File.WriteAllText(Path.Combine(path, "_data.info"), toWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RenameFile(string path, string filename, string newname)
|
||||||
|
{
|
||||||
|
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info")));
|
||||||
|
THFileInfo fi = fsfi.Files.Find((THFileInfo f) => { return f.Name == filename; });
|
||||||
|
if (fi == null) return;
|
||||||
|
|
||||||
|
THFileInfo newFi = fi;
|
||||||
|
|
||||||
|
newFi.Name = newname;
|
||||||
|
|
||||||
|
THFileInfo tmpfi = new THFileInfo();
|
||||||
|
newFi.DOSName = SetDOSName(ref tmpfi);
|
||||||
|
fsfi.Files.Remove(fi);
|
||||||
|
fsfi.Files.Add(newFi);
|
||||||
|
string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented);
|
||||||
|
|
||||||
|
File.WriteAllText(Path.Combine(path, "_data.info"), toWrite);
|
||||||
|
}
|
||||||
|
|
||||||
public static void UpgradeFileSystem(string newOS)
|
public static void UpgradeFileSystem(string newOS)
|
||||||
{
|
{
|
||||||
if (newOS == "98" || newOS == "2000" || newOS == "ME")
|
if (newOS == "98" || newOS == "2000" || newOS == "ME")
|
||||||
|
@ -278,7 +341,7 @@ public static void UpgradeFileSystem(string newOS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveDirectoryInfo(string parent, string dirname, bool isProtected, string label, bool allowback)
|
public static void SaveDirectoryInfo(string parent, string dirname, bool isProtected, string label, bool allowback, bool updateParent = true)
|
||||||
{
|
{
|
||||||
if (File.Exists(Path.Combine(parent, dirname, "_data.info")) && Path.Combine(parent, dirname) != ProfileFileSystemDirectory) return;
|
if (File.Exists(Path.Combine(parent, dirname, "_data.info")) && Path.Combine(parent, dirname) != ProfileFileSystemDirectory) return;
|
||||||
Directory.CreateDirectory(Path.Combine(parent, dirname));
|
Directory.CreateDirectory(Path.Combine(parent, dirname));
|
||||||
|
@ -296,15 +359,18 @@ public static void SaveDirectoryInfo(string parent, string dirname, bool isProte
|
||||||
info.SubDirs = new List<THDirInfo>(256);
|
info.SubDirs = new List<THDirInfo>(256);
|
||||||
info.ByteSize = 0;
|
info.ByteSize = 0;
|
||||||
|
|
||||||
if (parent != ProfileDirectory)
|
if (updateParent == true)
|
||||||
{
|
{
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(parent, "_data.info")));
|
if ((parent != ProfileDirectory))
|
||||||
THDirInfo thd = new THDirInfo();
|
{
|
||||||
thd.Name = info.Label;
|
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(parent, "_data.info")));
|
||||||
thd.DOSName = info.DOSLabel;
|
THDirInfo thd = new THDirInfo();
|
||||||
fsfi.SubDirs.Add(thd);
|
thd.Name = info.Label;
|
||||||
|
thd.DOSName = info.DOSLabel;
|
||||||
|
fsfi.SubDirs.Add(thd);
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(parent, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented));
|
File.WriteAllText(Path.Combine(parent, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string toWrite = JsonConvert.SerializeObject(info, Formatting.Indented);
|
string toWrite = JsonConvert.SerializeObject(info, Formatting.Indented);
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Histacom2.OS.Win95.Win95Apps
|
||||||
{
|
{
|
||||||
public partial class WinClassicNotepad : UserControl
|
public partial class WinClassicNotepad : UserControl
|
||||||
{
|
{
|
||||||
string CurrentFilePath = "";
|
public string CurrentFilePath = "";
|
||||||
public WinClassicNotepad()
|
public WinClassicNotepad()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
|
@ -30,6 +30,10 @@ private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.program = new System.Windows.Forms.Panel();
|
this.program = new System.Windows.Forms.Panel();
|
||||||
|
this.pnlSave = new System.Windows.Forms.Panel();
|
||||||
|
this.Button1 = new System.Windows.Forms.Button();
|
||||||
|
this.Label1 = new System.Windows.Forms.Label();
|
||||||
|
this.txtSave = new System.Windows.Forms.TextBox();
|
||||||
this.mainView = new System.Windows.Forms.ListView();
|
this.mainView = new System.Windows.Forms.ListView();
|
||||||
this.diskView = new System.Windows.Forms.TreeView();
|
this.diskView = new System.Windows.Forms.TreeView();
|
||||||
this.MenuStrip1 = new System.Windows.Forms.MenuStrip();
|
this.MenuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||||
|
@ -37,7 +41,6 @@ private void InitializeComponent()
|
||||||
this.CreateShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.CreateShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.FolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.FolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.TextDocumentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.TextDocumentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.BitmapImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.DeleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.DeleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.RenameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.RenameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.CloseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.CloseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
@ -55,14 +58,10 @@ private void InitializeComponent()
|
||||||
this.bottomrightcorner = new System.Windows.Forms.Panel();
|
this.bottomrightcorner = new System.Windows.Forms.Panel();
|
||||||
this.bottomleftcorner = new System.Windows.Forms.Panel();
|
this.bottomleftcorner = new System.Windows.Forms.Panel();
|
||||||
this.topleftcorner = new System.Windows.Forms.Panel();
|
this.topleftcorner = new System.Windows.Forms.Panel();
|
||||||
this.pnlSave = new System.Windows.Forms.Panel();
|
|
||||||
this.Button1 = new System.Windows.Forms.Button();
|
|
||||||
this.Label1 = new System.Windows.Forms.Label();
|
|
||||||
this.txtSave = new System.Windows.Forms.TextBox();
|
|
||||||
this.refresh = new System.Windows.Forms.Timer(this.components);
|
this.refresh = new System.Windows.Forms.Timer(this.components);
|
||||||
this.program.SuspendLayout();
|
this.program.SuspendLayout();
|
||||||
this.MenuStrip1.SuspendLayout();
|
|
||||||
this.pnlSave.SuspendLayout();
|
this.pnlSave.SuspendLayout();
|
||||||
|
this.MenuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// program
|
// program
|
||||||
|
@ -82,6 +81,47 @@ private void InitializeComponent()
|
||||||
this.program.Size = new System.Drawing.Size(704, 517);
|
this.program.Size = new System.Drawing.Size(704, 517);
|
||||||
this.program.TabIndex = 13;
|
this.program.TabIndex = 13;
|
||||||
//
|
//
|
||||||
|
// pnlSave
|
||||||
|
//
|
||||||
|
this.pnlSave.Controls.Add(this.Button1);
|
||||||
|
this.pnlSave.Controls.Add(this.Label1);
|
||||||
|
this.pnlSave.Controls.Add(this.txtSave);
|
||||||
|
this.pnlSave.Location = new System.Drawing.Point(3, 474);
|
||||||
|
this.pnlSave.Name = "pnlSave";
|
||||||
|
this.pnlSave.Size = new System.Drawing.Size(850, 35);
|
||||||
|
this.pnlSave.TabIndex = 18;
|
||||||
|
this.pnlSave.Visible = false;
|
||||||
|
//
|
||||||
|
// Button1
|
||||||
|
//
|
||||||
|
this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
this.Button1.Location = new System.Drawing.Point(608, 1);
|
||||||
|
this.Button1.Name = "Button1";
|
||||||
|
this.Button1.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.Button1.TabIndex = 17;
|
||||||
|
this.Button1.Text = "Save";
|
||||||
|
this.Button1.UseVisualStyleBackColor = true;
|
||||||
|
this.Button1.Click += new System.EventHandler(this.Button1_Click);
|
||||||
|
//
|
||||||
|
// Label1
|
||||||
|
//
|
||||||
|
this.Label1.AutoSize = true;
|
||||||
|
this.Label1.Location = new System.Drawing.Point(3, 6);
|
||||||
|
this.Label1.Name = "Label1";
|
||||||
|
this.Label1.Size = new System.Drawing.Size(57, 13);
|
||||||
|
this.Label1.TabIndex = 16;
|
||||||
|
this.Label1.Text = "File Name:";
|
||||||
|
//
|
||||||
|
// txtSave
|
||||||
|
//
|
||||||
|
this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.txtSave.Location = new System.Drawing.Point(60, 3);
|
||||||
|
this.txtSave.Name = "txtSave";
|
||||||
|
this.txtSave.Size = new System.Drawing.Size(542, 20);
|
||||||
|
this.txtSave.TabIndex = 15;
|
||||||
|
//
|
||||||
// mainView
|
// mainView
|
||||||
//
|
//
|
||||||
this.mainView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.mainView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
@ -136,10 +176,9 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
this.CreateShortcutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.CreateShortcutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.FolderToolStripMenuItem,
|
this.FolderToolStripMenuItem,
|
||||||
this.TextDocumentToolStripMenuItem,
|
this.TextDocumentToolStripMenuItem});
|
||||||
this.BitmapImageToolStripMenuItem});
|
|
||||||
this.CreateShortcutToolStripMenuItem.Name = "CreateShortcutToolStripMenuItem";
|
this.CreateShortcutToolStripMenuItem.Name = "CreateShortcutToolStripMenuItem";
|
||||||
this.CreateShortcutToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
this.CreateShortcutToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.CreateShortcutToolStripMenuItem.Text = "New";
|
this.CreateShortcutToolStripMenuItem.Text = "New";
|
||||||
//
|
//
|
||||||
// FolderToolStripMenuItem
|
// FolderToolStripMenuItem
|
||||||
|
@ -149,12 +188,6 @@ private void InitializeComponent()
|
||||||
this.FolderToolStripMenuItem.Text = "Folder";
|
this.FolderToolStripMenuItem.Text = "Folder";
|
||||||
this.FolderToolStripMenuItem.Click += new System.EventHandler(this.FolderToolStripMenuItem_Click);
|
this.FolderToolStripMenuItem.Click += new System.EventHandler(this.FolderToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// ShortcutToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.ShortcutToolStripMenuItem.Name = "ShortcutToolStripMenuItem";
|
|
||||||
this.ShortcutToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
|
||||||
this.ShortcutToolStripMenuItem.Text = "Shortcut";
|
|
||||||
//
|
|
||||||
// TextDocumentToolStripMenuItem
|
// TextDocumentToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.TextDocumentToolStripMenuItem.Name = "TextDocumentToolStripMenuItem";
|
this.TextDocumentToolStripMenuItem.Name = "TextDocumentToolStripMenuItem";
|
||||||
|
@ -162,30 +195,24 @@ private void InitializeComponent()
|
||||||
this.TextDocumentToolStripMenuItem.Text = "Text Document";
|
this.TextDocumentToolStripMenuItem.Text = "Text Document";
|
||||||
this.TextDocumentToolStripMenuItem.Click += new System.EventHandler(this.TextDocumentToolStripMenuItem_Click);
|
this.TextDocumentToolStripMenuItem.Click += new System.EventHandler(this.TextDocumentToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// BitmapImageToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.BitmapImageToolStripMenuItem.Name = "BitmapImageToolStripMenuItem";
|
|
||||||
this.BitmapImageToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
|
||||||
this.BitmapImageToolStripMenuItem.Text = "Bitmap Image";
|
|
||||||
//
|
|
||||||
// DeleteToolStripMenuItem
|
// DeleteToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.DeleteToolStripMenuItem.Name = "DeleteToolStripMenuItem";
|
this.DeleteToolStripMenuItem.Name = "DeleteToolStripMenuItem";
|
||||||
this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.DeleteToolStripMenuItem.Text = "Delete";
|
this.DeleteToolStripMenuItem.Text = "Delete";
|
||||||
this.DeleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click);
|
this.DeleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// RenameToolStripMenuItem
|
// RenameToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.RenameToolStripMenuItem.Name = "RenameToolStripMenuItem";
|
this.RenameToolStripMenuItem.Name = "RenameToolStripMenuItem";
|
||||||
this.RenameToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
this.RenameToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.RenameToolStripMenuItem.Text = "Rename";
|
this.RenameToolStripMenuItem.Text = "Rename";
|
||||||
this.RenameToolStripMenuItem.Click += new System.EventHandler(this.RenameToolStripMenuItem_Click);
|
this.RenameToolStripMenuItem.Click += new System.EventHandler(this.RenameToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// CloseToolStripMenuItem
|
// CloseToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.CloseToolStripMenuItem.Name = "CloseToolStripMenuItem";
|
this.CloseToolStripMenuItem.Name = "CloseToolStripMenuItem";
|
||||||
this.CloseToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
this.CloseToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||||
this.CloseToolStripMenuItem.Text = "Close";
|
this.CloseToolStripMenuItem.Text = "Close";
|
||||||
this.CloseToolStripMenuItem.Click += new System.EventHandler(this.CloseToolStripMenuItem_Click);
|
this.CloseToolStripMenuItem.Click += new System.EventHandler(this.CloseToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -297,47 +324,6 @@ private void InitializeComponent()
|
||||||
this.topleftcorner.Size = new System.Drawing.Size(4, 4);
|
this.topleftcorner.Size = new System.Drawing.Size(4, 4);
|
||||||
this.topleftcorner.TabIndex = 1;
|
this.topleftcorner.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// pnlSave
|
|
||||||
//
|
|
||||||
this.pnlSave.Controls.Add(this.Button1);
|
|
||||||
this.pnlSave.Controls.Add(this.Label1);
|
|
||||||
this.pnlSave.Controls.Add(this.txtSave);
|
|
||||||
this.pnlSave.Location = new System.Drawing.Point(3, 474);
|
|
||||||
this.pnlSave.Name = "pnlSave";
|
|
||||||
this.pnlSave.Size = new System.Drawing.Size(850, 35);
|
|
||||||
this.pnlSave.TabIndex = 18;
|
|
||||||
this.pnlSave.Visible = false;
|
|
||||||
//
|
|
||||||
// Button1
|
|
||||||
//
|
|
||||||
this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
||||||
this.Button1.Location = new System.Drawing.Point(608, 1);
|
|
||||||
this.Button1.Name = "Button1";
|
|
||||||
this.Button1.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.Button1.TabIndex = 17;
|
|
||||||
this.Button1.Text = "Save";
|
|
||||||
this.Button1.UseVisualStyleBackColor = true;
|
|
||||||
this.Button1.Click += new System.EventHandler(this.Button1_Click);
|
|
||||||
//
|
|
||||||
// Label1
|
|
||||||
//
|
|
||||||
this.Label1.AutoSize = true;
|
|
||||||
this.Label1.Location = new System.Drawing.Point(3, 6);
|
|
||||||
this.Label1.Name = "Label1";
|
|
||||||
this.Label1.Size = new System.Drawing.Size(57, 13);
|
|
||||||
this.Label1.TabIndex = 16;
|
|
||||||
this.Label1.Text = "File Name:";
|
|
||||||
//
|
|
||||||
// txtSave
|
|
||||||
//
|
|
||||||
this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.txtSave.Location = new System.Drawing.Point(60, 3);
|
|
||||||
this.txtSave.Name = "txtSave";
|
|
||||||
this.txtSave.Size = new System.Drawing.Size(542, 20);
|
|
||||||
this.txtSave.TabIndex = 15;
|
|
||||||
//
|
|
||||||
// refresh
|
// refresh
|
||||||
//
|
//
|
||||||
this.refresh.Interval = 15000;
|
this.refresh.Interval = 15000;
|
||||||
|
@ -353,10 +339,10 @@ private void InitializeComponent()
|
||||||
this.Load += new System.EventHandler(this.WinClassicWindowsExplorer_Load);
|
this.Load += new System.EventHandler(this.WinClassicWindowsExplorer_Load);
|
||||||
this.program.ResumeLayout(false);
|
this.program.ResumeLayout(false);
|
||||||
this.program.PerformLayout();
|
this.program.PerformLayout();
|
||||||
this.MenuStrip1.ResumeLayout(false);
|
|
||||||
this.MenuStrip1.PerformLayout();
|
|
||||||
this.pnlSave.ResumeLayout(false);
|
this.pnlSave.ResumeLayout(false);
|
||||||
this.pnlSave.PerformLayout();
|
this.pnlSave.PerformLayout();
|
||||||
|
this.MenuStrip1.ResumeLayout(false);
|
||||||
|
this.MenuStrip1.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -370,7 +356,6 @@ private void InitializeComponent()
|
||||||
internal System.Windows.Forms.ToolStripMenuItem CreateShortcutToolStripMenuItem;
|
internal System.Windows.Forms.ToolStripMenuItem CreateShortcutToolStripMenuItem;
|
||||||
internal System.Windows.Forms.ToolStripMenuItem FolderToolStripMenuItem;
|
internal System.Windows.Forms.ToolStripMenuItem FolderToolStripMenuItem;
|
||||||
internal System.Windows.Forms.ToolStripMenuItem TextDocumentToolStripMenuItem;
|
internal System.Windows.Forms.ToolStripMenuItem TextDocumentToolStripMenuItem;
|
||||||
internal System.Windows.Forms.ToolStripMenuItem BitmapImageToolStripMenuItem;
|
|
||||||
internal System.Windows.Forms.ToolStripMenuItem DeleteToolStripMenuItem;
|
internal System.Windows.Forms.ToolStripMenuItem DeleteToolStripMenuItem;
|
||||||
internal System.Windows.Forms.ToolStripMenuItem RenameToolStripMenuItem;
|
internal System.Windows.Forms.ToolStripMenuItem RenameToolStripMenuItem;
|
||||||
internal System.Windows.Forms.ToolStripMenuItem CloseToolStripMenuItem;
|
internal System.Windows.Forms.ToolStripMenuItem CloseToolStripMenuItem;
|
||||||
|
|
|
@ -222,6 +222,7 @@ public void OpenFile(string fileDir)
|
||||||
case 1:
|
case 1:
|
||||||
WinClassicNotepad np = new WinClassicNotepad();
|
WinClassicNotepad np = new WinClassicNotepad();
|
||||||
np.mainText.Text = FileDialogBoxManager.ReadTextFile(fileDir);
|
np.mainText.Text = FileDialogBoxManager.ReadTextFile(fileDir);
|
||||||
|
np.CurrentFilePath = fileDir;
|
||||||
WinClassic app = wm.StartWin95(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true);
|
WinClassic app = wm.StartWin95(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true);
|
||||||
|
|
||||||
Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad);
|
Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad);
|
||||||
|
@ -229,6 +230,7 @@ public void OpenFile(string fileDir)
|
||||||
case 2:
|
case 2:
|
||||||
WinClassicWordPad wp = new WinClassicWordPad();
|
WinClassicWordPad wp = new WinClassicWordPad();
|
||||||
wp.mainText.LoadFile(fileDir);
|
wp.mainText.LoadFile(fileDir);
|
||||||
|
wp.CurrentFilePath = fileDir;
|
||||||
WinClassic app2 = wm.StartWin95(wp, "Wordpad", Properties.Resources.Win95IconWordpad, true, true);
|
WinClassic app2 = wm.StartWin95(wp, "Wordpad", Properties.Resources.Win95IconWordpad, true, true);
|
||||||
|
|
||||||
Program.AddTaskbarItem(app2, app2.Tag.ToString(), "Wordpad", Properties.Resources.Win95IconWordpad);
|
Program.AddTaskbarItem(app2, app2.Tag.ToString(), "Wordpad", Properties.Resources.Win95IconWordpad);
|
||||||
|
@ -664,7 +666,7 @@ private void FolderToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SaveDirectoryInfo(CurrentDirectory, "New Folder", false, "New Folder", true);
|
SaveDirectoryInfo(CurrentDirectory, "New Folder", false, "New Folder", true, false);
|
||||||
|
|
||||||
RefreshAll();
|
RefreshAll();
|
||||||
OldLabelText = "New Folder";
|
OldLabelText = "New Folder";
|
||||||
|
@ -723,20 +725,7 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
||||||
// Remove the directory now from the _data.info
|
// Remove the directory now from the _data.info
|
||||||
|
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
SaveSystem.RemoveSubDirFromDirectory(CurrentDirectory, mainView.FocusedItem.Text);
|
||||||
|
|
||||||
foreach (THDirInfo dir in fsfi.SubDirs)
|
|
||||||
{
|
|
||||||
if (dir.Name == mainView.FocusedItem.Text)
|
|
||||||
{
|
|
||||||
// Delete it
|
|
||||||
|
|
||||||
fsfi.SubDirs.Remove(dir);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(CurrentDirectory, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -744,20 +733,7 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
||||||
// Remove the file now from the _data.info
|
// Remove the file now from the _data.info
|
||||||
|
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
RemoveFileFromDirectory(CurrentDirectory, mainView.FocusedItem.Text);
|
||||||
|
|
||||||
foreach (THFileInfo file in fsfi.Files)
|
|
||||||
{
|
|
||||||
if (file.Name == mainView.FocusedItem.Text)
|
|
||||||
{
|
|
||||||
// Delete it
|
|
||||||
|
|
||||||
fsfi.Files.Remove(file);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(CurrentDirectory, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,54 +798,22 @@ private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e)
|
||||||
Directory.Move(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
Directory.Move(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
||||||
|
|
||||||
File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info"));
|
File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info"));
|
||||||
SaveDirectoryInfo(CurrentDirectory, setText, false, setText, true);
|
SaveDirectoryInfo(CurrentDirectory, setText, false, setText, true, true);
|
||||||
|
|
||||||
// Rename the directory now in the _data.info
|
// Rename the directory now in the _data.info
|
||||||
|
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
RenameDirectory(CurrentDirectory, OldLabelText, setText);
|
||||||
|
|
||||||
foreach (THDirInfo dir in fsfi.SubDirs)
|
|
||||||
{
|
|
||||||
if (dir.Name == OldLabelText)
|
|
||||||
{
|
|
||||||
// Rename it
|
|
||||||
THDirInfo oldDirInfo = dir;
|
|
||||||
oldDirInfo.Name = Path.Combine(CurrentDirectory, setText);
|
|
||||||
|
|
||||||
fsfi.SubDirs.Remove(dir);
|
|
||||||
fsfi.SubDirs.Add(oldDirInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File.Delete(Path.Combine(CurrentDirectory, "_data.info"));
|
|
||||||
File.WriteAllText(Path.Combine(CurrentDirectory, "_data.info"), JsonConvert.SerializeObject(fsfi));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// It was a file
|
// It was a file
|
||||||
|
|
||||||
File.Copy(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
File.Copy(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
||||||
File.Delete(Path.Combine(CurrentDirectory, OldLabelText));
|
File.Delete(Path.Combine(CurrentDirectory, OldLabelText));
|
||||||
|
|
||||||
// Rename the file now in the _data.info
|
// Rename the file now in the _data.info
|
||||||
|
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
RenameFile(CurrentDirectory, OldLabelText, setText);
|
||||||
|
|
||||||
foreach (THFileInfo file in fsfi.Files)
|
|
||||||
{
|
|
||||||
if (file.Name == OldLabelText)
|
|
||||||
{
|
|
||||||
// Rename it
|
|
||||||
THFileInfo oldFileInfo = file;
|
|
||||||
oldFileInfo.Name = Path.Combine(CurrentDirectory, setText);
|
|
||||||
|
|
||||||
fsfi.Files.Remove(file);
|
|
||||||
fsfi.Files.Add(oldFileInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File.Delete(Path.Combine(CurrentDirectory, "_data.info"));
|
|
||||||
File.WriteAllText(Path.Combine(CurrentDirectory, "_data.info"), JsonConvert.SerializeObject(fsfi));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +989,22 @@ private void SellectAllCtrlAToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
||||||
private void TextDocumentToolStripMenuItem_Click(object sender, EventArgs e)
|
private void TextDocumentToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (File.Exists(CurrentDirectory + "\\New Text Document.txt"))
|
||||||
|
{
|
||||||
|
//wm.StartInfobox95("Windows Explorer", "This directory already exists", Properties.Resources.Win95Info);
|
||||||
|
//TODO: add making "New Folder (2)"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CreateWindowsFile(CurrentDirectory, "New Text Document.txt", "", 12, 0);
|
||||||
|
|
||||||
|
RefreshAll();
|
||||||
|
OldLabelText = "New Folder";
|
||||||
|
mainView.LabelEdit = true;
|
||||||
|
mainView.FindItemWithText("New Text Document.txt").BeginEdit();
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshTreeNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public partial class WinClassicWordPad : UserControl
|
||||||
bool doItalic = false;
|
bool doItalic = false;
|
||||||
bool doUnderline = false;
|
bool doUnderline = false;
|
||||||
|
|
||||||
string CurrentFilePath = "";
|
public string CurrentFilePath = "";
|
||||||
|
|
||||||
public WinClassicWordPad()
|
public WinClassicWordPad()
|
||||||
{
|
{
|
||||||
|
|
|
@ -243,18 +243,28 @@ public void OpenFile(string fileDir)
|
||||||
case 1:
|
case 1:
|
||||||
WinClassicNotepad np = new WinClassicNotepad();
|
WinClassicNotepad np = new WinClassicNotepad();
|
||||||
np.mainText.Text = FileDialogBoxManager.ReadTextFile(fileDir);
|
np.mainText.Text = FileDialogBoxManager.ReadTextFile(fileDir);
|
||||||
|
np.CurrentFilePath = fileDir;
|
||||||
WinClassic app = wm.StartWin95(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true);
|
WinClassic app = wm.StartWin95(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true);
|
||||||
|
|
||||||
Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad);
|
Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
WinClassicWordPad wp = new WinClassicWordPad();
|
||||||
|
wp.mainText.LoadFile(fileDir);
|
||||||
|
wp.CurrentFilePath = fileDir;
|
||||||
|
WinClassic app2 = wm.StartWin95(wp, "Wordpad", Properties.Resources.Win95IconWordpad, true, true);
|
||||||
|
|
||||||
|
Program.AddTaskbarItem(app2, app2.Tag.ToString(), "Wordpad", Properties.Resources.Win95IconWordpad);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir), fileDir);
|
OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir), fileDir);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch {
|
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenApplication(string appname, string path)
|
void OpenApplication(string appname, string path)
|
||||||
|
@ -778,20 +788,7 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
||||||
// Remove the directory now from the _data.info
|
// Remove the directory now from the _data.info
|
||||||
|
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
SaveSystem.RemoveSubDirFromDirectory(CurrentDirectory, mainView.FocusedItem.Text);
|
||||||
|
|
||||||
foreach (THDirInfo dir in fsfi.SubDirs)
|
|
||||||
{
|
|
||||||
if (dir.Name == mainView.FocusedItem.Text)
|
|
||||||
{
|
|
||||||
// Delete it
|
|
||||||
|
|
||||||
fsfi.SubDirs.Remove(dir);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(CurrentDirectory, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -799,20 +796,7 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
||||||
// Remove the file now from the _data.info
|
// Remove the file now from the _data.info
|
||||||
|
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
RemoveFileFromDirectory(CurrentDirectory, mainView.FocusedItem.Text);
|
||||||
|
|
||||||
foreach (THFileInfo file in fsfi.Files)
|
|
||||||
{
|
|
||||||
if (file.Name == mainView.FocusedItem.Text)
|
|
||||||
{
|
|
||||||
// Delete it
|
|
||||||
|
|
||||||
fsfi.Files.Remove(file);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(CurrentDirectory, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,6 +808,8 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
RefreshAll();
|
RefreshAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefreshTreeNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool FileOrDirectoryExists(string path)
|
internal static bool FileOrDirectoryExists(string path)
|
||||||
|
@ -876,54 +862,22 @@ private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e)
|
||||||
Directory.Move(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
Directory.Move(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
||||||
|
|
||||||
File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info"));
|
File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info"));
|
||||||
SaveDirectoryInfo(CurrentDirectory, setText, false, setText, true);
|
SaveDirectoryInfo(CurrentDirectory, setText, false, setText, true, true);
|
||||||
|
|
||||||
// Rename the directory now in the _data.info
|
// Rename the directory now in the _data.info
|
||||||
|
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
RenameDirectory(CurrentDirectory, OldLabelText, setText);
|
||||||
|
|
||||||
foreach (THDirInfo dir in fsfi.SubDirs)
|
|
||||||
{
|
|
||||||
if (dir.Name == mainView.FocusedItem.Tag.ToString())
|
|
||||||
{
|
|
||||||
// Rename it
|
|
||||||
THDirInfo oldDirInfo = dir;
|
|
||||||
oldDirInfo.Name = Path.Combine(CurrentDirectory, setText);
|
|
||||||
|
|
||||||
fsfi.SubDirs.Remove(dir);
|
|
||||||
fsfi.SubDirs.Add(oldDirInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File.Delete(Path.Combine(CurrentDirectory, "_data.info"));
|
|
||||||
File.WriteAllText(Path.Combine(CurrentDirectory, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// It was a file
|
// It was a file
|
||||||
|
|
||||||
File.Copy(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
File.Copy(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
||||||
File.Delete(Path.Combine(CurrentDirectory, OldLabelText));
|
File.Delete(Path.Combine(CurrentDirectory, OldLabelText));
|
||||||
|
|
||||||
// Rename the file now in the _data.info
|
// Rename the file now in the _data.info
|
||||||
|
|
||||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
RenameFile(CurrentDirectory, OldLabelText, setText);
|
||||||
|
|
||||||
foreach (THFileInfo file in fsfi.Files)
|
|
||||||
{
|
|
||||||
if (file.Name == mainView.FocusedItem.Tag.ToString())
|
|
||||||
{
|
|
||||||
// Rename it
|
|
||||||
THFileInfo oldFileInfo = file;
|
|
||||||
oldFileInfo.Name = Path.Combine(CurrentDirectory, setText);
|
|
||||||
|
|
||||||
fsfi.Files.Remove(file);
|
|
||||||
fsfi.Files.Add(oldFileInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File.Delete(Path.Combine(CurrentDirectory, "_data.info"));
|
|
||||||
File.WriteAllText(Path.Combine(CurrentDirectory, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue