-
Notifications
You must be signed in to change notification settings - Fork 1
/
OutputLog.cs
77 lines (72 loc) · 2.78 KB
/
OutputLog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Script_Builder
{
public partial class OutputLog : Form
{
private mainForm mainForm;
public OutputLog(string[] LogText,mainForm mainForm)
{
InitializeComponent();
txtOutputLog.Lines = LogText;
this.mainForm = mainForm;
}
private void closeOutputLog_Click(object sender, EventArgs e)
{
this.Close();
}
private void clearOutputLog_Click(object sender, EventArgs e)
{
if (MessageBox.Show(mainForm.programmStrings.GetString("textShallDeleteLog"), mainForm.programmStrings.GetString("textDeleteLog"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return;
mainForm.ClearOutputLog();
txtOutputLog.Text = "";
}
private void saveOutputLog_Click(object sender, EventArgs e)
{
SaveFileDialog Dialog = new SaveFileDialog();
string startPath;
switch (mainForm.programOptions.GetOptions("StartPathType").Value)
{
case "GroupsLast":
startPath = "StartPathOutput";
break;
default:
startPath = "StartPath";
break;
}
Dialog.InitialDirectory = mainForm.programOptions.GetOptions(startPath).Value;
Dialog.AddExtension = true;
Dialog.CheckPathExists = true;
Dialog.DefaultExt = "txt";
Dialog.Filter = mainForm.programmStrings.GetString("filterText") + " (*.txt)|*.txt";
Dialog.OverwritePrompt = true;
Dialog.Title = mainForm.programmStrings.GetString("textSaveLog");
Dialog.ValidateNames = true;
DialogResult result = Dialog.ShowDialog();
if (result == DialogResult.Cancel || result == DialogResult.Abort)
return;
using (FileStream sw = new FileStream(Dialog.FileName, FileMode.Create))
{
foreach (string line in txtOutputLog.Lines)
{
mainForm.writeLines(line, sw, Encoding.Default, true);
}
}
mainForm.CurrentPath = Path.GetDirectoryName(Dialog.FileName);
if (mainForm.programOptions.GetOptions("StartPathType").Value != "AlwaysSame")
mainForm.programOptions.SetOptions(startPath, mainForm.CurrentPath);
}
private void OutputLog_Shown(object sender, EventArgs e)
{
txtOutputLog.Select(txtOutputLog.Text.Length, 0);
}
}
}