This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
fSettings.cs
211 lines (183 loc) · 7.5 KB
/
fSettings.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
using meautosd.Properties;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static meautosd.cConst;
namespace meautosd
{
public partial class fSettings : Form
{
public fSettings()
{
InitializeComponent();
}
private void fSettings_Load(object sender, EventArgs e)
{
tbLocFile.Text = Settings.Default.finishLocation;
tbFileName.Text = Settings.Default.finishName;
tbPbToken.Text = Settings.Default.pbToken;
cbPbSend.Checked = Settings.Default.pbSend;
cbDelete.Checked = Settings.Default.deleFinishFile;
tbAMELoc.Text = Settings.Default.AMEPath;
cbAMEStartup.Checked = Settings.Default.openAMEOnStartup;
cbUseSound.Checked = Settings.Default.useSound;
tbLogLoc.Text = Settings.Default.logFileLoc;
Registry.SetValue(setKey, "finishLocation", Settings.Default.finishLocation);
Registry.SetValue(setKey, "finishName", Settings.Default.finishName);
Registry.SetValue(setKey, "pbToken", Settings.Default.pbToken);
Registry.SetValue(setKey, "pbSend", Settings.Default.pbSend);
Registry.SetValue(setKey, "deleFinishFile", Settings.Default.deleFinishFile);
Registry.SetValue(setKey, "AMEPath", Settings.Default.AMEPath);
Registry.SetValue(setKey, "openAMEOnStartup", Settings.Default.openAMEOnStartup);
Registry.SetValue(setKey, "useSound", Settings.Default.useSound);
Registry.SetValue(setKey, "logFileLoc", Settings.Default.logFileLoc);
if (Settings.Default.AMEPath == "")
{
timer1.Start();
tbAMELoc.Text = "Please open the AME that the Tool is able to catch the Path.";
}
if (cbUseSound.Checked)
{
tbLocFile.Enabled = false;
tbFileName.Enabled = false;
btLocFile.Enabled = false;
label1.Enabled = false;
label2.Enabled = false;
linkLabel1.Enabled = false;
cbDelete.Enabled = false;
}
else
{
tbLocFile.Enabled = true;
tbFileName.Enabled = true;
btLocFile.Enabled = true;
label1.Enabled = true;
label2.Enabled = true;
linkLabel1.Enabled = true;
cbDelete.Enabled = true;
}
}
public string GetProcessPath(string name)
{
Process[] processes = Process.GetProcessesByName(name);
if (processes.Length > 0)
{
try { return processes[0].MainModule.FileName; }
catch { return string.Empty; }
}
else
{
return string.Empty;
}
}
#region TIMERS & ELEMENTS
private void btLocFile_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.ShowDialog();
Settings.Default.finishLocation = dialog.SelectedPath.ToString();
tbLocFile.Text = dialog.SelectedPath.ToString();
}
private void btOK_Click(object sender, EventArgs e)
{
Settings.Default.finishName = tbFileName.Text;
Settings.Default.pbToken = tbPbToken.Text;
Settings.Default.pbSend = cbPbSend.Checked;
Settings.Default.deleFinishFile = cbDelete.Checked;
Settings.Default.useSound = cbUseSound.Checked;
Settings.Default.Save();
this.Close();
}
private void btCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
MessageBox.Show("Please add to your render list in Adobe Media Encoder a project or video or what ever AT THE END of your main project(s) you want to render. The app will detect the filename of this videofile after Media Encoder started rendering out this file. This is the signat, that the computer will shut down now automaticly by the App.", "Help", MessageBoxButtons.OK);
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://www.pushbullet.com/#settings");
}
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
cPush.send(tbPbToken.Text, "AME Auto Shutdown", "Test message.");
}
private void timer1_Tick(object sender, EventArgs e)
{
Process[] process = Process.GetProcessesByName("Adobe Media Encoder");
if (process.Length > 0)
{
Settings.Default.AMEPath = GetProcessPath("Adobe Media Encoder");
tbAMELoc.Text = Settings.Default.AMEPath;
}
}
private void cbAMEStartup_CheckedChanged(object sender, EventArgs e)
{
Settings.Default.openAMEOnStartup = cbAMEStartup.Checked;
}
private void cbUseSound_CheckedChanged(object sender, EventArgs e)
{
if (cbUseSound.Checked)
{
tbLocFile.Enabled = false;
tbFileName.Enabled = false;
btLocFile.Enabled = false;
label1.Enabled = false;
label2.Enabled = false;
linkLabel1.Enabled = false;
cbDelete.Enabled = false;
}
else
{
tbLocFile.Enabled = true;
tbFileName.Enabled = true;
btLocFile.Enabled = true;
label1.Enabled = true;
label2.Enabled = true;
linkLabel1.Enabled = true;
cbDelete.Enabled = true;
}
}
private void cbDelete_CheckedChanged(object sender, EventArgs e)
{
}
private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
fSoundInfo info = new fSoundInfo();
info.ShowDialog();
}
private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.ShowDialog();
Settings.Default.logFileLoc = dialog.SelectedPath.ToString() + @"\ameautosd_logfile.txt";
tbLogLoc.Text = dialog.SelectedPath.ToString() + @"\ameautosd_logfile.txt";
}
#endregion
private void button3_Click(object sender, EventArgs e)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE", true);
var msgbox = MessageBox.Show("Do you really want to reset ALL settings for this tool?", "Reset Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (msgbox == DialogResult.Yes)
{
if (key.OpenSubKey("AMEAutoShutdown") != null)
{
key.DeleteSubKeyTree("AMEAutoShutdown");
}
Settings.Default.Reset();
Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
Application.Exit();
}
}
}
}