Skip to content

Commit

Permalink
Save as...(the selected tab, save as opens a window to save to file),…
Browse files Browse the repository at this point in the history
… Save All(for all the tabs the ones opened from file/reference a file save the content back to the files), Save(save the contents for the selected tab back to the file they come from)
  • Loading branch information
avraampiperidis committed Sep 24, 2020
1 parent 4617ac3 commit a840ccb
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 55 deletions.
1 change: 1 addition & 0 deletions Firedump/Firedump/Firedump.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
<Compile Include="core\db\DbConnectionFactory.cs" />
<Compile Include="core\db\SqliteHelpers.cs" />
<Compile Include="core\EditorAdapter.cs" />
<Compile Include="core\FileIO.cs" />
<Compile Include="core\models\dbinfo\Status.cs" />
<Compile Include="core\models\events\ExecutionEventArgs.cs" />
<Compile Include="core\models\MyToolStripItem.cs" />
Expand Down
51 changes: 33 additions & 18 deletions Firedump/Firedump/MainHome.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Firedump/Firedump/MainHome.MenuExecutors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,20 @@ private void toolStripButtonOpenExecuteFileForm_Click(object sender, EventArgs e
}
}
}

private void saveScriptAsToolStripMenuItem_Click(object sender, EventArgs e)
{
GetUserControl<Editor>().SaveAs();
}

private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
{
GetUserControl<Editor>().Save();
}

private void saveAllToolStripMenuItem_Click(object sender, EventArgs e)
{
GetUserControl<Editor>().SaveAll();
}
}
}
28 changes: 14 additions & 14 deletions Firedump/Firedump/MainHome.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,22 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>678, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="toolStripButtonExecCurrent.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFtSURBVDhPxZIxS8NQFIXzE/wJ/gQHB8cSHC24dnOI4BbF
rZNTBpeSQXToKlmEzCJUJ6VTh2YTa7ciHTKkTcbr+y7vhaSKiIsXDsl799zzzr3veWVZikG+Xq8vvL8E
Aoc3B/Ly+ixFUbxXVdWxqd8FAnuXu4rzuzOZfcxwlBqhbUv5OZoCYD/uyPXTVd0Wjlar1Y6lw5/M53Mx
uUc9ZFMAIABpPB4r+Kc9wx2w7na7kiSJHtISOLk9lunbVPr9vvi+38JwOJTlcim9Xk/XfKlVAYb4kN0r
IQiCL8VgNBpJHMf1GiemNlUBhyYhiiIVxD7FFLgcDg0/N7GFQAq+IdRoWqd/1maARzpVJrlYLPJNAkPi
m2VZqy3cuFtQAU5vWt/stQn2yXOIFTn1+HEEZz0Mw1Yh4BbIuRtiRmade9hH2Vk3mwPuHGHmAtjHMie6
WVGDoM6ApC1OtS8TvD5eoUX9rOEyF8OdkLPb/xae9wl7GAuN3HKDggAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>573, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="toolStripButtonUpper.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
Expand All @@ -152,18 +164,6 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>458, 17</value>
</metadata>
<data name="toolStripButtonExecCurrent.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFtSURBVDhPxZIxS8NQFIXzE/wJ/gQHB8cSHC24dnOI4BbF
rZNTBpeSQXToKlmEzCJUJ6VTh2YTa7ciHTKkTcbr+y7vhaSKiIsXDsl799zzzr3veWVZikG+Xq8vvL8E
Aoc3B/Ly+ixFUbxXVdWxqd8FAnuXu4rzuzOZfcxwlBqhbUv5OZoCYD/uyPXTVd0Wjlar1Y6lw5/M53Mx
uUc9ZFMAIABpPB4r+Kc9wx2w7na7kiSJHtISOLk9lunbVPr9vvi+38JwOJTlcim9Xk/XfKlVAYb4kN0r
IQiCL8VgNBpJHMf1GiemNlUBhyYhiiIVxD7FFLgcDg0/N7GFQAq+IdRoWqd/1maARzpVJrlYLPJNAkPi
m2VZqy3cuFtQAU5vWt/stQn2yXOIFTn1+HEEZz0Mw1Yh4BbIuRtiRmade9hH2Vk3mwPuHGHmAtjHMie6
WVGDoM6ApC1OtS8TvD5eoUX9rOEyF8OdkLPb/xae9wl7GAuN3HKDggAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>783, 17</value>
</metadata>
Expand All @@ -172,7 +172,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADq
CQAAAk1TRnQBSQFMAgEBBAEAARABBAEQAQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CQAAAk1TRnQBSQFMAgEBBAEAATgBBAE4AQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down
43 changes: 43 additions & 0 deletions Firedump/Firedump/core/FileIO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using FastColoredTextBoxNS;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Firedump.core
{
internal class FileIO
{

internal static void Save(FastColoredTextBox tb,string fileName)
{
try
{
tb.SaveToFile(fileName, System.Text.Encoding.UTF8);
}
catch (IOException ex) { }
}

internal static FileInfo FileInfo(string fileName)
{
try
{
return new FileInfo(fileName);
}
catch (Exception ex) { }
return null;
}

internal static string ReadAllText(string fileName)
{
try
{
return File.ReadAllText(fileName);
}
catch (Exception ex) { }
return null;
}
}
}
4 changes: 2 additions & 2 deletions Firedump/Firedump/core/models/TabPageHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public sealed class TabPageHolder : TabPage
private readonly AutocompleteMenu menu;
private readonly FastColoredTextBox fastColoredTextBox;
private readonly DataView dataView;
private readonly bool isFile;
public readonly bool IsFile;

public TabPageHolder(FastColoredTextBox fastColoredTextBox, AutocompleteMenu menu, DataView dataView, bool isFile)
{
this.fastColoredTextBox = fastColoredTextBox;
this.menu = menu;
this.dataView = dataView;
this.isFile = isFile;
this.IsFile = isFile;
}


Expand Down
9 changes: 6 additions & 3 deletions Firedump/Firedump/ui/forms/ExecuteScriptForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ public ExecuteScriptForm(DbConnection c, string file)
FormUtils.setFormIcon(this);
this.con = c;
this.file = file;
this.label1.Text = "File: " + file;
try
{
this.label1.Text = "File: " + file + "\n" +
"Size: " + ((File.OpenRead(file).Length) / 1024) / 1024 + " Mb's";
}
catch (IOException ex) { Close(); }
worker.DoWork += loadAndExecute;
}

Expand Down Expand Up @@ -95,7 +100,5 @@ private void loadAndExecute(object sender, DoWorkEventArgs e)
});
}
}


}
}
Loading

0 comments on commit a840ccb

Please sign in to comment.