-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsc_exe.cs
More file actions
146 lines (135 loc) · 4.34 KB
/
Copy pathsc_exe.cs
File metadata and controls
146 lines (135 loc) · 4.34 KB
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Resources;
using System.IO;
namespace Sobreclick
{
public partial class sc_exe : Form
{
// Variables
string dir_exe;
string args_exe;
strings SC = new strings();
public static ResourceManager rm = new ResourceManager(typeof(sc_exe));
public bool activado = false;
public string args = "";
public sc_exe()
{
InitializeComponent();
}
private void btnAcpt_Click(object sender, EventArgs e)
{
switch (aceptarEjecutable())
{
case true:
this.Close();
break;
}
}
public void cancelarEjecutable()
{
activado = false;
}
public bool aceptarEjecutable()
{
dir_exe = tbDirExe.Text;
if (tbArgsExe.Enabled)
{
args_exe = tbArgsExe.Text;
}
if (dir_exe == "")
{
MessageBox.Show(rm.GetString("msgErrorBlank"), rm.GetString("msgErrorTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
else
{
sobreclick.dirProgramaScript = dir_exe;
sobreclick.argsProgramaScript = args_exe;
activado = true;
return true;
}
}
private void btnProbar_Click(object sender, EventArgs e)
{
if (tbArgsExe.Enabled)
{
args = tbArgsExe.Text;
}
else
{
args = "";
}
if (tbDirExe.Text == "")
{
MessageBox.Show(rm.GetString("msgErrorBlank"), rm.GetString("msgErrorTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (!SC.abrirScript(tbDirExe.Text, args))
{
MessageBox.Show(rm.GetString("msgErrorOpen"), rm.GetString("msgErrorTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cbArgs_CheckedChanged(object sender, EventArgs e)
{
switch (cbArgs.Checked)
{
case true:
tbArgsExe.Enabled = true;
break;
case false:
tbArgsExe.Enabled = false;
break;
}
}
private void btnCanc_Click(object sender, EventArgs e)
{
cancelarEjecutable();
this.Close();
}
private void btnExmnr_Click(object sender, EventArgs e)
{
OpenFileDialog abrirEXE = new OpenFileDialog();
abrirEXE.Title = string.Format(rm.GetString("textOFD"));
abrirEXE.Filter = string.Format(rm.GetString("textEx"));
Stream archivoEXE = null;
if (abrirEXE.ShowDialog() == DialogResult.OK)
{
try
{
if (!abrirEXE.FileName.EndsWith(".EXE") && !abrirEXE.FileName.EndsWith(".exe"))
{
MessageBox.Show(string.Format(rm.GetString("msgErrorSE")), rm.GetString("msgErrorTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if ((archivoEXE = abrirEXE.OpenFile()) != null)
{
using (archivoEXE)
{
tbDirExe.Text = abrirEXE.FileName;
}
}
}
catch (Exception)
{
MessageBox.Show(string.Format(rm.GetString("msgErrorOpen")), rm.GetString("msgErrorTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void tbDirExe_TextChanged(object sender, EventArgs e)
{
if (tbDirExe.Text != "")
{
btnProbar.Enabled = true;
}
else
{
btnProbar.Enabled = false;
}
}
}
}