-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
123 lines (111 loc) · 4.17 KB
/
Form1.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Esxv2ModuleCreator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog Klasor = new FolderBrowserDialog();
Klasor.SelectedPath = Properties.Settings.Default.selectedpath;
if (Klasor.ShowDialog() == DialogResult.OK)
{
textBox1.Text = Klasor.SelectedPath + "\\" +textBox2.Text;
Properties.Settings.Default.selectedpath = Klasor.SelectedPath;
Properties.Settings.Default.Save();
}
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = Properties.Settings.Default.selectedpath;
}
private void button2_Click(object sender, EventArgs e)
{
string root = Properties.Settings.Default.selectedpath+"\\"+textBox2.Text;
toolStripProgressBar1.Value += 10;
if (!Directory.Exists(root))
{
Directory.CreateDirectory(root);
toolStripProgressBar1.Value += 10;
Directory.CreateDirectory(root+"\\client");
toolStripProgressBar1.Value += 10;
Directory.CreateDirectory(root+"\\data");
toolStripProgressBar1.Value += 10;
Directory.CreateDirectory(root+"\\data\\locales");
toolStripProgressBar1.Value += 10;
Directory.CreateDirectory(root+"\\server");
toolStripProgressBar1.Value += 10;
filecreate(root + "\\client");
toolStripProgressBar1.Value += 10;
filecreate(root + "\\server");
toolStripProgressBar1.Value += 10;
File.Create(root + "\\data\\locales\\en.lua");
toolStripProgressBar1.Value += 10;
File.Create(root + "\\data\\config.lua");
toolStripProgressBar1.Value += 10;
modulejsonupdate();
if (migrationFolder.Checked)
{
createmigrationsfolder(root + "\\migrations");
}
if (sharedFolder.Checked)
{
createsharedfolder(root + "\\shared");
}
MessageBox.Show("All files created.");
}
}
private void createmigrationsfolder(string root)
{
Directory.CreateDirectory(root);
File.Create(root + "\\0.sql");
}
private void createsharedfolder(string root)
{
Directory.CreateDirectory(root);
filecreate(root);
}
private void modulejsonupdate()
{
string json = File.ReadAllText(Properties.Settings.Default.selectedpath + "\\modules.json");
json = json.Trim();
string modulesJson = json.Substring(0, json.Length - 1);
modulesJson += ",\"" + textBox2.Text + "\"]";
File.WriteAllText(Properties.Settings.Default.selectedpath + "\\modules.json", modulesJson);
}
private void filecreate(string folder)
{
File.Create(folder + "\\main.lua");
File.Create(folder + "\\events.lua");
File.Create(folder + "\\module.lua");
}
private void toolStripLabel2_Click(object sender, EventArgs e)
{
Process.Start("https://discord.gg/KedpEgV");
}
private void toolStripLabel1_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/abdulkadiraktas");
}
private void toolStripProgressBar1_Click(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
textBox1.Text = Properties.Settings.Default.selectedpath + "\\" + textBox2.Text;
}
}
}