Skip to content

Commit 2f362d1

Browse files
committed
init
1 parent 167df51 commit 2f362d1

File tree

1,049 files changed

+281652
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,049 files changed

+281652
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using System.CodeDom.Compiler;
3+
using System.ComponentModel;
4+
using System.Diagnostics;
5+
using System.Globalization;
6+
using System.Resources;
7+
using System.Runtime.CompilerServices;
8+
9+
namespace DataSmart.MailServer.AccessManager.Properties
10+
{
11+
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), DebuggerNonUserCode, CompilerGenerated]
12+
internal class Resources
13+
{
14+
private static ResourceManager resourceMan;
15+
16+
private static CultureInfo resourceCulture;
17+
18+
[EditorBrowsable(EditorBrowsableState.Advanced)]
19+
internal static ResourceManager ResourceManager
20+
{
21+
get
22+
{
23+
if (object.ReferenceEquals(Resources.resourceMan, null))
24+
{
25+
ResourceManager resourceManager = new ResourceManager("DataSmart.MailServerAccessManager.Properties.Resources", typeof(Resources).Assembly);
26+
Resources.resourceMan = resourceManager;
27+
}
28+
return Resources.resourceMan;
29+
}
30+
}
31+
32+
[EditorBrowsable(EditorBrowsableState.Advanced)]
33+
internal static CultureInfo Culture
34+
{
35+
get
36+
{
37+
return Resources.resourceCulture;
38+
}
39+
set
40+
{
41+
Resources.resourceCulture = value;
42+
}
43+
}
44+
45+
internal Resources()
46+
{
47+
}
48+
}
49+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.CodeDom.Compiler;
3+
using System.Configuration;
4+
using System.Runtime.CompilerServices;
5+
6+
namespace DataSmart.MailServer.AccessManager.Properties
7+
{
8+
[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0"), CompilerGenerated]
9+
internal sealed class Settings : ApplicationSettingsBase
10+
{
11+
private static Settings defaultInstance = (Settings)SettingsBase.Synchronized(new Settings());
12+
13+
public static Settings Default
14+
{
15+
get
16+
{
17+
return Settings.defaultInstance;
18+
}
19+
}
20+
}
21+
}
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
using System;
2+
using System.Data;
3+
using System.Drawing;
4+
using System.Net;
5+
using System.Windows.Forms;
6+
7+
namespace DataSmart.MailServer.AccessManager
8+
{
9+
public class IPAccessForm : Form
10+
{
11+
private Label mt_StartIP;
12+
13+
private TextBox m_pStartIP;
14+
15+
private Label mt_EndIP;
16+
17+
private TextBox m_pEndIP;
18+
19+
private GroupBox m_pGroupbox1;
20+
21+
private Button m_pCancel;
22+
23+
private Button m_pOk;
24+
25+
private DataSet m_pDsSettings;
26+
27+
private DataRow m_pDrIPAccess;
28+
29+
private bool m_Add_Edit = true;
30+
31+
public IPAccessForm(DataSet dsSettings)
32+
{
33+
this.m_pDsSettings = dsSettings;
34+
this.m_Add_Edit = true;
35+
this.InitializeComponent();
36+
}
37+
38+
public IPAccessForm(DataSet dsSettings, DataRow dr)
39+
{
40+
this.m_pDsSettings = dsSettings;
41+
this.m_pDrIPAccess = dr;
42+
this.m_Add_Edit = false;
43+
this.InitializeComponent();
44+
this.m_pStartIP.Text = dr["StartIP"].ToString();
45+
this.m_pEndIP.Text = dr["EndIP"].ToString();
46+
}
47+
48+
private void InitializeComponent()
49+
{
50+
base.Size = new Size(330, 140);
51+
base.StartPosition = FormStartPosition.CenterScreen;
52+
base.FormBorderStyle = FormBorderStyle.FixedDialog;
53+
base.MaximizeBox = false;
54+
this.Text = "IP Access settings:";
55+
this.mt_StartIP = new Label();
56+
this.mt_StartIP.Size = new Size(100, 18);
57+
this.mt_StartIP.Location = new Point(5, 20);
58+
this.mt_StartIP.TextAlign = ContentAlignment.MiddleRight;
59+
this.mt_StartIP.Text = "Start IP:";
60+
this.m_pStartIP = new TextBox();
61+
this.m_pStartIP.Size = new Size(200, 20);
62+
this.m_pStartIP.Location = new Point(105, 20);
63+
this.mt_EndIP = new Label();
64+
this.mt_EndIP.Size = new Size(100, 18);
65+
this.mt_EndIP.Location = new Point(5, 45);
66+
this.mt_EndIP.TextAlign = ContentAlignment.MiddleRight;
67+
this.mt_EndIP.Text = "End IP:";
68+
this.m_pEndIP = new TextBox();
69+
this.m_pEndIP.Size = new Size(200, 20);
70+
this.m_pEndIP.Location = new Point(105, 45);
71+
this.m_pGroupbox1 = new GroupBox();
72+
this.m_pGroupbox1.Size = new Size(325, 3);
73+
this.m_pGroupbox1.Location = new Point(3, 75);
74+
this.m_pCancel = new Button();
75+
this.m_pCancel.Size = new Size(70, 20);
76+
this.m_pCancel.Location = new Point(160, 85);
77+
this.m_pCancel.Text = "Cancel";
78+
this.m_pCancel.Click += new EventHandler(this.m_pCancel_Click);
79+
this.m_pOk = new Button();
80+
this.m_pOk.Size = new Size(70, 20);
81+
this.m_pOk.Location = new Point(235, 85);
82+
this.m_pOk.Text = "Ok";
83+
this.m_pOk.Click += new EventHandler(this.m_pOk_Click);
84+
base.Controls.Add(this.mt_StartIP);
85+
base.Controls.Add(this.m_pStartIP);
86+
base.Controls.Add(this.mt_EndIP);
87+
base.Controls.Add(this.m_pEndIP);
88+
base.Controls.Add(this.m_pGroupbox1);
89+
base.Controls.Add(this.m_pCancel);
90+
base.Controls.Add(this.m_pOk);
91+
}
92+
93+
private void m_pCancel_Click(object sender, EventArgs e)
94+
{
95+
base.DialogResult = DialogResult.Cancel;
96+
base.Close();
97+
}
98+
99+
private void m_pOk_Click(object sender, EventArgs e)
100+
{
101+
string text = this.m_pStartIP.Text;
102+
string text2 = this.m_pEndIP.Text;
103+
if (text2 == "")
104+
{
105+
text2 = text;
106+
}
107+
try
108+
{
109+
IPAddress.Parse(text);
110+
}
111+
catch
112+
{
113+
MessageBox.Show("Invalid start IP value !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
114+
return;
115+
}
116+
try
117+
{
118+
IPAddress.Parse(text2);
119+
}
120+
catch
121+
{
122+
MessageBox.Show("Invalid end IP value !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
123+
return;
124+
}
125+
if (this.m_Add_Edit)
126+
{
127+
foreach (DataRow dataRow in this.m_pDsSettings.Tables["IP_Access"].Rows)
128+
{
129+
if (dataRow["StartIP"].ToString() == text && dataRow["EndIP"].ToString() == text2)
130+
{
131+
MessageBox.Show("Specified IP range already exists !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
132+
return;
133+
}
134+
}
135+
}
136+
if (this.m_Add_Edit)
137+
{
138+
DataRow dataRow2 = this.m_pDsSettings.Tables["IP_Access"].NewRow();
139+
dataRow2["StartIP"] = this.m_pStartIP.Text;
140+
dataRow2["EndIP"] = this.m_pEndIP.Text;
141+
this.m_pDsSettings.Tables["IP_Access"].Rows.Add(dataRow2);
142+
}
143+
else
144+
{
145+
this.m_pDrIPAccess["StartIP"] = this.m_pStartIP.Text;
146+
this.m_pDrIPAccess["EndIP"] = this.m_pEndIP.Text;
147+
}
148+
base.DialogResult = DialogResult.OK;
149+
base.Close();
150+
}
151+
}
152+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Threading;
3+
using System.Windows.Forms;
4+
5+
namespace DataSmart.MailServer.AccessManager
6+
{
7+
public class Program
8+
{
9+
[STAThread]
10+
public static void Main()
11+
{
12+
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.CurrentDomain_UnhandledException);
13+
Application.ThreadException += new ThreadExceptionEventHandler(Program.Application_ThreadException);
14+
Application.EnableVisualStyles();
15+
Application.Run(new MainForm());
16+
}
17+
18+
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
19+
{
20+
MessageBox.Show(null, e.Exception.ToString(), "Error:", MessageBoxButtons.OK, MessageBoxIcon.Hand);
21+
}
22+
23+
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
24+
{
25+
MessageBox.Show(null, ((Exception)e.ExceptionObject).ToString(), "Error:", MessageBoxButtons.OK, MessageBoxIcon.Hand);
26+
}
27+
}
28+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
using System;
2+
using System.Data;
3+
using System.Drawing;
4+
using System.Windows.Forms;
5+
6+
namespace DataSmart.MailServer.AccessManager
7+
{
8+
public class UserForm : Form
9+
{
10+
private Label mt_UserName;
11+
12+
private TextBox m_pUserName;
13+
14+
private Label mt_Password;
15+
16+
private TextBox m_pPassword;
17+
18+
private GroupBox m_pGroupbox1;
19+
20+
private Button m_pCancel;
21+
22+
private Button m_pOk;
23+
24+
private DataSet m_pDsSettings;
25+
26+
private DataRow m_pDrUser;
27+
28+
private bool m_Add_Edit = true;
29+
30+
public UserForm(DataSet dsSettings)
31+
{
32+
this.m_pDsSettings = dsSettings;
33+
this.m_Add_Edit = true;
34+
this.InitializeComponent();
35+
}
36+
37+
public UserForm(DataSet dsSettings, DataRow dr)
38+
{
39+
this.m_pDsSettings = dsSettings;
40+
this.m_pDrUser = dr;
41+
this.m_Add_Edit = false;
42+
this.InitializeComponent();
43+
this.m_pUserName.Text = dr["UserName"].ToString();
44+
this.m_pUserName.ReadOnly = true;
45+
this.m_pPassword.Text = dr["Password"].ToString();
46+
}
47+
48+
private void InitializeComponent()
49+
{
50+
base.Size = new Size(330, 140);
51+
base.StartPosition = FormStartPosition.CenterScreen;
52+
base.FormBorderStyle = FormBorderStyle.FixedDialog;
53+
base.MaximizeBox = false;
54+
this.Text = "User settings:";
55+
this.mt_UserName = new Label();
56+
this.mt_UserName.Size = new Size(100, 18);
57+
this.mt_UserName.Location = new Point(5, 20);
58+
this.mt_UserName.TextAlign = ContentAlignment.MiddleRight;
59+
this.mt_UserName.Text = "User Name:";
60+
this.m_pUserName = new TextBox();
61+
this.m_pUserName.Size = new Size(200, 20);
62+
this.m_pUserName.Location = new Point(105, 20);
63+
this.mt_Password = new Label();
64+
this.mt_Password.Size = new Size(100, 18);
65+
this.mt_Password.Location = new Point(5, 45);
66+
this.mt_Password.TextAlign = ContentAlignment.MiddleRight;
67+
this.mt_Password.Text = "Password:";
68+
this.m_pPassword = new TextBox();
69+
this.m_pPassword.Size = new Size(200, 20);
70+
this.m_pPassword.Location = new Point(105, 45);
71+
this.m_pPassword.PasswordChar = '*';
72+
this.m_pGroupbox1 = new GroupBox();
73+
this.m_pGroupbox1.Size = new Size(325, 3);
74+
this.m_pGroupbox1.Location = new Point(3, 75);
75+
this.m_pCancel = new Button();
76+
this.m_pCancel.Size = new Size(70, 20);
77+
this.m_pCancel.Location = new Point(160, 85);
78+
this.m_pCancel.Text = "Cancel";
79+
this.m_pCancel.Click += new EventHandler(this.m_pCancel_Click);
80+
this.m_pOk = new Button();
81+
this.m_pOk.Size = new Size(70, 20);
82+
this.m_pOk.Location = new Point(235, 85);
83+
this.m_pOk.Text = "Ok";
84+
this.m_pOk.Click += new EventHandler(this.m_pOk_Click);
85+
base.Controls.Add(this.mt_UserName);
86+
base.Controls.Add(this.m_pUserName);
87+
base.Controls.Add(this.mt_Password);
88+
base.Controls.Add(this.m_pPassword);
89+
base.Controls.Add(this.m_pGroupbox1);
90+
base.Controls.Add(this.m_pCancel);
91+
base.Controls.Add(this.m_pOk);
92+
}
93+
94+
private void m_pCancel_Click(object sender, EventArgs e)
95+
{
96+
base.DialogResult = DialogResult.Cancel;
97+
base.Close();
98+
}
99+
100+
private void m_pOk_Click(object sender, EventArgs e)
101+
{
102+
if (this.m_pUserName.Text == "")
103+
{
104+
MessageBox.Show("User name cannot be empty !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
105+
return;
106+
}
107+
if (this.m_Add_Edit)
108+
{
109+
foreach (DataRow dataRow in this.m_pDsSettings.Tables["Users"].Rows)
110+
{
111+
if (dataRow["UserName"].ToString().ToLower() == this.m_pUserName.Text.ToLower())
112+
{
113+
MessageBox.Show("Specified user '" + this.m_pUserName.Text + "' already exists !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
114+
return;
115+
}
116+
}
117+
}
118+
if (this.m_Add_Edit)
119+
{
120+
DataRow dataRow2 = this.m_pDsSettings.Tables["Users"].NewRow();
121+
dataRow2["UserName"] = this.m_pUserName.Text;
122+
dataRow2["Password"] = this.m_pPassword.Text;
123+
this.m_pDsSettings.Tables["Users"].Rows.Add(dataRow2);
124+
}
125+
else
126+
{
127+
this.m_pDrUser["Password"] = this.m_pPassword.Text;
128+
}
129+
base.DialogResult = DialogResult.OK;
130+
base.Close();
131+
}
132+
}
133+
}
Binary file not shown.

0 commit comments

Comments
 (0)