Skip to content

Commit edd37b1

Browse files
UI update
1 parent 702820e commit edd37b1

File tree

8 files changed

+844
-534
lines changed

8 files changed

+844
-534
lines changed

Form/Loader.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,23 @@
3535
<PropertyGroup />
3636
<PropertyGroup />
3737
<ItemGroup>
38+
<Reference Include="Guna.UI2, Version=2.0.4.6, Culture=neutral, PublicKeyToken=8b9d14aa5142e261, processorArchitecture=MSIL">
39+
<HintPath>packages\Guna.UI2.WinForms.2.0.4.6\lib\net472\Guna.UI2.dll</HintPath>
40+
</Reference>
41+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
42+
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
43+
</Reference>
3844
<Reference Include="PresentationFramework" />
3945
<Reference Include="Siticone.UI, Version=1.0.0.3, Culture=neutral, PublicKeyToken=da23b5286e22db85, processorArchitecture=MSIL">
4046
<SpecificVersion>False</SpecificVersion>
4147
<HintPath>bin\Debug\Siticone.UI.dll</HintPath>
4248
</Reference>
4349
<Reference Include="System" />
50+
<Reference Include="System.Design" />
51+
<Reference Include="System.Management" />
4452
<Reference Include="System.Runtime.Serialization" />
4553
<Reference Include="System.Drawing" />
54+
<Reference Include="System.Web" />
4655
<Reference Include="System.Windows.Forms" />
4756
<Reference Include="System.Xml" />
4857
</ItemGroup>
@@ -71,6 +80,7 @@
7180
</ItemGroup>
7281
<ItemGroup>
7382
<None Include="App.config" />
83+
<None Include="packages.config" />
7484
</ItemGroup>
7585
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7686
</Project>

Form/Login.Designer.cs

Lines changed: 233 additions & 242 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Form/Login.cs

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Diagnostics;
33
using System.Net;
44
using System.Windows.Forms;
5+
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
56

67
namespace KeyAuth
78
{
@@ -17,13 +18,13 @@ public partial class Login : Form
1718
*/
1819

1920
public static api KeyAuthApp = new api(
20-
name: "",
21-
ownerid: "",
22-
secret: "",
23-
version: "1.0"/*,
24-
path: @"PathToCheckToken" NOTE: THE "@" IS IF THE TOKEN.TXT FILE IS IN THE SAME DIRECTORY AS THE .EXE*/
21+
name: "", // Application Name
22+
ownerid: "", // Owner ID
23+
secret: "", // Application Secret
24+
version: "" // Application Version /*
25+
//path: @"Your_Path_Here" // (OPTIONAL) see tutorial here https://www.youtube.com/watch?v=I9rxt821gMk&t=1s
2526
);
26-
27+
2728
//This will display how long it took to make a request in ms. The param "type" is for "login", "register", "init", etc... but that is optional, as well as this function. Ideally you can just put a label or MessageBox.Show($"Request took {api.responseTime}"), but either works.
2829
// if you would like to use this method, simply put it in any function and pass the param ... ShowResponse("TypeHere");
2930
private void ShowResponse(string type)
@@ -41,18 +42,40 @@ private void siticoneControlBox1_Click(object sender, EventArgs e)
4142
{
4243
Environment.Exit(0);
4344
}
44-
45+
46+
#region Misc References
4547
public static bool SubExist(string name)
4648
{
4749
if(KeyAuthApp.user_data.subscriptions.Exists(x => x.subscription == name))
4850
return true;
4951
return false;
5052
}
51-
53+
54+
static string random_string()
55+
{
56+
string str = null;
57+
58+
Random random = new Random();
59+
for (int i = 0; i < 5; i++)
60+
{
61+
str += Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))).ToString();
62+
}
63+
return str;
64+
65+
}
66+
#endregion
67+
5268
private void Login_Load(object sender, EventArgs e)
5369
{
5470
KeyAuthApp.init();
5571

72+
if (!KeyAuthApp.response.success)
73+
{
74+
MessageBox.Show(KeyAuthApp.response.message);
75+
Environment.Exit(0);
76+
}
77+
78+
#region Auto Update
5679
if (KeyAuthApp.response.message == "invalidver")
5780
{
5881
if (!string.IsNullOrEmpty(KeyAuthApp.app_data.downloadLink))
@@ -93,37 +116,25 @@ private void Login_Load(object sender, EventArgs e)
93116
MessageBox.Show("Version of this program does not match the one online. Furthermore, the download link online isn't set. You will need to manually obtain the download link from the developer");
94117
Environment.Exit(0);
95118
}
96-
97-
if (!KeyAuthApp.response.success)
98-
{
99-
MessageBox.Show(KeyAuthApp.response.message);
100-
Environment.Exit(0);
101-
}
119+
#endregion
102120
}
103-
104-
static string random_string()
121+
122+
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
105123
{
106-
string str = null;
107-
108-
Random random = new Random();
109-
for (int i = 0; i < 5; i++)
110-
{
111-
str += Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))).ToString();
112-
}
113-
return str;
114-
124+
KeyAuthApp.forgot(usernameField.Text, emailField.Text);
125+
status.Text = "Status: " + KeyAuthApp.response.message;
115126
}
116127

117-
private void UpgradeBtn_Click(object sender, EventArgs e)
128+
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
118129
{
119-
KeyAuthApp.upgrade(username.Text, key.Text); // success is set to false so people can't press upgrade then press login and skip logging in. it doesn't matter, since you shouldn't take any action on succesfull upgrade anyways. the only thing that needs to be done is the user needs to see the message from upgrade function
130+
KeyAuthApp.upgrade(usernameField.Text, keyField.Text); // success is set to false so people can't press upgrade then press login and skip logging in. it doesn't matter, since you shouldn't take any action on succesfull upgrade anyways. the only thing that needs to be done is the user needs to see the message from upgrade function
120131
status.Text = "Status: " + KeyAuthApp.response.message;
121132
// don't login, because they haven't authenticated. this is just to extend expiry of user with new key.
122133
}
123134

124-
private void LoginBtn_Click(object sender, EventArgs e)
135+
private void loginBtn_Click(object sender, EventArgs e)
125136
{
126-
KeyAuthApp.login(username.Text,password.Text);
137+
KeyAuthApp.login(usernameField.Text, passwordField.Text);
127138
if (KeyAuthApp.response.success)
128139
{
129140
Main main = new Main();
@@ -134,14 +145,15 @@ private void LoginBtn_Click(object sender, EventArgs e)
134145
status.Text = "Status: " + KeyAuthApp.response.message;
135146
}
136147

137-
private void RgstrBtn_Click(object sender, EventArgs e)
148+
private void guna2GradientButton2_Click(object sender, EventArgs e)
138149
{
139-
string email = this.email.Text;
140-
if(email == "Email (leave blank if none)") { // default value
150+
string email = this.emailField.Text;
151+
if (email == "Email (leave blank if none)")
152+
{ // default value
141153
email = null;
142154
}
143155

144-
KeyAuthApp.register(username.Text, password.Text, key.Text, email);
156+
KeyAuthApp.register(usernameField.Text, passwordField.Text, keyField.Text, email);
145157
if (KeyAuthApp.response.success)
146158
{
147159
Main main = new Main();
@@ -152,9 +164,9 @@ private void RgstrBtn_Click(object sender, EventArgs e)
152164
status.Text = "Status: " + KeyAuthApp.response.message;
153165
}
154166

155-
private void LicBtn_Click(object sender, EventArgs e)
167+
private void guna2GradientButton3_Click(object sender, EventArgs e)
156168
{
157-
KeyAuthApp.license(key.Text);
169+
KeyAuthApp.license(keyField.Text);
158170
if (KeyAuthApp.response.success)
159171
{
160172
Main main = new Main();
@@ -164,11 +176,5 @@ private void LicBtn_Click(object sender, EventArgs e)
164176
else
165177
status.Text = "Status: " + KeyAuthApp.response.message;
166178
}
167-
168-
private void siticoneRoundedButton1_Click(object sender, EventArgs e)
169-
{
170-
KeyAuthApp.forgot(username.Text, email.Text);
171-
status.Text = "Status: " + KeyAuthApp.response.message;
172-
}
173179
}
174180
}

Form/Login.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
<metadata name="siticoneDragControl1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121
<value>17, 17</value>
122122
</metadata>
123+
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
124+
<value>38</value>
125+
</metadata>
123126
<metadata name="siticoneShadowForm.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124127
<value>184, 17</value>
125128
</metadata>

0 commit comments

Comments
 (0)