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>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<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)
|
||||
{
|
||||
newfile.DOSName = newfile.Name.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(" ", "");
|
||||
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";
|
||||
SetDOSName(ref newfile);
|
||||
|
||||
if (File.ReadAllText(Path.Combine(path, "_data.info")).Contains(newfile.DOSName)) return;
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
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.ByteSize = 0;
|
||||
|
||||
if (parent != ProfileDirectory)
|
||||
if (updateParent == true)
|
||||
{
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(parent, "_data.info")));
|
||||
THDirInfo thd = new THDirInfo();
|
||||
thd.Name = info.Label;
|
||||
thd.DOSName = info.DOSLabel;
|
||||
fsfi.SubDirs.Add(thd);
|
||||
if ((parent != ProfileDirectory))
|
||||
{
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(parent, "_data.info")));
|
||||
THDirInfo thd = new THDirInfo();
|
||||
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);
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Histacom2.OS.Win95.Win95Apps
|
|||
{
|
||||
public partial class WinClassicNotepad : UserControl
|
||||
{
|
||||
string CurrentFilePath = "";
|
||||
public string CurrentFilePath = "";
|
||||
public WinClassicNotepad()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
|
@ -30,6 +30,10 @@ private void InitializeComponent()
|
|||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
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.diskView = new System.Windows.Forms.TreeView();
|
||||
this.MenuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
|
@ -37,7 +41,6 @@ private void InitializeComponent()
|
|||
this.CreateShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.FolderToolStripMenuItem = 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.RenameToolStripMenuItem = 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.bottomleftcorner = 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.program.SuspendLayout();
|
||||
this.MenuStrip1.SuspendLayout();
|
||||
this.pnlSave.SuspendLayout();
|
||||
this.MenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// program
|
||||
|
@ -82,6 +81,47 @@ private void InitializeComponent()
|
|||
this.program.Size = new System.Drawing.Size(704, 517);
|
||||
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
|
||||
//
|
||||
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.FolderToolStripMenuItem,
|
||||
this.TextDocumentToolStripMenuItem,
|
||||
this.BitmapImageToolStripMenuItem});
|
||||
this.TextDocumentToolStripMenuItem});
|
||||
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";
|
||||
//
|
||||
// FolderToolStripMenuItem
|
||||
|
@ -149,12 +188,6 @@ private void InitializeComponent()
|
|||
this.FolderToolStripMenuItem.Text = "Folder";
|
||||
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
|
||||
//
|
||||
this.TextDocumentToolStripMenuItem.Name = "TextDocumentToolStripMenuItem";
|
||||
|
@ -162,30 +195,24 @@ private void InitializeComponent()
|
|||
this.TextDocumentToolStripMenuItem.Text = "Text Document";
|
||||
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
|
||||
//
|
||||
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.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click);
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.RenameToolStripMenuItem_Click);
|
||||
//
|
||||
// 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.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.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
|
||||
//
|
||||
this.refresh.Interval = 15000;
|
||||
|
@ -353,10 +339,10 @@ private void InitializeComponent()
|
|||
this.Load += new System.EventHandler(this.WinClassicWindowsExplorer_Load);
|
||||
this.program.ResumeLayout(false);
|
||||
this.program.PerformLayout();
|
||||
this.MenuStrip1.ResumeLayout(false);
|
||||
this.MenuStrip1.PerformLayout();
|
||||
this.pnlSave.ResumeLayout(false);
|
||||
this.pnlSave.PerformLayout();
|
||||
this.MenuStrip1.ResumeLayout(false);
|
||||
this.MenuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -370,7 +356,6 @@ private void InitializeComponent()
|
|||
internal System.Windows.Forms.ToolStripMenuItem CreateShortcutToolStripMenuItem;
|
||||
internal System.Windows.Forms.ToolStripMenuItem FolderToolStripMenuItem;
|
||||
internal System.Windows.Forms.ToolStripMenuItem TextDocumentToolStripMenuItem;
|
||||
internal System.Windows.Forms.ToolStripMenuItem BitmapImageToolStripMenuItem;
|
||||
internal System.Windows.Forms.ToolStripMenuItem DeleteToolStripMenuItem;
|
||||
internal System.Windows.Forms.ToolStripMenuItem RenameToolStripMenuItem;
|
||||
internal System.Windows.Forms.ToolStripMenuItem CloseToolStripMenuItem;
|
||||
|
|
|
@ -222,6 +222,7 @@ public void OpenFile(string fileDir)
|
|||
case 1:
|
||||
WinClassicNotepad np = new WinClassicNotepad();
|
||||
np.mainText.Text = FileDialogBoxManager.ReadTextFile(fileDir);
|
||||
np.CurrentFilePath = fileDir;
|
||||
WinClassic app = wm.StartWin95(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true);
|
||||
|
||||
Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad);
|
||||
|
@ -229,6 +230,7 @@ public void OpenFile(string fileDir)
|
|||
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);
|
||||
|
@ -664,7 +666,7 @@ private void FolderToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
}
|
||||
else
|
||||
{
|
||||
SaveDirectoryInfo(CurrentDirectory, "New Folder", false, "New Folder", true);
|
||||
SaveDirectoryInfo(CurrentDirectory, "New Folder", false, "New Folder", true, false);
|
||||
|
||||
RefreshAll();
|
||||
OldLabelText = "New Folder";
|
||||
|
@ -723,20 +725,7 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
||||
// Remove the directory now from the _data.info
|
||||
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
||||
|
||||
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));
|
||||
SaveSystem.RemoveSubDirFromDirectory(CurrentDirectory, mainView.FocusedItem.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -744,20 +733,7 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
||||
// Remove the file now from the _data.info
|
||||
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
||||
|
||||
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));
|
||||
RemoveFileFromDirectory(CurrentDirectory, mainView.FocusedItem.Text);
|
||||
|
||||
}
|
||||
|
||||
|
@ -822,27 +798,11 @@ private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e)
|
|||
Directory.Move(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
||||
|
||||
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
|
||||
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
||||
|
||||
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));
|
||||
RenameDirectory(CurrentDirectory, OldLabelText, setText);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -853,23 +813,7 @@ private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e)
|
|||
|
||||
// Rename the file now in the _data.info
|
||||
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
||||
|
||||
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));
|
||||
RenameFile(CurrentDirectory, OldLabelText, setText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1045,7 +989,22 @@ private void SellectAllCtrlAToolStripMenuItem_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 doUnderline = false;
|
||||
|
||||
string CurrentFilePath = "";
|
||||
public string CurrentFilePath = "";
|
||||
|
||||
public WinClassicWordPad()
|
||||
{
|
||||
|
|
|
@ -243,16 +243,26 @@ public void OpenFile(string fileDir)
|
|||
case 1:
|
||||
WinClassicNotepad np = new WinClassicNotepad();
|
||||
np.mainText.Text = FileDialogBoxManager.ReadTextFile(fileDir);
|
||||
np.CurrentFilePath = fileDir;
|
||||
WinClassic app = wm.StartWin95(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true);
|
||||
|
||||
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;
|
||||
case 12:
|
||||
OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir), fileDir);
|
||||
break;
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -778,20 +788,7 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
||||
// Remove the directory now from the _data.info
|
||||
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
||||
|
||||
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));
|
||||
SaveSystem.RemoveSubDirFromDirectory(CurrentDirectory, mainView.FocusedItem.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -799,20 +796,7 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
||||
// Remove the file now from the _data.info
|
||||
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
||||
|
||||
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));
|
||||
RemoveFileFromDirectory(CurrentDirectory, mainView.FocusedItem.Text);
|
||||
|
||||
}
|
||||
|
||||
|
@ -824,6 +808,8 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
{
|
||||
RefreshAll();
|
||||
}
|
||||
|
||||
RefreshTreeNode();
|
||||
}
|
||||
|
||||
internal static bool FileOrDirectoryExists(string path)
|
||||
|
@ -876,27 +862,11 @@ private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e)
|
|||
Directory.Move(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText));
|
||||
|
||||
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
|
||||
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
||||
|
||||
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));
|
||||
RenameDirectory(CurrentDirectory, OldLabelText, setText);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -907,23 +877,7 @@ private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e)
|
|||
|
||||
// Rename the file now in the _data.info
|
||||
|
||||
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
|
||||
|
||||
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));
|
||||
RenameFile(CurrentDirectory, OldLabelText, setText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue