-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
139 lines (137 loc) · 4.72 KB
/
Program.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
// Decompiled with JetBrains decompiler
// Type: WebOrderImportCraft.Program
// Assembly: WebOrderImportCraft, Version=1000.510.8894.24695, Culture=neutral, PublicKeyToken=bf11c4f15ab4e1ef
// MVID: F965BC17-D6AC-43D0-B104-3E53F0C380F8
// Assembly location: P:\Synergy\VMAWS Custom Apps\WebOrderImportCraft\WebOrderImportCraft.exe
using MsgBox;
using System;
using System.Diagnostics;
using System.Windows.Forms;
using WebOrderImportCraft.Properties;
namespace WebOrderImportCraft
{
internal static class Program
{
[STAThread]
private static void Main(string[] arg)
{
bool flag1 = false;
bool flag2 = false;
bool flag3 = false;
try
{
if (Settings.Default.Properties["ConfigSettingsKey"] != null)
{
string str = Settings.Default["ConfigSettingsKey"].ToString();
if (str == "AUTO")
str = "MW";
Settings.Default.SettingsKey = str;
Settings.Default.Reload();
}
}
catch (Exception ex)
{
int num1 = (int) MBox.Show(ex.Message);
if (ex.InnerException != null)
{
int num2 = (int) MBox.Show(ex.InnerException.Message + " (app.config)", nameof (Program));
}
}
if (arg.Length >= 1 && arg[0].ToUpper() == "-B")
{
ProcessStartInfo startInfo = new ProcessStartInfo(Process.GetCurrentProcess().MainModule.FileName.Replace(".vshost", ""));
if (arg.Length > 1)
startInfo.Arguments = arg[1];
startInfo.UseShellExecute = false;
Process.Start(startInfo);
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
OrderSelectForm orderSelectForm = new OrderSelectForm();
DBInfo dbInfo = new DBInfo();
char[] chArray = new char[1]{ ',' };
string[] strArray = new string[0];
if (arg.Length != 0)
strArray = !arg[0].StartsWith("'") ? arg[0].Split(chArray) : arg[0].Substring(1).Split(chArray);
if (strArray.Length > 3)
{
orderSelectForm.header0.Key = strArray[0];
orderSelectForm.header0.UserName = strArray[1];
orderSelectForm.header0.Password = strArray[2];
int num = (int) orderSelectForm.ShowDialog();
}
else
{
if (arg.Length != 0 && arg[0].StartsWith("-"))
{
string str1 = "";
string str2 = "";
string str3 = "";
foreach (string str4 in arg)
{
if (str4.StartsWith("-G"))
flag2 = true;
else if (str4.StartsWith("-I"))
flag1 = true;
else if (str4.StartsWith("-D"))
str1 = str4.Substring(2);
else if (str4.StartsWith("-U"))
str2 = str4.Substring(2);
else if (str4.StartsWith("-P"))
str3 = str4.Substring(2);
else if (str4.StartsWith("-Q"))
flag3 = true;
}
dbInfo.Database = str1;
dbInfo.Username = str2;
dbInfo.Password = str3;
}
if (dbInfo.Database != "" && dbInfo.Username != "" && dbInfo.Password != "" && !flag1)
{
orderSelectForm.header0.Key = dbInfo.Database;
orderSelectForm.header0.UserName = dbInfo.Username;
orderSelectForm.header0.Password = dbInfo.Password;
orderSelectForm.Debug = flag2;
int num = (int) orderSelectForm.ShowDialog();
}
else if (orderSelectForm.header1.Key != null && !flag1)
{
if (orderSelectForm.header0.Key == null)
orderSelectForm.header0.Key = orderSelectForm.header1.Key;
orderSelectForm.Debug = flag2;
if (flag3)
{
orderSelectForm.AutoImportQuotes();
}
else
{
int num = (int) orderSelectForm.ShowDialog();
}
}
else
{
DialogResult dialogResult;
do
{
dialogResult = DialogResult.OK;
if (dbInfo.ShowDialog() == DialogResult.OK)
{
if (dbInfo.Database != "" && dbInfo.Username != "" && dbInfo.Password != "")
{
orderSelectForm.header0.Key = dbInfo.Database;
orderSelectForm.header0.UserName = dbInfo.Username;
orderSelectForm.header0.Password = dbInfo.Password;
}
orderSelectForm.Debug = flag2;
dialogResult = orderSelectForm.ShowDialog();
}
}
while (dialogResult == DialogResult.Retry);
}
}
}
}
}
}