Skip to content

Commit a840ccb

Browse files
Save as...(the selected tab, save as opens a window to save to file), 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)
1 parent 4617ac3 commit a840ccb

File tree

8 files changed

+185
-55
lines changed

8 files changed

+185
-55
lines changed

Firedump/Firedump/Firedump.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@
205205
<Compile Include="core\db\DbConnectionFactory.cs" />
206206
<Compile Include="core\db\SqliteHelpers.cs" />
207207
<Compile Include="core\EditorAdapter.cs" />
208+
<Compile Include="core\FileIO.cs" />
208209
<Compile Include="core\models\dbinfo\Status.cs" />
209210
<Compile Include="core\models\events\ExecutionEventArgs.cs" />
210211
<Compile Include="core\models\MyToolStripItem.cs" />

Firedump/Firedump/MainHome.Designer.cs

Lines changed: 33 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Firedump/Firedump/MainHome.MenuExecutors.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,5 +280,20 @@ private void toolStripButtonOpenExecuteFileForm_Click(object sender, EventArgs e
280280
}
281281
}
282282
}
283+
284+
private void saveScriptAsToolStripMenuItem_Click(object sender, EventArgs e)
285+
{
286+
GetUserControl<Editor>().SaveAs();
287+
}
288+
289+
private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
290+
{
291+
GetUserControl<Editor>().Save();
292+
}
293+
294+
private void saveAllToolStripMenuItem_Click(object sender, EventArgs e)
295+
{
296+
GetUserControl<Editor>().SaveAll();
297+
}
283298
}
284299
}

Firedump/Firedump/MainHome.resx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,22 @@
123123
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124124
<value>678, 17</value>
125125
</metadata>
126+
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
127+
<data name="toolStripButtonExecCurrent.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
128+
<value>
129+
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
130+
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFtSURBVDhPxZIxS8NQFIXzE/wJ/gQHB8cSHC24dnOI4BbF
131+
rZNTBpeSQXToKlmEzCJUJ6VTh2YTa7ciHTKkTcbr+y7vhaSKiIsXDsl799zzzr3veWVZikG+Xq8vvL8E
132+
Aoc3B/Ly+ixFUbxXVdWxqd8FAnuXu4rzuzOZfcxwlBqhbUv5OZoCYD/uyPXTVd0Wjlar1Y6lw5/M53Mx
133+
uUc9ZFMAIABpPB4r+Kc9wx2w7na7kiSJHtISOLk9lunbVPr9vvi+38JwOJTlcim9Xk/XfKlVAYb4kN0r
134+
IQiCL8VgNBpJHMf1GiemNlUBhyYhiiIVxD7FFLgcDg0/N7GFQAq+IdRoWqd/1maARzpVJrlYLPJNAkPi
135+
m2VZqy3cuFtQAU5vWt/stQn2yXOIFTn1+HEEZz0Mw1Yh4BbIuRtiRmade9hH2Vk3mwPuHGHmAtjHMie6
136+
WVGDoM6ApC1OtS8TvD5eoUX9rOEyF8OdkLPb/xae9wl7GAuN3HKDggAAAABJRU5ErkJggg==
137+
</value>
138+
</data>
126139
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127140
<value>573, 17</value>
128141
</metadata>
129-
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
130142
<data name="toolStripButtonUpper.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
131143
<value>
132144
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@@ -152,18 +164,6 @@
152164
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
153165
<value>458, 17</value>
154166
</metadata>
155-
<data name="toolStripButtonExecCurrent.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
156-
<value>
157-
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
158-
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFtSURBVDhPxZIxS8NQFIXzE/wJ/gQHB8cSHC24dnOI4BbF
159-
rZNTBpeSQXToKlmEzCJUJ6VTh2YTa7ciHTKkTcbr+y7vhaSKiIsXDsl799zzzr3veWVZikG+Xq8vvL8E
160-
Aoc3B/Ly+ixFUbxXVdWxqd8FAnuXu4rzuzOZfcxwlBqhbUv5OZoCYD/uyPXTVd0Wjlar1Y6lw5/M53Mx
161-
uUc9ZFMAIABpPB4r+Kc9wx2w7na7kiSJHtISOLk9lunbVPr9vvi+38JwOJTlcim9Xk/XfKlVAYb4kN0r
162-
IQiCL8VgNBpJHMf1GiemNlUBhyYhiiIVxD7FFLgcDg0/N7GFQAq+IdRoWqd/1maARzpVJrlYLPJNAkPi
163-
m2VZqy3cuFtQAU5vWt/stQn2yXOIFTn1+HEEZz0Mw1Yh4BbIuRtiRmade9hH2Vk3mwPuHGHmAtjHMie6
164-
WVGDoM6ApC1OtS8TvD5eoUX9rOEyF8OdkLPb/xae9wl7GAuN3HKDggAAAABJRU5ErkJggg==
165-
</value>
166-
</data>
167167
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
168168
<value>783, 17</value>
169169
</metadata>
@@ -172,7 +172,7 @@
172172
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
173173
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
174174
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADq
175-
CQAAAk1TRnQBSQFMAgEBBAEAARABBAEQAQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
175+
CQAAAk1TRnQBSQFMAgEBBAEAATgBBAE4AQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
176176
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
177177
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
178178
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

