Merge pull request #213 from gnh1201/dev

Adapt a code review, SRI, CORS, etc.
This commit is contained in:
Namhyeon Go 2025-03-31 17:41:01 +09:00 committed by GitHub
commit c1fe39d3cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 448 additions and 413 deletions

View File

@ -28,11 +28,11 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.gbUserDefinedVariables = new System.Windows.Forms.GroupBox();
this.listView1 = new System.Windows.Forms.ListView(); this.lvUserDefinedVariables = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.gbUpdateUserDefinedVariable = new System.Windows.Forms.GroupBox();
this.checkDeleteVariable = new System.Windows.Forms.CheckBox(); this.checkDeleteVariable = new System.Windows.Forms.CheckBox();
this.btnOk = new System.Windows.Forms.Button(); this.btnOk = new System.Windows.Forms.Button();
this.btnOpenFile = new System.Windows.Forms.Button(); this.btnOpenFile = new System.Windows.Forms.Button();
@ -41,39 +41,36 @@
this.textSetName = new System.Windows.Forms.TextBox(); this.textSetName = new System.Windows.Forms.TextBox();
this.labelSetValue = new System.Windows.Forms.Label(); this.labelSetValue = new System.Windows.Forms.Label();
this.labelSetName = new System.Windows.Forms.Label(); this.labelSetName = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.gbImportAndExport = new System.Windows.Forms.GroupBox();
this.btnExport = new System.Windows.Forms.Button(); this.btnExport = new System.Windows.Forms.Button();
this.btnImport = new System.Windows.Forms.Button(); this.btnImport = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout(); this.gbUserDefinedVariables.SuspendLayout();
this.groupBox2.SuspendLayout(); this.gbUpdateUserDefinedVariable.SuspendLayout();
this.groupBox3.SuspendLayout(); this.gbImportAndExport.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // gbUserDefinedVariables
// //
this.groupBox1.Controls.Add(this.listView1); this.gbUserDefinedVariables.Controls.Add(this.lvUserDefinedVariables);
this.groupBox1.Location = new System.Drawing.Point(17, 18); this.gbUserDefinedVariables.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.gbUserDefinedVariables.Name = "gbUserDefinedVariables";
this.groupBox1.Name = "groupBox1"; this.gbUserDefinedVariables.Size = new System.Drawing.Size(419, 170);
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.gbUserDefinedVariables.TabIndex = 0;
this.groupBox1.Size = new System.Drawing.Size(599, 255); this.gbUserDefinedVariables.TabStop = false;
this.groupBox1.TabIndex = 0; this.gbUserDefinedVariables.Text = "User-defined variables";
this.groupBox1.TabStop = false;
this.groupBox1.Text = "User-defined variables";
// //
// listView1 // lvUserDefinedVariables
// //
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvUserDefinedVariables.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1, this.columnHeader1,
this.columnHeader2}); this.columnHeader2});
this.listView1.HideSelection = false; this.lvUserDefinedVariables.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(23, 39); this.lvUserDefinedVariables.Location = new System.Drawing.Point(16, 26);
this.listView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.lvUserDefinedVariables.Name = "lvUserDefinedVariables";
this.listView1.Name = "listView1"; this.lvUserDefinedVariables.Size = new System.Drawing.Size(386, 129);
this.listView1.Size = new System.Drawing.Size(550, 192); this.lvUserDefinedVariables.TabIndex = 0;
this.listView1.TabIndex = 0; this.lvUserDefinedVariables.UseCompatibleStateImageBehavior = false;
this.listView1.UseCompatibleStateImageBehavior = false; this.lvUserDefinedVariables.SelectedIndexChanged += new System.EventHandler(this.lvUserDefinedVariables_SelectedIndexChanged);
this.listView1.SelectedIndexChanged += new System.EventHandler(this.ListView1_SelectedIndexChanged);
// //
// columnHeader1 // columnHeader1
// //
@ -83,32 +80,29 @@
// //
this.columnHeader2.Text = "Value"; this.columnHeader2.Text = "Value";
// //
// groupBox2 // gbUpdateUserDefinedVariable
// //
this.groupBox2.Controls.Add(this.checkDeleteVariable); this.gbUpdateUserDefinedVariable.Controls.Add(this.checkDeleteVariable);
this.groupBox2.Controls.Add(this.btnOk); this.gbUpdateUserDefinedVariable.Controls.Add(this.btnOk);
this.groupBox2.Controls.Add(this.btnOpenFile); this.gbUpdateUserDefinedVariable.Controls.Add(this.btnOpenFile);
this.groupBox2.Controls.Add(this.btnOpenDirectory); this.gbUpdateUserDefinedVariable.Controls.Add(this.btnOpenDirectory);
this.groupBox2.Controls.Add(this.textSetValue); this.gbUpdateUserDefinedVariable.Controls.Add(this.textSetValue);
this.groupBox2.Controls.Add(this.textSetName); this.gbUpdateUserDefinedVariable.Controls.Add(this.textSetName);
this.groupBox2.Controls.Add(this.labelSetValue); this.gbUpdateUserDefinedVariable.Controls.Add(this.labelSetValue);
this.groupBox2.Controls.Add(this.labelSetName); this.gbUpdateUserDefinedVariable.Controls.Add(this.labelSetName);
this.groupBox2.Location = new System.Drawing.Point(17, 282); this.gbUpdateUserDefinedVariable.Location = new System.Drawing.Point(12, 188);
this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.gbUpdateUserDefinedVariable.Name = "gbUpdateUserDefinedVariable";
this.groupBox2.Name = "groupBox2"; this.gbUpdateUserDefinedVariable.Size = new System.Drawing.Size(419, 229);
this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.gbUpdateUserDefinedVariable.TabIndex = 1;
this.groupBox2.Size = new System.Drawing.Size(599, 344); this.gbUpdateUserDefinedVariable.TabStop = false;
this.groupBox2.TabIndex = 1; this.gbUpdateUserDefinedVariable.Text = "Update the user-defined variable";
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Update the user-defined variable";
// //
// checkDeleteVariable // checkDeleteVariable
// //
this.checkDeleteVariable.AutoSize = true; this.checkDeleteVariable.AutoSize = true;
this.checkDeleteVariable.Location = new System.Drawing.Point(44, 132); this.checkDeleteVariable.Location = new System.Drawing.Point(31, 88);
this.checkDeleteVariable.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.checkDeleteVariable.Name = "checkDeleteVariable"; this.checkDeleteVariable.Name = "checkDeleteVariable";
this.checkDeleteVariable.Size = new System.Drawing.Size(178, 22); this.checkDeleteVariable.Size = new System.Drawing.Size(131, 16);
this.checkDeleteVariable.TabIndex = 7; this.checkDeleteVariable.TabIndex = 7;
this.checkDeleteVariable.Text = "Delete this variable"; this.checkDeleteVariable.Text = "Delete this variable";
this.checkDeleteVariable.UseVisualStyleBackColor = true; this.checkDeleteVariable.UseVisualStyleBackColor = true;
@ -116,10 +110,9 @@
// btnOk // btnOk
// //
this.btnOk.Image = global::WelsonJS.Launcher.Properties.Resources.icon_check_32; this.btnOk.Image = global::WelsonJS.Launcher.Properties.Resources.icon_check_32;
this.btnOk.Location = new System.Drawing.Point(433, 184); this.btnOk.Location = new System.Drawing.Point(303, 123);
this.btnOk.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnOk.Name = "btnOk"; this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(123, 129); this.btnOk.Size = new System.Drawing.Size(86, 86);
this.btnOk.TabIndex = 6; this.btnOk.TabIndex = 6;
this.btnOk.Text = "Ok"; this.btnOk.Text = "Ok";
this.btnOk.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.btnOk.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
@ -130,11 +123,10 @@
// //
this.btnOpenFile.Image = global::WelsonJS.Launcher.Properties.Resources.icon_file_32; this.btnOpenFile.Image = global::WelsonJS.Launcher.Properties.Resources.icon_file_32;
this.btnOpenFile.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnOpenFile.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOpenFile.Location = new System.Drawing.Point(44, 254); this.btnOpenFile.Location = new System.Drawing.Point(31, 169);
this.btnOpenFile.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnOpenFile.Name = "btnOpenFile"; this.btnOpenFile.Name = "btnOpenFile";
this.btnOpenFile.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); this.btnOpenFile.Padding = new System.Windows.Forms.Padding(11, 0, 0, 0);
this.btnOpenFile.Size = new System.Drawing.Size(287, 60); this.btnOpenFile.Size = new System.Drawing.Size(201, 40);
this.btnOpenFile.TabIndex = 5; this.btnOpenFile.TabIndex = 5;
this.btnOpenFile.Text = "Open the file..."; this.btnOpenFile.Text = "Open the file...";
this.btnOpenFile.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnOpenFile.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -146,11 +138,10 @@
// //
this.btnOpenDirectory.Image = global::WelsonJS.Launcher.Properties.Resources.icon_directory_32; this.btnOpenDirectory.Image = global::WelsonJS.Launcher.Properties.Resources.icon_directory_32;
this.btnOpenDirectory.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnOpenDirectory.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOpenDirectory.Location = new System.Drawing.Point(44, 184); this.btnOpenDirectory.Location = new System.Drawing.Point(31, 123);
this.btnOpenDirectory.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnOpenDirectory.Name = "btnOpenDirectory"; this.btnOpenDirectory.Name = "btnOpenDirectory";
this.btnOpenDirectory.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); this.btnOpenDirectory.Padding = new System.Windows.Forms.Padding(11, 0, 0, 0);
this.btnOpenDirectory.Size = new System.Drawing.Size(287, 60); this.btnOpenDirectory.Size = new System.Drawing.Size(201, 40);
this.btnOpenDirectory.TabIndex = 4; this.btnOpenDirectory.TabIndex = 4;
this.btnOpenDirectory.Text = "Open the directory..."; this.btnOpenDirectory.Text = "Open the directory...";
this.btnOpenDirectory.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnOpenDirectory.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -160,62 +151,55 @@
// //
// textSetValue // textSetValue
// //
this.textSetValue.Location = new System.Drawing.Point(140, 82); this.textSetValue.Location = new System.Drawing.Point(98, 55);
this.textSetValue.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.textSetValue.Name = "textSetValue"; this.textSetValue.Name = "textSetValue";
this.textSetValue.Size = new System.Drawing.Size(414, 28); this.textSetValue.Size = new System.Drawing.Size(291, 21);
this.textSetValue.TabIndex = 3; this.textSetValue.TabIndex = 3;
// //
// textSetName // textSetName
// //
this.textSetName.Location = new System.Drawing.Point(140, 42); this.textSetName.Location = new System.Drawing.Point(98, 28);
this.textSetName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.textSetName.Name = "textSetName"; this.textSetName.Name = "textSetName";
this.textSetName.Size = new System.Drawing.Size(414, 28); this.textSetName.Size = new System.Drawing.Size(291, 21);
this.textSetName.TabIndex = 2; this.textSetName.TabIndex = 2;
// //
// labelSetValue // labelSetValue
// //
this.labelSetValue.AutoSize = true; this.labelSetValue.AutoSize = true;
this.labelSetValue.Location = new System.Drawing.Point(41, 88); this.labelSetValue.Location = new System.Drawing.Point(29, 59);
this.labelSetValue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.labelSetValue.Name = "labelSetValue"; this.labelSetValue.Name = "labelSetValue";
this.labelSetValue.Size = new System.Drawing.Size(89, 18); this.labelSetValue.Size = new System.Drawing.Size(61, 12);
this.labelSetValue.TabIndex = 1; this.labelSetValue.TabIndex = 1;
this.labelSetValue.Text = "Set value:"; this.labelSetValue.Text = "Set value:";
// //
// labelSetName // labelSetName
// //
this.labelSetName.AutoSize = true; this.labelSetName.AutoSize = true;
this.labelSetName.Location = new System.Drawing.Point(41, 46); this.labelSetName.Location = new System.Drawing.Point(29, 31);
this.labelSetName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.labelSetName.Name = "labelSetName"; this.labelSetName.Name = "labelSetName";
this.labelSetName.Size = new System.Drawing.Size(91, 18); this.labelSetName.Size = new System.Drawing.Size(63, 12);
this.labelSetName.TabIndex = 0; this.labelSetName.TabIndex = 0;
this.labelSetName.Text = "Set name:"; this.labelSetName.Text = "Set name:";
// //
// groupBox3 // gbImportAndExport
// //
this.groupBox3.Controls.Add(this.btnExport); this.gbImportAndExport.Controls.Add(this.btnExport);
this.groupBox3.Controls.Add(this.btnImport); this.gbImportAndExport.Controls.Add(this.btnImport);
this.groupBox3.Location = new System.Drawing.Point(17, 634); this.gbImportAndExport.Location = new System.Drawing.Point(12, 423);
this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.gbImportAndExport.Name = "gbImportAndExport";
this.groupBox3.Name = "groupBox3"; this.gbImportAndExport.Size = new System.Drawing.Size(419, 89);
this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.gbImportAndExport.TabIndex = 2;
this.groupBox3.Size = new System.Drawing.Size(599, 134); this.gbImportAndExport.TabStop = false;
this.groupBox3.TabIndex = 2; this.gbImportAndExport.Text = "Import and export";
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Import and export";
// //
// btnExport // btnExport
// //
this.btnExport.Image = global::WelsonJS.Launcher.Properties.Resources.icon_export_32; this.btnExport.Image = global::WelsonJS.Launcher.Properties.Resources.icon_export_32;
this.btnExport.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnExport.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnExport.Location = new System.Drawing.Point(304, 44); this.btnExport.Location = new System.Drawing.Point(213, 29);
this.btnExport.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnExport.Name = "btnExport"; this.btnExport.Name = "btnExport";
this.btnExport.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); this.btnExport.Padding = new System.Windows.Forms.Padding(11, 0, 0, 0);
this.btnExport.Size = new System.Drawing.Size(251, 60); this.btnExport.Size = new System.Drawing.Size(176, 40);
this.btnExport.TabIndex = 6; this.btnExport.TabIndex = 6;
this.btnExport.Text = "Export"; this.btnExport.Text = "Export";
this.btnExport.UseVisualStyleBackColor = true; this.btnExport.UseVisualStyleBackColor = true;
@ -225,11 +209,10 @@
// //
this.btnImport.Image = global::WelsonJS.Launcher.Properties.Resources.icon_import_32; this.btnImport.Image = global::WelsonJS.Launcher.Properties.Resources.icon_import_32;
this.btnImport.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnImport.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnImport.Location = new System.Drawing.Point(44, 44); this.btnImport.Location = new System.Drawing.Point(31, 29);
this.btnImport.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnImport.Name = "btnImport"; this.btnImport.Name = "btnImport";
this.btnImport.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); this.btnImport.Padding = new System.Windows.Forms.Padding(11, 0, 0, 0);
this.btnImport.Size = new System.Drawing.Size(251, 60); this.btnImport.Size = new System.Drawing.Size(176, 40);
this.btnImport.TabIndex = 5; this.btnImport.TabIndex = 5;
this.btnImport.Text = "Import"; this.btnImport.Text = "Import";
this.btnImport.UseVisualStyleBackColor = true; this.btnImport.UseVisualStyleBackColor = true;
@ -237,30 +220,29 @@
// //
// EnvForm // EnvForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 18F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(639, 794); this.ClientSize = new System.Drawing.Size(447, 529);
this.Controls.Add(this.groupBox3); this.Controls.Add(this.gbImportAndExport);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.gbUpdateUserDefinedVariable);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.gbUserDefinedVariables);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = global::WelsonJS.Launcher.Properties.Resources.favicon; this.Icon = global::WelsonJS.Launcher.Properties.Resources.favicon;
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "EnvForm"; this.Name = "EnvForm";
this.Text = "User-defined variables editor"; this.Text = "User-defined variables editor";
this.groupBox1.ResumeLayout(false); this.gbUserDefinedVariables.ResumeLayout(false);
this.groupBox2.ResumeLayout(false); this.gbUpdateUserDefinedVariable.ResumeLayout(false);
this.groupBox2.PerformLayout(); this.gbUpdateUserDefinedVariable.PerformLayout();
this.groupBox3.ResumeLayout(false); this.gbImportAndExport.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox gbUserDefinedVariables;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox gbUpdateUserDefinedVariable;
private System.Windows.Forms.TextBox textSetValue; private System.Windows.Forms.TextBox textSetValue;
private System.Windows.Forms.TextBox textSetName; private System.Windows.Forms.TextBox textSetName;
private System.Windows.Forms.Label labelSetValue; private System.Windows.Forms.Label labelSetValue;
@ -269,10 +251,10 @@
private System.Windows.Forms.Button btnOpenFile; private System.Windows.Forms.Button btnOpenFile;
private System.Windows.Forms.Button btnOpenDirectory; private System.Windows.Forms.Button btnOpenDirectory;
private System.Windows.Forms.CheckBox checkDeleteVariable; private System.Windows.Forms.CheckBox checkDeleteVariable;
private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ListView lvUserDefinedVariables;
private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2; private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox gbImportAndExport;
private System.Windows.Forms.Button btnImport; private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnExport; private System.Windows.Forms.Button btnExport;
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace WelsonJS.Launcher namespace WelsonJS.Launcher
@ -9,6 +10,7 @@ namespace WelsonJS.Launcher
{ {
private Dictionary<string, string> userVariables = new Dictionary<string, string>(); private Dictionary<string, string> userVariables = new Dictionary<string, string>();
private string tempFilePath; private string tempFilePath;
private readonly Encoding defaultEncoding = Encoding.UTF8;
public EnvForm() public EnvForm()
{ {
@ -24,11 +26,11 @@ namespace WelsonJS.Launcher
// Initialize ListView // Initialize ListView
private void InitializeListView() private void InitializeListView()
{ {
listView1.View = View.Details; lvUserDefinedVariables.View = View.Details;
listView1.FullRowSelect = true; lvUserDefinedVariables.FullRowSelect = true;
listView1.Columns[0].Width = 150; lvUserDefinedVariables.Columns[0].Width = 150;
listView1.Columns[1].Width = 220; lvUserDefinedVariables.Columns[1].Width = 220;
listView1.SelectedIndexChanged += ListView1_SelectedIndexChanged; lvUserDefinedVariables.SelectedIndexChanged += lvUserDefinedVariables_SelectedIndexChanged;
} }
// Load user-defined variables from the temporary folder in .env format // Load user-defined variables from the temporary folder in .env format
@ -86,21 +88,21 @@ namespace WelsonJS.Launcher
// Update ListView with current variables // Update ListView with current variables
private void UpdateListView() private void UpdateListView()
{ {
listView1.Items.Clear(); lvUserDefinedVariables.Items.Clear();
foreach (var variable in userVariables) foreach (var variable in userVariables)
{ {
var item = new ListViewItem(variable.Key); var item = new ListViewItem(variable.Key);
item.SubItems.Add(variable.Value); item.SubItems.Add(variable.Value);
listView1.Items.Add(item); lvUserDefinedVariables.Items.Add(item);
} }
} }
// Handle ListView selection change // Handle ListView selection change
private void ListView1_SelectedIndexChanged(object sender, EventArgs e) private void lvUserDefinedVariables_SelectedIndexChanged(object sender, EventArgs e)
{ {
if (listView1.SelectedItems.Count > 0) if (lvUserDefinedVariables.SelectedItems.Count > 0)
{ {
var selectedItem = listView1.SelectedItems[0]; var selectedItem = lvUserDefinedVariables.SelectedItems[0];
textSetName.Text = selectedItem.Text; textSetName.Text = selectedItem.Text;
textSetValue.Text = selectedItem.SubItems[1].Text; textSetValue.Text = selectedItem.SubItems[1].Text;
checkDeleteVariable.Checked = false; checkDeleteVariable.Checked = false;
@ -166,7 +168,7 @@ namespace WelsonJS.Launcher
} }
// Write lines to the file // Write lines to the file
File.WriteAllLines(tempFilePath, lines); File.WriteAllLines(tempFilePath, lines, defaultEncoding);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -185,27 +187,32 @@ namespace WelsonJS.Launcher
// Handle "Open Directory" button click // Handle "Open Directory" button click
private void btnOpenDirectory_Click(object sender, EventArgs e) private void btnOpenDirectory_Click(object sender, EventArgs e)
{ {
var folderDialog = new FolderBrowserDialog(); using (var folderDialog = new FolderBrowserDialog())
{
if (folderDialog.ShowDialog() == DialogResult.OK) if (folderDialog.ShowDialog() == DialogResult.OK)
{ {
textSetValue.Text = folderDialog.SelectedPath; textSetValue.Text = folderDialog.SelectedPath;
} }
} }
}
// Handle "Open File" button click // Handle "Open File" button click
private void btnOpenFile_Click(object sender, EventArgs e) private void btnOpenFile_Click(object sender, EventArgs e)
{ {
var fileDialog = new OpenFileDialog(); using (var fileDialog = new OpenFileDialog())
{
if (fileDialog.ShowDialog() == DialogResult.OK) if (fileDialog.ShowDialog() == DialogResult.OK)
{ {
textSetName.Text = Path.GetFileName(fileDialog.FileName); textSetName.Text = Path.GetFileName(fileDialog.FileName);
textSetValue.Text = fileDialog.FileName; textSetValue.Text = fileDialog.FileName;
} }
} }
}
private void btnImport_Click(object sender, EventArgs e) private void btnImport_Click(object sender, EventArgs e)
{ {
OpenFileDialog openFileDialog = new OpenFileDialog(); using (var openFileDialog = new OpenFileDialog())
{
openFileDialog.Filter = "Env files (*.env)|*.env|All files (*.*)|*.*"; openFileDialog.Filter = "Env files (*.env)|*.env|All files (*.*)|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK) if (openFileDialog.ShowDialog() == DialogResult.OK)
{ {
@ -213,7 +220,7 @@ namespace WelsonJS.Launcher
{ {
// Load variables from the selected file // Load variables from the selected file
string filePath = openFileDialog.FileName; string filePath = openFileDialog.FileName;
string[] lines = File.ReadAllLines(filePath); string[] lines = File.ReadAllLines(filePath, defaultEncoding);
foreach (string line in lines) foreach (string line in lines)
{ {
@ -250,6 +257,7 @@ namespace WelsonJS.Launcher
} }
} }
} }
}
private void btnExport_Click(object sender, EventArgs e) private void btnExport_Click(object sender, EventArgs e)
{ {
@ -275,7 +283,7 @@ namespace WelsonJS.Launcher
lines.Add($"{variable.Key}={value}"); lines.Add($"{variable.Key}={value}");
} }
File.WriteAllLines(filePath, lines); File.WriteAllLines(filePath, lines, defaultEncoding);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -28,62 +28,62 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.gbMaxScriptStatements = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button(); this.btnOkMaxScriptStatements = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox(); this.txtMaxScriptStatements = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout(); this.gbMaxScriptStatements.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // gbMaxScriptStatements
// //
this.groupBox1.Controls.Add(this.button1); this.gbMaxScriptStatements.Controls.Add(this.btnOkMaxScriptStatements);
this.groupBox1.Controls.Add(this.textBox1); this.gbMaxScriptStatements.Controls.Add(this.txtMaxScriptStatements);
this.groupBox1.Location = new System.Drawing.Point(12, 12); this.gbMaxScriptStatements.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1"; this.gbMaxScriptStatements.Name = "gbMaxScriptStatements";
this.groupBox1.Size = new System.Drawing.Size(290, 67); this.gbMaxScriptStatements.Size = new System.Drawing.Size(290, 67);
this.groupBox1.TabIndex = 0; this.gbMaxScriptStatements.TabIndex = 0;
this.groupBox1.TabStop = false; this.gbMaxScriptStatements.TabStop = false;
this.groupBox1.Text = "MaxScriptStatements (GUI only)"; this.gbMaxScriptStatements.Text = "MaxScriptStatements (GUI only)";
// //
// button1 // btnOkMaxScriptStatements
// //
this.button1.Location = new System.Drawing.Point(218, 30); this.btnOkMaxScriptStatements.Location = new System.Drawing.Point(218, 30);
this.button1.Name = "button1"; this.btnOkMaxScriptStatements.Name = "btnOkMaxScriptStatements";
this.button1.Size = new System.Drawing.Size(57, 21); this.btnOkMaxScriptStatements.Size = new System.Drawing.Size(57, 21);
this.button1.TabIndex = 1; this.btnOkMaxScriptStatements.TabIndex = 1;
this.button1.Text = "Ok"; this.btnOkMaxScriptStatements.Text = "Ok";
this.button1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.btnOkMaxScriptStatements.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.button1.UseVisualStyleBackColor = true; this.btnOkMaxScriptStatements.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.btnOkMaxScriptStatements.Click += new System.EventHandler(this.btnOkMaxScriptStatements_Click);
// //
// textBox1 // txtMaxScriptStatements
// //
this.textBox1.Location = new System.Drawing.Point(15, 30); this.txtMaxScriptStatements.Location = new System.Drawing.Point(15, 30);
this.textBox1.Name = "textBox1"; this.txtMaxScriptStatements.Name = "txtMaxScriptStatements";
this.textBox1.Size = new System.Drawing.Size(197, 21); this.txtMaxScriptStatements.Size = new System.Drawing.Size(197, 21);
this.textBox1.TabIndex = 1; this.txtMaxScriptStatements.TabIndex = 1;
// //
// GlobalSettingsForm // GlobalSettingsForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(315, 92); this.ClientSize = new System.Drawing.Size(315, 92);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.gbMaxScriptStatements);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = global::WelsonJS.Launcher.Properties.Resources.favicon; this.Icon = global::WelsonJS.Launcher.Properties.Resources.favicon;
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "GlobalSettingsForm"; this.Name = "GlobalSettingsForm";
this.Text = "Global settings..."; this.Text = "Global settings...";
this.groupBox1.ResumeLayout(false); this.gbMaxScriptStatements.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.gbMaxScriptStatements.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox gbMaxScriptStatements;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox txtMaxScriptStatements;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button btnOkMaxScriptStatements;
} }
} }

View File

@ -21,22 +21,24 @@ namespace WelsonJS.Launcher
{ {
if (key != null) if (key != null)
{ {
object value = key.GetValue(RegistryKey); string value = key.GetValue(RegistryKey)?.ToString();
if (value != null && value is int maxStatements) if (value != null && int.TryParse(value, out int maxStatements))
{ {
textBox1.Text = maxStatements.ToString(); txtMaxScriptStatements.Text = maxStatements.ToString();
} }
} }
} }
} }
private void button1_Click(object sender, EventArgs e) private void btnOkMaxScriptStatements_Click(object sender, EventArgs e)
{ {
if (uint.TryParse(textBox1.Text, out uint maxStatements)) try
{
if (int.TryParse(txtMaxScriptStatements.Text, out int maxStatements))
{ {
using (RegistryKey key = Registry.CurrentUser.CreateSubKey(RegistryPath)) using (RegistryKey key = Registry.CurrentUser.CreateSubKey(RegistryPath))
{ {
key.SetValue(RegistryKey, (int)maxStatements, RegistryValueKind.DWord); key.SetValue(RegistryKey, maxStatements, RegistryValueKind.DWord);
} }
MessageBox.Show($"MaxScriptStatements setting has been changed to {maxStatements}.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show($"MaxScriptStatements setting has been changed to {maxStatements}.", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
@ -45,5 +47,10 @@ namespace WelsonJS.Launcher
MessageBox.Show("Please enter a valid number within the DWORD range.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Please enter a valid number within the DWORD range.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
catch (Exception ex)
{
MessageBox.Show($"An error occurred while trying to change the MaxScriptStatements setting: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
} }
} }

View File

@ -28,46 +28,48 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.listView1 = new System.Windows.Forms.ListView(); this.lvInstances = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chInstanceId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chFirstDeployTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnDelete = new System.Windows.Forms.Button(); this.btnDelete = new System.Windows.Forms.Button();
this.btnOpenWithExplorer = new System.Windows.Forms.Button(); this.btnOpenWithExplorer = new System.Windows.Forms.Button();
this.checkBox2 = new System.Windows.Forms.CheckBox(); this.cbInteractiveServiceApp = new System.Windows.Forms.CheckBox();
this.textBox1 = new System.Windows.Forms.TextBox(); this.txtUseSpecificScript = new System.Windows.Forms.TextBox();
this.checkBox1 = new System.Windows.Forms.CheckBox(); this.cbUseSpecificScript = new System.Windows.Forms.CheckBox();
this.btnStart = new System.Windows.Forms.Button(); this.btnStart = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// listView1 // lvInstances
// //
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvInstances.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1, this.chInstanceId,
this.columnHeader2}); this.chFirstDeployTime});
this.listView1.HideSelection = false; this.lvInstances.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(12, 12); this.lvInstances.Location = new System.Drawing.Point(8, 8);
this.listView1.Name = "listView1"; this.lvInstances.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.listView1.Size = new System.Drawing.Size(547, 253); this.lvInstances.Name = "lvInstances";
this.listView1.TabIndex = 0; this.lvInstances.Size = new System.Drawing.Size(384, 170);
this.listView1.UseCompatibleStateImageBehavior = false; this.lvInstances.TabIndex = 0;
this.listView1.View = System.Windows.Forms.View.Details; this.lvInstances.UseCompatibleStateImageBehavior = false;
this.lvInstances.View = System.Windows.Forms.View.Details;
// //
// columnHeader1 // chInstanceId
// //
this.columnHeader1.Text = "Instance ID"; this.chInstanceId.Text = "Instance ID";
this.columnHeader1.Width = 220; this.chInstanceId.Width = 220;
// //
// columnHeader2 // chFirstDeployTime
// //
this.columnHeader2.Text = "First Deploy Time"; this.chFirstDeployTime.Text = "First Deploy Time";
this.columnHeader2.Width = 160; this.chFirstDeployTime.Width = 160;
// //
// btnDelete // btnDelete
// //
this.btnDelete.Image = global::WelsonJS.Launcher.Properties.Resources.icon_delete_32; this.btnDelete.Image = global::WelsonJS.Launcher.Properties.Resources.icon_delete_32;
this.btnDelete.Location = new System.Drawing.Point(171, 364); this.btnDelete.Location = new System.Drawing.Point(120, 243);
this.btnDelete.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnDelete.Name = "btnDelete"; this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(150, 60); this.btnDelete.Size = new System.Drawing.Size(105, 40);
this.btnDelete.TabIndex = 2; this.btnDelete.TabIndex = 2;
this.btnDelete.Text = "Delete"; this.btnDelete.Text = "Delete";
this.btnDelete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.btnDelete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
@ -77,53 +79,52 @@
// btnOpenWithExplorer // btnOpenWithExplorer
// //
this.btnOpenWithExplorer.Image = global::WelsonJS.Launcher.Properties.Resources.icon_directory_32; this.btnOpenWithExplorer.Image = global::WelsonJS.Launcher.Properties.Resources.icon_directory_32;
this.btnOpenWithExplorer.Location = new System.Drawing.Point(327, 364); this.btnOpenWithExplorer.Location = new System.Drawing.Point(229, 243);
this.btnOpenWithExplorer.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnOpenWithExplorer.Name = "btnOpenWithExplorer"; this.btnOpenWithExplorer.Name = "btnOpenWithExplorer";
this.btnOpenWithExplorer.Size = new System.Drawing.Size(232, 60); this.btnOpenWithExplorer.Size = new System.Drawing.Size(162, 40);
this.btnOpenWithExplorer.TabIndex = 3; this.btnOpenWithExplorer.TabIndex = 3;
this.btnOpenWithExplorer.Text = "Open with Explorer"; this.btnOpenWithExplorer.Text = "Open with Explorer";
this.btnOpenWithExplorer.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.btnOpenWithExplorer.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnOpenWithExplorer.UseVisualStyleBackColor = true; this.btnOpenWithExplorer.UseVisualStyleBackColor = true;
this.btnOpenWithExplorer.Click += new System.EventHandler(this.btnOpenWithExplorer_Click); this.btnOpenWithExplorer.Click += new System.EventHandler(this.btnOpenWithExplorer_Click);
// //
// checkBox2 // cbInteractiveServiceApp
// //
this.checkBox2.AutoSize = true; this.cbInteractiveServiceApp.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(15, 322); this.cbInteractiveServiceApp.Location = new System.Drawing.Point(10, 215);
this.checkBox2.Margin = new System.Windows.Forms.Padding(4); this.cbInteractiveServiceApp.Name = "cbInteractiveServiceApp";
this.checkBox2.Name = "checkBox2"; this.cbInteractiveServiceApp.Size = new System.Drawing.Size(254, 16);
this.checkBox2.Size = new System.Drawing.Size(352, 22); this.cbInteractiveServiceApp.TabIndex = 9;
this.checkBox2.TabIndex = 9; this.cbInteractiveServiceApp.Text = "This is an Interactive Service Application";
this.checkBox2.Text = "This is an Interactive Service Application"; this.cbInteractiveServiceApp.UseVisualStyleBackColor = true;
this.checkBox2.UseVisualStyleBackColor = true;
// //
// textBox1 // txtUseSpecificScript
// //
this.textBox1.Enabled = false; this.txtUseSpecificScript.Enabled = false;
this.textBox1.Location = new System.Drawing.Point(284, 283); this.txtUseSpecificScript.Location = new System.Drawing.Point(199, 189);
this.textBox1.Margin = new System.Windows.Forms.Padding(4); this.txtUseSpecificScript.Name = "txtUseSpecificScript";
this.textBox1.Name = "textBox1"; this.txtUseSpecificScript.Size = new System.Drawing.Size(110, 21);
this.textBox1.Size = new System.Drawing.Size(155, 28); this.txtUseSpecificScript.TabIndex = 8;
this.textBox1.TabIndex = 8;
// //
// checkBox1 // cbUseSpecificScript
// //
this.checkBox1.AutoSize = true; this.cbUseSpecificScript.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(15, 288); this.cbUseSpecificScript.Location = new System.Drawing.Point(10, 192);
this.checkBox1.Margin = new System.Windows.Forms.Padding(4); this.cbUseSpecificScript.Name = "cbUseSpecificScript";
this.checkBox1.Name = "checkBox1"; this.cbUseSpecificScript.Size = new System.Drawing.Size(184, 16);
this.checkBox1.Size = new System.Drawing.Size(256, 22); this.cbUseSpecificScript.TabIndex = 7;
this.checkBox1.TabIndex = 7; this.cbUseSpecificScript.Text = "I want to use specific script ";
this.checkBox1.Text = "I want to use specific script "; this.cbUseSpecificScript.UseVisualStyleBackColor = true;
this.checkBox1.UseVisualStyleBackColor = true; this.cbUseSpecificScript.CheckedChanged += new System.EventHandler(this.cbUseSpecificScript_CheckedChanged);
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
// //
// btnStart // btnStart
// //
this.btnStart.Image = global::WelsonJS.Launcher.Properties.Resources.icon_start_32; this.btnStart.Image = global::WelsonJS.Launcher.Properties.Resources.icon_start_32;
this.btnStart.Location = new System.Drawing.Point(15, 364); this.btnStart.Location = new System.Drawing.Point(10, 243);
this.btnStart.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnStart.Name = "btnStart"; this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(150, 60); this.btnStart.Size = new System.Drawing.Size(105, 40);
this.btnStart.TabIndex = 1; this.btnStart.TabIndex = 1;
this.btnStart.Text = "Start"; this.btnStart.Text = "Start";
this.btnStart.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.btnStart.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
@ -132,18 +133,19 @@
// //
// InstancesForm // InstancesForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 18F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(573, 444); this.ClientSize = new System.Drawing.Size(401, 296);
this.Controls.Add(this.btnStart); this.Controls.Add(this.btnStart);
this.Controls.Add(this.listView1); this.Controls.Add(this.lvInstances);
this.Controls.Add(this.btnDelete); this.Controls.Add(this.btnDelete);
this.Controls.Add(this.checkBox1); this.Controls.Add(this.cbUseSpecificScript);
this.Controls.Add(this.checkBox2); this.Controls.Add(this.cbInteractiveServiceApp);
this.Controls.Add(this.btnOpenWithExplorer); this.Controls.Add(this.btnOpenWithExplorer);
this.Controls.Add(this.textBox1); this.Controls.Add(this.txtUseSpecificScript);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = global::WelsonJS.Launcher.Properties.Resources.favicon; this.Icon = global::WelsonJS.Launcher.Properties.Resources.favicon;
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "InstancesForm"; this.Name = "InstancesForm";
this.Text = "Instances"; this.Text = "Instances";
@ -155,14 +157,14 @@
#endregion #endregion
private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ListView lvInstances;
private System.Windows.Forms.Button btnDelete; private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnOpenWithExplorer; private System.Windows.Forms.Button btnOpenWithExplorer;
private System.Windows.Forms.CheckBox checkBox2; private System.Windows.Forms.CheckBox cbInteractiveServiceApp;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox txtUseSpecificScript;
private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.CheckBox cbUseSpecificScript;
private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader chInstanceId;
private System.Windows.Forms.ColumnHeader columnHeader2; private System.Windows.Forms.ColumnHeader chFirstDeployTime;
private System.Windows.Forms.Button btnStart; private System.Windows.Forms.Button btnStart;
} }
} }

