-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.cs
166 lines (150 loc) · 6.61 KB
/
edit.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
Copyright (c) 2018-2020 Daniel Strayker Nowak
All rights reserved
*/
using System;
using System.Windows.Forms;
using System.IO;
namespace ChangeLog_Generator
{
public partial class Edit : Form
{
StreamWriter save;
string dir = ""; // For directory for changelog,
readonly Language a = new Language();
string lang = "";
public Edit(string sciezka)
{
InitializeComponent();
this.dir = sciezka;
lang = a.GetLang();
if(lang == "en")
{
label3.Text = "1. Header:";
label4.Text = "2. Additional informations:";
label5.Text = "3. To be in next version\n(Leave empty, if not wanted):";
label6.Text = "4. Idditional informations\n(Leave empty, if not wanted):";
ExitButton.Text = "Exit";
GenerateButton.Text = "Generate";
}
}
public void button1_Click(object sender, EventArgs e) // Exit button:
{
var formy = Application.OpenForms;
formy[0].Show();
Close();
}
public void button2_Click(object sender, EventArgs e) // Generate file button:
{
if((textBox_naglowek.Text == null) || (textBox_info_dod.Text == null))
{
if (lang == "en")
{
MessageBox.Show("Textboxes 1 and 2 are needed to create file!", "ChangeLog Generator", MessageBoxButtons.OK);
}
else if (lang == "pl")
{
MessageBox.Show("Pola tekstowe numer 1 i 2 są wymagane do utworzenia pliku!", "ChangeLog Generator", MessageBoxButtons.OK);
}
}
else
{
Wpis_do_pliku();
if (lang == "en")
{
MessageBox.Show("File generation completed succesfully! File is in: " + dir + " !", "ChangeLog Generator", MessageBoxButtons.OK);
}
else if (lang == "pl")
{
MessageBox.Show("Generowanie pliku ukończone pomyślnie! Plik znajduje się w: " + dir + " !", "ChangeLog Generator", MessageBoxButtons.OK);
}
var formy = Application.OpenForms;
formy[0].Show();
Close();
}
}
public void Wpis_do_pliku()
{
if (lang == "en")
{
save = new StreamWriter(dir + "\\changelog.txt");
save.WriteLine("*ChangeLog*");
save.WriteLine();
save.WriteLine("Information from author:");
save.WriteLine();
save.Write(textBox_naglowek.Text);
save.WriteLine();
save.WriteLine();
save.WriteLine("What's new?");
save.WriteLine();
save.Write(textBox_info_dod.Text);
save.WriteLine();
if (textBox_info_zap.Text != "")
{
save.WriteLine();
save.WriteLine("What will be added in next update?");
save.WriteLine();
save.Write(textBox_info_zap.Text);
save.WriteLine();
}
if (textBox_info_dodatk.Text != "")
{
save.WriteLine();
save.WriteLine("Additional informations:");
save.WriteLine();
save.Write(textBox_info_dodatk.Text);
save.WriteLine();
}
save.WriteLine();
save.WriteLine(" ====================== Advertisment ====================== ");
save.WriteLine(" | This ChangeLog was created with | ");
save.WriteLine(" | ChangeLog Generator by | ");
save.WriteLine(" | Daniel Strayker Nowak! | ");
save.WriteLine(" | https://straykerpl.github.io | ");
save.WriteLine(" | https://github.com/StraykerPL/changelog_generator | ");
save.WriteLine(" ========================================================== ");
}
else if (lang == "pl")
{
save = new StreamWriter(dir + "\\changelog.txt");
save.WriteLine("*ChangeLog*");
save.WriteLine();
save.WriteLine("Informacje od autora:");
save.WriteLine();
save.Write(textBox_naglowek.Text);
save.WriteLine();
save.WriteLine();
save.WriteLine("Co nowego?");
save.WriteLine();
save.Write(textBox_info_dod.Text);
save.WriteLine();
if (textBox_info_zap.Text != "")
{
save.WriteLine();
save.WriteLine("Co zostanie dodane w następnej aktualizacji?");
save.WriteLine();
save.Write(textBox_info_zap.Text);
save.WriteLine();
}
if (textBox_info_dodatk.Text != "")
{
save.WriteLine();
save.WriteLine("Dodatkowe informacje:");
save.WriteLine();
save.Write(textBox_info_dodatk.Text);
save.WriteLine();
}
save.WriteLine();
save.WriteLine(" ================================ Reklama ================================ ");
save.WriteLine(" | Ten ChangeLog został wygenerowany przy pomocy | ");
save.WriteLine(" | ChangeLog Generator stworzonego przez | ");
save.WriteLine(" | Daniel Strayker Nowak! | ");
save.WriteLine(" | https://straykerpl.github.io | ");
save.WriteLine(" | https://github.com/StraykerPL/changelog_generator | ");
save.WriteLine(" ========================================================================= ");
}
save.Close();
save.Dispose();
}
}
}