Firedump/Firedump/core/FileIO.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using FastColoredTextBoxNS;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.IO;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace Firedump.core
10+
{
11+
internal class FileIO
12+
{
13+
14+
internal static void Save(FastColoredTextBox tb,string fileName)
15+
{
16+
try
17+
{
18+
tb.SaveToFile(fileName, System.Text.Encoding.UTF8);
19+
}
20+
catch (IOException ex) { }
21+
}
22+
23+
internal static FileInfo FileInfo(string fileName)
24+
{
25+
try
26+
{
27+
return new FileInfo(fileName);
28+
}
29+
catch (Exception ex) { }
30+
return null;
31+
}
32+
33+
internal static string ReadAllText(string fileName)
34+
{
35+
try
36+
{
37+
return File.ReadAllText(fileName);
38+
}
39+
catch (Exception ex) { }
40+
return null;
41+
}
42+
}
43+
}

Firedump/Firedump/core/models/TabPageHolder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ public sealed class TabPageHolder : TabPage
1414
private readonly AutocompleteMenu menu;
1515
private readonly FastColoredTextBox fastColoredTextBox;
1616
private readonly DataView dataView;
17-
private readonly bool isFile;
17+
public readonly bool IsFile;
1818

1919
public TabPageHolder(FastColoredTextBox fastColoredTextBox, AutocompleteMenu menu, DataView dataView, bool isFile)
2020
{
2121
this.fastColoredTextBox = fastColoredTextBox;
2222
this.menu = menu;
2323
this.dataView = dataView;
24-
this.isFile = isFile;
24+
this.IsFile = isFile;
2525
}
2626

2727

Firedump/Firedump/ui/forms/ExecuteScriptForm.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ public ExecuteScriptForm(DbConnection c, string file)
2727
FormUtils.setFormIcon(this);
2828
this.con = c;
2929
this.file = file;
30-
this.label1.Text = "File: " + file;
30+
try
31+
{
32+
this.label1.Text = "File: " + file + "\n" +
33+
"Size: " + ((File.OpenRead(file).Length) / 1024) / 1024 + " Mb's";
34+
}
35+
catch (IOException ex) { Close(); }
3136
worker.DoWork += loadAndExecute;
3237
}
3338

@@ -95,7 +100,5 @@ private void loadAndExecute(object sender, DoWorkEventArgs e)
95100
});
96101
}
97102
}
98-
99-
100103
}
101104
}

0 commit comments

Comments
 (0)