View File

@ -20,7 +20,7 @@ namespace WelsonJS.Launcher
private void InstancesForm_Load(object sender, EventArgs e) private void InstancesForm_Load(object sender, EventArgs e)
{ {
listView1.Items.Clear(); lvInstances.Items.Clear();
LoadInstances(Program.GetAppDataPath()); LoadInstances(Program.GetAppDataPath());
LoadInstances(Path.GetTempPath()); LoadInstances(Path.GetTempPath());
} }
@ -48,7 +48,7 @@ namespace WelsonJS.Launcher
if (firstDeployTime != null) if (firstDeployTime != null)
{ {
listView1.Items.Add(new ListViewItem(new[] lvInstances.Items.Add(new ListViewItem(new[]
{ {
Path.GetFileName(dir), Path.GetFileName(dir),
firstDeployTime firstDeployTime
@ -62,11 +62,11 @@ namespace WelsonJS.Launcher
private void btnStart_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e)
{ {
if (listView1.SelectedItems.Count > 0) if (lvInstances.SelectedItems.Count > 0)
{ {
scriptName = textBox1.Text; scriptName = txtUseSpecificScript.Text;
string instanceId = listView1.SelectedItems[0].Text; string instanceId = lvInstances.SelectedItems[0].Text;
string workingDirectory = Program.GetWorkingDirectory(instanceId, true); string workingDirectory = Program.GetWorkingDirectory(instanceId, true);
Task.Run(() => Task.Run(() =>
@ -74,7 +74,7 @@ namespace WelsonJS.Launcher
try try
{ {
// Run the appliction // Run the appliction
Program.RunCommandPrompt(workingDirectory, entryFileName, scriptName, checkBox1.Checked, checkBox2.Checked); Program.RunCommandPrompt(workingDirectory, entryFileName, scriptName, cbUseSpecificScript.Checked, cbInteractiveServiceApp.Checked);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -90,9 +90,9 @@ namespace WelsonJS.Launcher
private void btnDelete_Click(object sender, EventArgs e) private void btnDelete_Click(object sender, EventArgs e)
{ {
if (listView1.SelectedItems.Count > 0) if (lvInstances.SelectedItems.Count > 0)
{ {
string instanceId = listView1.SelectedItems[0].Text; string instanceId = lvInstances.SelectedItems[0].Text;
string workingDirectory = Program.GetWorkingDirectory(instanceId, false); string workingDirectory = Program.GetWorkingDirectory(instanceId, false);
if (!Directory.Exists(workingDirectory)) if (!Directory.Exists(workingDirectory))
@ -104,7 +104,7 @@ namespace WelsonJS.Launcher
{ {
Directory.Delete(workingDirectory, true); Directory.Delete(workingDirectory, true);
listView1.Items.Clear(); lvInstances.Items.Clear();
LoadInstances(Program.GetAppDataPath()); LoadInstances(Program.GetAppDataPath());
LoadInstances(Path.GetTempPath()); LoadInstances(Path.GetTempPath());
} }
@ -117,9 +117,9 @@ namespace WelsonJS.Launcher
private void btnOpenWithExplorer_Click(object sender, EventArgs e) private void btnOpenWithExplorer_Click(object sender, EventArgs e)
{ {
if (listView1.SelectedItems.Count > 0) if (lvInstances.SelectedItems.Count > 0)
{ {
string instanceId = listView1.SelectedItems[0].Text; string instanceId = lvInstances.SelectedItems[0].Text;
string workingDirectory = Program.GetWorkingDirectory(instanceId, true); string workingDirectory = Program.GetWorkingDirectory(instanceId, true);
if (Directory.Exists(workingDirectory)) if (Directory.Exists(workingDirectory))
@ -133,9 +133,9 @@ namespace WelsonJS.Launcher
} }
} }
private void checkBox1_CheckedChanged(object sender, EventArgs e) private void cbUseSpecificScript_CheckedChanged(object sender, EventArgs e)
{ {
textBox1.Enabled = checkBox1.Checked; txtUseSpecificScript.Enabled = cbUseSpecificScript.Checked;
} }
} }
} }

View File

@ -29,13 +29,13 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button(); this.btnRunFromZipFile = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.btnRunFromExternalLink = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.checkBox1 = new System.Windows.Forms.CheckBox(); this.cbUseSpecificScript = new System.Windows.Forms.CheckBox();
this.textBox1 = new System.Windows.Forms.TextBox(); this.txtUseSpecificScript = new System.Windows.Forms.TextBox();
this.checkBox2 = new System.Windows.Forms.CheckBox(); this.cbInteractiveServiceApp = new System.Windows.Forms.CheckBox();
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.userdefinedVariablesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.userdefinedVariablesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -43,7 +43,7 @@
this.runAsAdministratorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.runAsAdministratorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.globalSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.globalSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.startCodeEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.startCodeEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openMicrosoftCopilotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openCopilotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.openLauncherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openLauncherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -53,29 +53,29 @@
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // btnRunFromZipFile
// //
this.button1.Image = global::WelsonJS.Launcher.Properties.Resources.icon_zip_128; this.btnRunFromZipFile.Image = global::WelsonJS.Launcher.Properties.Resources.icon_zip_128;
this.button1.Location = new System.Drawing.Point(24, 67); this.btnRunFromZipFile.Location = new System.Drawing.Point(24, 67);
this.button1.Name = "button1"; this.btnRunFromZipFile.Name = "btnRunFromZipFile";
this.button1.Size = new System.Drawing.Size(200, 200); this.btnRunFromZipFile.Size = new System.Drawing.Size(200, 200);
this.button1.TabIndex = 0; this.btnRunFromZipFile.TabIndex = 0;
this.button1.Text = "From ZIP file..."; this.btnRunFromZipFile.Text = "From ZIP file...";
this.button1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.btnRunFromZipFile.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.button1.UseVisualStyleBackColor = true; this.btnRunFromZipFile.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.btnRunFromZipFile.Click += new System.EventHandler(this.btnRunFromZipFile_Click);
// //
// button2 // btnRunFromExternalLink
// //
this.button2.Image = global::WelsonJS.Launcher.Properties.Resources.icon_link_128; this.btnRunFromExternalLink.Image = global::WelsonJS.Launcher.Properties.Resources.icon_link_128;
this.button2.Location = new System.Drawing.Point(230, 67); this.btnRunFromExternalLink.Location = new System.Drawing.Point(230, 67);
this.button2.Name = "button2"; this.btnRunFromExternalLink.Name = "btnRunFromExternalLink";
this.button2.Size = new System.Drawing.Size(200, 200); this.btnRunFromExternalLink.Size = new System.Drawing.Size(200, 200);
this.button2.TabIndex = 1; this.btnRunFromExternalLink.TabIndex = 1;
this.button2.Text = "From external link..."; this.btnRunFromExternalLink.Text = "From external link...";
this.button2.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.btnRunFromExternalLink.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.button2.UseVisualStyleBackColor = true; this.btnRunFromExternalLink.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click); this.btnRunFromExternalLink.Click += new System.EventHandler(this.btnRunFromExternalLink_Click);
// //
// label1 // label1
// //
@ -97,34 +97,34 @@
this.linkLabel1.Text = "https://github.com/gnh1201/welsonjs"; this.linkLabel1.Text = "https://github.com/gnh1201/welsonjs";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
// //
// checkBox1 // cbUseSpecificScript
// //
this.checkBox1.AutoSize = true; this.cbUseSpecificScript.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(26, 281); this.cbUseSpecificScript.Location = new System.Drawing.Point(26, 281);
this.checkBox1.Name = "checkBox1"; this.cbUseSpecificScript.Name = "cbUseSpecificScript";
this.checkBox1.Size = new System.Drawing.Size(184, 16); this.cbUseSpecificScript.Size = new System.Drawing.Size(184, 16);
this.checkBox1.TabIndex = 4; this.cbUseSpecificScript.TabIndex = 4;
this.checkBox1.Text = "I want to use specific script "; this.cbUseSpecificScript.Text = "I want to use specific script ";
this.checkBox1.UseVisualStyleBackColor = true; this.cbUseSpecificScript.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); this.cbUseSpecificScript.CheckedChanged += new System.EventHandler(this.cbUseSpecificScript_CheckedChanged);
// //
// textBox1 // txtUseSpecificScript
// //
this.textBox1.Enabled = false; this.txtUseSpecificScript.Enabled = false;
this.textBox1.Location = new System.Drawing.Point(214, 278); this.txtUseSpecificScript.Location = new System.Drawing.Point(214, 278);
this.textBox1.Name = "textBox1"; this.txtUseSpecificScript.Name = "txtUseSpecificScript";
this.textBox1.Size = new System.Drawing.Size(110, 21); this.txtUseSpecificScript.Size = new System.Drawing.Size(110, 21);
this.textBox1.TabIndex = 5; this.txtUseSpecificScript.TabIndex = 5;
// //
// checkBox2 // cbInteractiveServiceApp
// //
this.checkBox2.AutoSize = true; this.cbInteractiveServiceApp.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(26, 305); this.cbInteractiveServiceApp.Location = new System.Drawing.Point(26, 305);
this.checkBox2.Name = "checkBox2"; this.cbInteractiveServiceApp.Name = "cbInteractiveServiceApp";
this.checkBox2.Size = new System.Drawing.Size(254, 16); this.cbInteractiveServiceApp.Size = new System.Drawing.Size(254, 16);
this.checkBox2.TabIndex = 6; this.cbInteractiveServiceApp.TabIndex = 6;
this.checkBox2.Text = "This is an Interactive Service Application"; this.cbInteractiveServiceApp.Text = "This is an Interactive Service Application";
this.checkBox2.UseVisualStyleBackColor = true; this.cbInteractiveServiceApp.UseVisualStyleBackColor = true;
// //
// menuStrip1 // menuStrip1
// //
@ -144,7 +144,7 @@
this.runAsAdministratorToolStripMenuItem, this.runAsAdministratorToolStripMenuItem,
this.globalSettingsToolStripMenuItem, this.globalSettingsToolStripMenuItem,
this.startCodeEditorToolStripMenuItem, this.startCodeEditorToolStripMenuItem,
this.openMicrosoftCopilotToolStripMenuItem}); this.openCopilotToolStripMenuItem});
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(62, 20); this.settingsToolStripMenuItem.Size = new System.Drawing.Size(62, 20);
this.settingsToolStripMenuItem.Text = "Settings"; this.settingsToolStripMenuItem.Text = "Settings";
@ -152,44 +152,44 @@
// userdefinedVariablesToolStripMenuItem // userdefinedVariablesToolStripMenuItem
// //
this.userdefinedVariablesToolStripMenuItem.Name = "userdefinedVariablesToolStripMenuItem"; this.userdefinedVariablesToolStripMenuItem.Name = "userdefinedVariablesToolStripMenuItem";
this.userdefinedVariablesToolStripMenuItem.Size = new System.Drawing.Size(210, 22); this.userdefinedVariablesToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.userdefinedVariablesToolStripMenuItem.Text = "User-defined variables"; this.userdefinedVariablesToolStripMenuItem.Text = "User-defined variables";
this.userdefinedVariablesToolStripMenuItem.Click += new System.EventHandler(this.userdefinedVariablesToolStripMenuItem_Click); this.userdefinedVariablesToolStripMenuItem.Click += new System.EventHandler(this.userdefinedVariablesToolStripMenuItem_Click);
// //
// instancesToolStripMenuItem // instancesToolStripMenuItem
// //
this.instancesToolStripMenuItem.Name = "instancesToolStripMenuItem"; this.instancesToolStripMenuItem.Name = "instancesToolStripMenuItem";
this.instancesToolStripMenuItem.Size = new System.Drawing.Size(210, 22); this.instancesToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.instancesToolStripMenuItem.Text = "Instances"; this.instancesToolStripMenuItem.Text = "Instances";
this.instancesToolStripMenuItem.Click += new System.EventHandler(this.instancesToolStripMenuItem_Click); this.instancesToolStripMenuItem.Click += new System.EventHandler(this.instancesToolStripMenuItem_Click);
// //
// runAsAdministratorToolStripMenuItem // runAsAdministratorToolStripMenuItem
// //
this.runAsAdministratorToolStripMenuItem.Name = "runAsAdministratorToolStripMenuItem"; this.runAsAdministratorToolStripMenuItem.Name = "runAsAdministratorToolStripMenuItem";
this.runAsAdministratorToolStripMenuItem.Size = new System.Drawing.Size(210, 22); this.runAsAdministratorToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.runAsAdministratorToolStripMenuItem.Text = "Run as Administrator..."; this.runAsAdministratorToolStripMenuItem.Text = "Run as Administrator...";
this.runAsAdministratorToolStripMenuItem.Click += new System.EventHandler(this.runAsAdministratorToolStripMenuItem_Click); this.runAsAdministratorToolStripMenuItem.Click += new System.EventHandler(this.runAsAdministratorToolStripMenuItem_Click);
// //
// globalSettingsToolStripMenuItem // globalSettingsToolStripMenuItem
// //
this.globalSettingsToolStripMenuItem.Name = "globalSettingsToolStripMenuItem"; this.globalSettingsToolStripMenuItem.Name = "globalSettingsToolStripMenuItem";
this.globalSettingsToolStripMenuItem.Size = new System.Drawing.Size(210, 22); this.globalSettingsToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.globalSettingsToolStripMenuItem.Text = "Global settings..."; this.globalSettingsToolStripMenuItem.Text = "Global settings...";
this.globalSettingsToolStripMenuItem.Click += new System.EventHandler(this.globalSettingsToolStripMenuItem_Click); this.globalSettingsToolStripMenuItem.Click += new System.EventHandler(this.globalSettingsToolStripMenuItem_Click);
// //
// startCodeEditorToolStripMenuItem // startCodeEditorToolStripMenuItem
// //
this.startCodeEditorToolStripMenuItem.Name = "startCodeEditorToolStripMenuItem"; this.startCodeEditorToolStripMenuItem.Name = "startCodeEditorToolStripMenuItem";
this.startCodeEditorToolStripMenuItem.Size = new System.Drawing.Size(210, 22); this.startCodeEditorToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.startCodeEditorToolStripMenuItem.Text = "Start the code editor..."; this.startCodeEditorToolStripMenuItem.Text = "Start the code editor...";
this.startCodeEditorToolStripMenuItem.Click += new System.EventHandler(this.startCodeEditorToolStripMenuItem_Click); this.startCodeEditorToolStripMenuItem.Click += new System.EventHandler(this.startCodeEditorToolStripMenuItem_Click);
// //
// openMicrosoftCopilotToolStripMenuItem // openCopilotToolStripMenuItem
// //
this.openMicrosoftCopilotToolStripMenuItem.Name = "openMicrosoftCopilotToolStripMenuItem"; this.openCopilotToolStripMenuItem.Name = "openCopilotToolStripMenuItem";
this.openMicrosoftCopilotToolStripMenuItem.Size = new System.Drawing.Size(210, 22); this.openCopilotToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.openMicrosoftCopilotToolStripMenuItem.Text = "Open Microsoft Copilot..."; this.openCopilotToolStripMenuItem.Text = "Open the Copilot...";
this.openMicrosoftCopilotToolStripMenuItem.Click += new System.EventHandler(this.openMicrosoftCopilotToolStripMenuItem_Click); this.openCopilotToolStripMenuItem.Click += new System.EventHandler(this.openCopilotToolStripMenuItem_Click);
// //
// notifyIcon1 // notifyIcon1
// //
@ -230,13 +230,13 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(461, 382); this.ClientSize = new System.Drawing.Size(461, 382);
this.Controls.Add(this.checkBox2); this.Controls.Add(this.cbInteractiveServiceApp);
this.Controls.Add(this.textBox1); this.Controls.Add(this.txtUseSpecificScript);
this.Controls.Add(this.checkBox1); this.Controls.Add(this.cbUseSpecificScript);
this.Controls.Add(this.linkLabel1); this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.button2); this.Controls.Add(this.btnRunFromExternalLink);
this.Controls.Add(this.button1); this.Controls.Add(this.btnRunFromZipFile);
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = global::WelsonJS.Launcher.Properties.Resources.favicon; this.Icon = global::WelsonJS.Launcher.Properties.Resources.favicon;
@ -254,13 +254,13 @@
#endregion #endregion
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button btnRunFromZipFile;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button btnRunFromExternalLink;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.CheckBox cbUseSpecificScript;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox txtUseSpecificScript;
private System.Windows.Forms.CheckBox checkBox2; private System.Windows.Forms.CheckBox cbInteractiveServiceApp;
private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem userdefinedVariablesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem userdefinedVariablesToolStripMenuItem;
@ -273,7 +273,7 @@
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openCodeEditorToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openCodeEditorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openLauncherToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openLauncherToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openMicrosoftCopilotToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openCopilotToolStripMenuItem;
} }
} }

View File

@ -62,43 +62,54 @@ namespace WelsonJS.Launcher
private void EnableUI() private void EnableUI()
{ {
label1.Text = "Choose the location of WelsonJS application package."; label1.Text = "Choose the location of WelsonJS application package.";
button1.Enabled = true; btnRunFromZipFile.Enabled = true;
button2.Enabled = true; btnRunFromExternalLink.Enabled = true;
checkBox1.Enabled = true; cbUseSpecificScript.Enabled = true;
checkBox2.Enabled = true; cbInteractiveServiceApp.Enabled = true;
if (checkBox1.Checked) if (cbUseSpecificScript.Checked)
{ {
textBox1.Enabled = true; txtUseSpecificScript.Enabled = true;
} }
} }
private void DisableUI() private void DisableUI()
{ {
label1.Text = "Please wait..."; label1.Text = "Please wait...";
button1.Enabled = false; btnRunFromZipFile.Enabled = false;
button2.Enabled = false; btnRunFromExternalLink.Enabled = false;
checkBox1.Enabled = false; cbUseSpecificScript.Enabled = false;
checkBox2.Enabled = false; cbInteractiveServiceApp.Enabled = false;
textBox1.Enabled = false; txtUseSpecificScript.Enabled = false;
} }
private void button2_Click(object sender, EventArgs e) private void SafeInvoke(Action action)
{ {
MessageBox.Show("Comming soon...!"); if (InvokeRequired)
}
private void button1_Click(object sender, EventArgs e)
{ {
string filePath = OpenFileDialog(); Invoke(action);
if (filePath != null)
{
string fileExtension = Path.GetExtension(filePath);
if (fileExtension != ".zip")
{
MessageBox.Show("It doesn't seems to a ZIP file.");
} }
else else
{ {
action();
}
}
private void btnRunFromExternalLink_Click(object sender, EventArgs e)
{
MessageBox.Show("Coming soon...!");
}
private void btnRunFromZipFile_Click(object sender, EventArgs e)
{
using (var openFileDialog = new OpenFileDialog())
{
openFileDialog.Filter = "zip files (*.zip)|*.zip|All files (*.*)|*.*";
openFileDialog.FilterIndex = 2;
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string filePath = openFileDialog.FileName;
ExtractAndRun(filePath); ExtractAndRun(filePath);
} }
} }
@ -108,7 +119,7 @@ namespace WelsonJS.Launcher
{ {
instanceId = Guid.NewGuid().ToString(); instanceId = Guid.NewGuid().ToString();
workingDirectory = Program.GetWorkingDirectory(instanceId); workingDirectory = Program.GetWorkingDirectory(instanceId);
scriptName = textBox1.Text; scriptName = txtUseSpecificScript.Text;
Task.Run(() => Task.Run(() =>
{ {
@ -130,15 +141,18 @@ namespace WelsonJS.Launcher
workingDirectory = Program.GetWorkingDirectory(instanceId, true); workingDirectory = Program.GetWorkingDirectory(instanceId, true);
// Run the appliction // Run the appliction
Program.RunCommandPrompt(workingDirectory, entryFileName, scriptName, checkBox1.Checked, checkBox2.Checked); Program.RunCommandPrompt(workingDirectory, entryFileName, scriptName, cbUseSpecificScript.Checked, cbInteractiveServiceApp.Checked);
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.Message); SafeInvoke(() =>
{
MessageBox.Show("Error: " + ex.Message);
});
} }
// Enable UI // Enable UI
label1.Invoke((MethodInvoker)delegate { SafeInvoke(() => {
EnableUI(); EnableUI();
}); });
}); });
@ -161,22 +175,6 @@ namespace WelsonJS.Launcher
} }
} }
private string OpenFileDialog()
{
string filePath = null;
using (OpenFileDialog fileDialog = new OpenFileDialog())
{
if (fileDialog.ShowDialog() == DialogResult.OK)
{
// Get the path of specified file
filePath = fileDialog.FileName;
}
}
return filePath;
}
private bool IsInAdministrator() private bool IsInAdministrator()
{ {
try try
@ -190,14 +188,14 @@ namespace WelsonJS.Launcher
} }
} }
private void checkBox1_CheckedChanged(object sender, EventArgs e) private void cbUseSpecificScript_CheckedChanged(object sender, EventArgs e)
{ {
textBox1.Enabled = checkBox1.Checked; txtUseSpecificScript.Enabled = cbUseSpecificScript.Checked;
} }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
Process.Start("https://github.com/gnh1201/welsonjs"); Program.OpenWebBrowser(Properties.Resources.RepositoryUrl);
} }
private void userdefinedVariablesToolStripMenuItem_Click(object sender, EventArgs e) private void userdefinedVariablesToolStripMenuItem_Click(object sender, EventArgs e)
@ -247,7 +245,7 @@ namespace WelsonJS.Launcher
{ {
if (Program.resourceServer == null) if (Program.resourceServer == null)
{ {
Program.resourceServer = new ResourceServer("http://localhost:3000/", "editor.html"); Program.resourceServer = new ResourceServer(Properties.Resources.ResourceServerPrefix, "editor.html");
} }
if (!Program.resourceServer.IsRunning()) if (!Program.resourceServer.IsRunning())
@ -273,9 +271,9 @@ namespace WelsonJS.Launcher
} }
} }
private void openMicrosoftCopilotToolStripMenuItem_Click(object sender, EventArgs e) private void openCopilotToolStripMenuItem_Click(object sender, EventArgs e)
{ {
Program.OpenWebBrowser("https://copilot.microsoft.com/"); Program.OpenWebBrowser(Properties.Resources.CopilotUrl);
} }
} }
} }

View File

@ -60,6 +60,15 @@ namespace WelsonJS.Launcher.Properties {
} }
} }
/// <summary>
/// https://copilot.microsoft.com/과(와) 유사한 지역화된 문자열을 찾습니다.
/// </summary>
internal static string CopilotUrl {
get {
return ResourceManager.GetString("CopilotUrl", resourceCulture);
}
}
/// <summary> /// <summary>
/// (아이콘)과(와) 유사한 System.Drawing.Icon 형식의 지역화된 리소스를 찾습니다. /// (아이콘)과(와) 유사한 System.Drawing.Icon 형식의 지역화된 리소스를 찾습니다.
/// </summary> /// </summary>
@ -159,5 +168,23 @@ namespace WelsonJS.Launcher.Properties {
return ((System.Drawing.Bitmap)(obj)); return ((System.Drawing.Bitmap)(obj));
} }
} }
/// <summary>
/// https://github.com/gnh1201/welsonjs과(와) 유사한 지역화된 문자열을 찾습니다.
/// </summary>
internal static string RepositoryUrl {
get {
return ResourceManager.GetString("RepositoryUrl", resourceCulture);
}
}
/// <summary>
/// http://localhost:3000/과(와) 유사한 지역화된 문자열을 찾습니다.
/// </summary>
internal static string ResourceServerPrefix {
get {
return ResourceManager.GetString("ResourceServerPrefix", resourceCulture);
}
}
} }
} }

View File

@ -148,4 +148,13 @@
<data name="icon_start_32" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icon_start_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon_start_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icon_start_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="CopilotUrl" xml:space="preserve">
<value>https://copilot.microsoft.com/</value>
</data>
<data name="RepositoryUrl" xml:space="preserve">
<value>https://github.com/gnh1201/welsonjs</value>
</data>
<data name="ResourceServerPrefix" xml:space="preserve">
<value>http://localhost:3000/</value>
</data>
</root> </root>

View File

@ -1,3 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>

View File

@ -3,9 +3,9 @@
<head> <head>
<title>WelsonJS Editor</title> <title>WelsonJS Editor</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link rel="stylesheet" href="https://cdn.metroui.org.ua/dev/metro.css"> <link rel="stylesheet" href="https://catswords.blob.core.windows.net/welsonjs/ajax/libs/metroui/dev/lib/metro.css" integrity="sha384-4XgOiXH2ZMaWt5s5B35yKi7EAOabhZvx7wO8Jr71q2vZ+uONdRza/6CsK2kpyocd" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.metroui.org.ua/dev/icons.css"> <link rel="stylesheet" href="https://catswords.blob.core.windows.net/welsonjs/ajax/libs/metroui/dev/lib/icons.css" integrity="sha384-FuLND994etg+RtnpPSPMyNBvL+fEz+xGhbN61WUWuDEeZ+wJzcQ8SGqAMuI5hWrt" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs/editor/editor.main.css"> <link rel="stylesheet" href="https://catswords.blob.core.windows.net/welsonjs/ajax/libs/monaco-editor/0.52.2/min/vs/editor/editor.main.css" integrity="sha384-06yHXpYRlHEPaR4AS0fB/W+lMN09Zh5e1XMtfkNQdHV38OlhfkOEW5M+pCj3QskC" crossorigin="anonymous">
<style> <style>
html, body { html, body {
margin: 0; margin: 0;
@ -85,16 +85,16 @@
<script> <script>
var require = { var require = {
paths: { paths: {
vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs' vs: 'https://catswords.blob.core.windows.net/welsonjs/ajax/libs/monaco-editor/0.52.2/min/vs'
} }
}; };
</script> </script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> <script src="https://catswords.blob.core.windows.net/welsonjs/ajax/libs/axios/1.8.4/axios.min.js" integrity="sha384-06w+raHvkSL3+E7mbQ2X6DZwI5A3veU8Ba+NLrAPxxRGw4Xy78sihHDHQMustMM4" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fast-xml-parser/4.5.1/fxparser.min.js"></script> <script src="https://catswords.blob.core.windows.net/welsonjs/ajax/libs/fast-xml-parser/4.5.1/fxparser.min.js" integrity="sha384-ae/HepOQ8hiJ/VA6yGwPMGXQXOkT/lJpjlcQ7EUgibUcfnBltuozgNj4IgOZ9QLc" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.2.4/purify.min.js"></script> <script src="https://catswords.blob.core.windows.net/welsonjs/ajax/libs/dompurify/3.2.4/purify.min.js" integrity="sha384-eEu5CTj3qGvu9PdJuS+YlkNi7d2XxQROAFYOr59zgObtlcux1ae1Il3u7jvdCSWu" crossorigin="anonymous"></script>
<script src="https://cdn.metroui.org.ua/dev/metro.js"></script> <script src="https://catswords.blob.core.windows.net/welsonjs/ajax/libs/metroui/dev/lib/metro.js" integrity="sha384-grz4KlnFmdCd5ELenGIdPkUL/l+44UC4SniSke/OZQyRYXaQ1EDlGigacn6z4hGB" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs/loader.min.js"></script> <script src="https://catswords.blob.core.windows.net/welsonjs/ajax/libs/monaco-editor/0.52.2/min/vs/loader.js" integrity="sha384-pHG02SG8pId94Np3AbPmBEJ1yPqaH0IkJGLSNGXYmuGhkazT8Lr/57WYpbkGjJtu" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs/editor/editor.main.js"></script> <script src="https://catswords.blob.core.windows.net/welsonjs/ajax/libs/monaco-editor/0.52.2/min/vs/editor/editor.main.js" integrity="sha384-fj9z+NUc93I3woCCy5IRQfrQ8Amu1E27tllwgb5gz3d9Vr1ymS13xcF6two3e4KH" crossorigin="anonymous"></script>
<script> <script>
var editor; var editor;
var currentFileName = "sayhello.js"; var currentFileName = "sayhello.js";

View File

@ -5,8 +5,7 @@ REM Source code available: https://github.com/gnh1201/welsonjs
pushd %~dp0 pushd %~dp0
:: Define variables :: Define variables
set BLOB_SAS_TOKEN=sp=r^&st=2025-03-27T07:49:26Z^&se=2035-03-27T15:49:26Z^&spr=https^&sv=2024-11-04^&sr=b^&sig=iQBsKk7lXwwdi0g2rY1KOD%%2Fi5zuG7PBlfGwmWaCJEBs%%3D set TOOLKIT_URL=https://catswords.blob.core.windows.net/welsonjs/welsonjs_toolkit_latest.cab
set TOOLKIT_URL="https://catswords.blob.core.windows.net/welsonjs/welsonjs_toolkit_latest.cab?%BLOB_SAS_TOKEN%"
set TOOLKIT_PATH=%APPDATA%\welsonjs\welsonjs_toolkit_latest.cab set TOOLKIT_PATH=%APPDATA%\welsonjs\welsonjs_toolkit_latest.cab
set TOOLKIT_EXTRACT_PATH=%APPDATA%\welsonjs set TOOLKIT_EXTRACT_PATH=%APPDATA%\welsonjs
set REGASM_PATH=%WINDIR%\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe set REGASM_PATH=%WINDIR%\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe