diff --git a/EthSwitcher.sln b/EthSwitcher.sln new file mode 100644 index 0000000..a63357f --- /dev/null +++ b/EthSwitcher.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EthSwitcher", "EthSwitcher\EthSwitcher.csproj", "{AE1F1077-6F39-4892-9EAB-F106BF629D97}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AE1F1077-6F39-4892-9EAB-F106BF629D97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE1F1077-6F39-4892-9EAB-F106BF629D97}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE1F1077-6F39-4892-9EAB-F106BF629D97}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE1F1077-6F39-4892-9EAB-F106BF629D97}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/EthSwitcher/App.config b/EthSwitcher/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/EthSwitcher/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/EthSwitcher/ConfigList.cs b/EthSwitcher/ConfigList.cs new file mode 100644 index 0000000..505d1f9 --- /dev/null +++ b/EthSwitcher/ConfigList.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; + +namespace EthSwitcher { + public class ConfigList { + public class Config { + public String Name { get; set; } + + public String IpAddress { get; set; } + + public String Subnet { get; set; } + + public String Gateway { get; set; } + + public String Dns1 { get; set; } + + public String Dns2 { get; set; } + } + + private static readonly ConfigList Instance = new ConfigList(); + + private List _cfgList; + + private ConfigList() { + Load(); + } + + public static ConfigList GetInstance() { + return Instance; + } + + + public List GetList() { + return _cfgList; + } + + public void Add(String name, String ipAddress, String subnet, String gateway, String dns1, String dns2) { + var data = new Config(); + data.Name = name; + data.IpAddress = ipAddress; + data.Subnet = subnet; + data.Gateway = gateway; + data.Dns1 = dns1; + data.Dns2 = dns2; + + _cfgList.Add(data); + Save(); + } + + public void Add(Config data) { + _cfgList.Add(data); + Save(); + } + + public void Remove(Config cfg) { + _cfgList.Remove(cfg); + Save(); + } + + public Config GetItem(int index) { + try { + return _cfgList[index]; + } catch (Exception) { + return null; + } + } + + public String[] GetNames() { + if (_cfgList.Count == 0) return new[] {""}; + String[] str = new string[_cfgList.Count]; + for (int i = 0; i < _cfgList.Count; i++) { + str[i] = _cfgList[i].Name; + } + return str; + } + + public class SaveData { + public List Data { get; set; } + } + + public void Save() { + SaveData data = new SaveData(); + data.Data = _cfgList; + + XmlSerializer xmlSerializer = new XmlSerializer(typeof(SaveData)); + + FileStream outStream = new FileStream("settings.xml", FileMode.Create); + xmlSerializer.Serialize(outStream, data); + outStream.Close(); + } + + public void Load() { + try { + XmlSerializer xmlSerializer = new XmlSerializer(typeof (SaveData)); + + FileStream inStream = new FileStream("settings.xml", FileMode.Open); + + SaveData data = (SaveData) xmlSerializer.Deserialize(inStream); + inStream.Close(); + + _cfgList = data.Data; + } catch (Exception) { + _cfgList = new List(); + } + } + } +} diff --git a/EthSwitcher/EthSwitcher.csproj b/EthSwitcher/EthSwitcher.csproj new file mode 100644 index 0000000..b8c25d4 --- /dev/null +++ b/EthSwitcher/EthSwitcher.csproj @@ -0,0 +1,100 @@ + + + + + Debug + AnyCPU + {AE1F1077-6F39-4892-9EAB-F106BF629D97} + WinExe + Properties + EthSwitcher + EthSwitcher + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + Form + + + NameDialog.cs + + + + + + Form1.cs + + + NameDialog.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + \ No newline at end of file diff --git a/EthSwitcher/Form1.Designer.cs b/EthSwitcher/Form1.Designer.cs new file mode 100644 index 0000000..f6feb0b --- /dev/null +++ b/EthSwitcher/Form1.Designer.cs @@ -0,0 +1,514 @@ +namespace EthSwitcher { + partial class Form1 { + /// + /// 必要なデザイナー変数です。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 使用中のリソースをすべてクリーンアップします。 + /// + /// マネージ リソースが破棄される場合 true、破棄されない場合は false です。 + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows フォーム デザイナーで生成されたコード + + /// + /// デザイナー サポートに必要なメソッドです。このメソッドの内容を + /// コード エディターで変更しないでください。 + /// + private void InitializeComponent() { + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.nicList = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.settingList = new System.Windows.Forms.ListBox(); + this.addListBtn = new System.Windows.Forms.Button(); + this.setNowBtn = new System.Windows.Forms.Button(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.delBtn = new System.Windows.Forms.Button(); + this.addNowBtn = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.ipaddrBox = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.maskBox = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.gatewayBox = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.dns1Box = new System.Windows.Forms.TextBox(); + this.dns2Box = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.nameBox = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.ipaddrView = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.maskView = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.gatewayView = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.dns1view = new System.Windows.Forms.Label(); + this.label16 = new System.Windows.Forms.Label(); + this.dns2View = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.macView = new System.Windows.Forms.Label(); + this.menuStrip1.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // statusStrip1 + // + this.statusStrip1.Location = new System.Drawing.Point(0, 367); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(468, 22); + this.statusStrip1.TabIndex = 0; + this.statusStrip1.Text = "statusStrip1"; + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItem1}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(468, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.exitToolStripMenuItem}); + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(53, 20); + this.toolStripMenuItem1.Text = "ファイル"; + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(98, 22); + this.exitToolStripMenuItem.Text = "終了"; + this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); + // + // nicList + // + this.nicList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.nicList.FormattingEnabled = true; + this.nicList.Location = new System.Drawing.Point(105, 27); + this.nicList.Name = "nicList"; + this.nicList.Size = new System.Drawing.Size(351, 20); + this.nicList.TabIndex = 2; + this.nicList.SelectedIndexChanged += new System.EventHandler(this.nicList_SelectedIndexChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 30); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(87, 12); + this.label1.TabIndex = 3; + this.label1.Text = "NetworkAdapter"; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.macView); + this.groupBox1.Controls.Add(this.label18); + this.groupBox1.Controls.Add(this.dns2View); + this.groupBox1.Controls.Add(this.label16); + this.groupBox1.Controls.Add(this.dns1view); + this.groupBox1.Controls.Add(this.label14); + this.groupBox1.Controls.Add(this.gatewayView); + this.groupBox1.Controls.Add(this.label12); + this.groupBox1.Controls.Add(this.maskView); + this.groupBox1.Controls.Add(this.label10); + this.groupBox1.Controls.Add(this.ipaddrView); + this.groupBox1.Controls.Add(this.label8); + this.groupBox1.Location = new System.Drawing.Point(14, 53); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(442, 101); + this.groupBox1.TabIndex = 4; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "NowSetting"; + // + // settingList + // + this.settingList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.settingList.FormattingEnabled = true; + this.settingList.ItemHeight = 12; + this.settingList.Location = new System.Drawing.Point(14, 160); + this.settingList.Name = "settingList"; + this.settingList.Size = new System.Drawing.Size(202, 160); + this.settingList.TabIndex = 5; + this.settingList.SelectedIndexChanged += new System.EventHandler(this.settingList_SelectedIndexChanged); + // + // addListBtn + // + this.addListBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.addListBtn.Location = new System.Drawing.Point(72, 174); + this.addListBtn.Name = "addListBtn"; + this.addListBtn.Size = new System.Drawing.Size(75, 23); + this.addListBtn.TabIndex = 6; + this.addListBtn.Text = "Add List"; + this.addListBtn.UseVisualStyleBackColor = true; + this.addListBtn.Click += new System.EventHandler(this.addListBtn_Click); + // + // setNowBtn + // + this.setNowBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.setNowBtn.Location = new System.Drawing.Point(153, 174); + this.setNowBtn.Name = "setNowBtn"; + this.setNowBtn.Size = new System.Drawing.Size(75, 23); + this.setNowBtn.TabIndex = 7; + this.setNowBtn.Text = "Set Now"; + this.setNowBtn.UseVisualStyleBackColor = true; + this.setNowBtn.Click += new System.EventHandler(this.setNowBtn_Click); + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.nameBox); + this.groupBox2.Controls.Add(this.label7); + this.groupBox2.Controls.Add(this.dns2Box); + this.groupBox2.Controls.Add(this.dns1Box); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.gatewayBox); + this.groupBox2.Controls.Add(this.label4); + this.groupBox2.Controls.Add(this.maskBox); + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Controls.Add(this.ipaddrBox); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Controls.Add(this.addListBtn); + this.groupBox2.Controls.Add(this.setNowBtn); + this.groupBox2.Location = new System.Drawing.Point(222, 160); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(234, 204); + this.groupBox2.TabIndex = 8; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Setting"; + // + // delBtn + // + this.delBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.delBtn.Location = new System.Drawing.Point(132, 335); + this.delBtn.Name = "delBtn"; + this.delBtn.Size = new System.Drawing.Size(75, 23); + this.delBtn.TabIndex = 9; + this.delBtn.Text = "Del"; + this.delBtn.UseVisualStyleBackColor = true; + this.delBtn.Click += new System.EventHandler(this.delBtn_Click); + // + // addNowBtn + // + this.addNowBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.addNowBtn.Location = new System.Drawing.Point(14, 334); + this.addNowBtn.Name = "addNowBtn"; + this.addNowBtn.Size = new System.Drawing.Size(112, 23); + this.addNowBtn.TabIndex = 10; + this.addNowBtn.Text = "Add Now Setting"; + this.addNowBtn.UseVisualStyleBackColor = true; + this.addNowBtn.Click += new System.EventHandler(this.addNowBtn_Click); + // + // label2 + // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 26); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(57, 12); + this.label2.TabIndex = 8; + this.label2.Text = "IPAddress"; + // + // ipaddrBox + // + this.ipaddrBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.ipaddrBox.Location = new System.Drawing.Point(96, 23); + this.ipaddrBox.Name = "ipaddrBox"; + this.ipaddrBox.Size = new System.Drawing.Size(132, 19); + this.ipaddrBox.TabIndex = 9; + // + // label3 + // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 51); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(67, 12); + this.label3.TabIndex = 10; + this.label3.Text = "SubnetMask"; + // + // maskBox + // + this.maskBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.maskBox.Location = new System.Drawing.Point(96, 48); + this.maskBox.Name = "maskBox"; + this.maskBox.Size = new System.Drawing.Size(132, 19); + this.maskBox.TabIndex = 11; + // + // label4 + // + this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(6, 76); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(86, 12); + this.label4.TabIndex = 12; + this.label4.Text = "DefaultGateway"; + // + // gatewayBox + // + this.gatewayBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.gatewayBox.Location = new System.Drawing.Point(96, 73); + this.gatewayBox.Name = "gatewayBox"; + this.gatewayBox.Size = new System.Drawing.Size(132, 19); + this.gatewayBox.TabIndex = 13; + // + // label5 + // + this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(6, 101); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(34, 12); + this.label5.TabIndex = 14; + this.label5.Text = "DNS1"; + // + // label6 + // + this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(6, 126); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(34, 12); + this.label6.TabIndex = 15; + this.label6.Text = "DNS2"; + // + // dns1Box + // + this.dns1Box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.dns1Box.Location = new System.Drawing.Point(96, 98); + this.dns1Box.Name = "dns1Box"; + this.dns1Box.Size = new System.Drawing.Size(132, 19); + this.dns1Box.TabIndex = 16; + // + // dns2Box + // + this.dns2Box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.dns2Box.Location = new System.Drawing.Point(96, 123); + this.dns2Box.Name = "dns2Box"; + this.dns2Box.Size = new System.Drawing.Size(132, 19); + this.dns2Box.TabIndex = 17; + // + // label7 + // + this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(56, 152); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(34, 12); + this.label7.TabIndex = 18; + this.label7.Text = "Name"; + // + // nameBox + // + this.nameBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.nameBox.Location = new System.Drawing.Point(96, 149); + this.nameBox.Name = "nameBox"; + this.nameBox.Size = new System.Drawing.Size(132, 19); + this.nameBox.TabIndex = 19; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(14, 24); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(59, 12); + this.label8.TabIndex = 0; + this.label8.Text = "IPAddress:"; + // + // ipaddrView + // + this.ipaddrView.AutoSize = true; + this.ipaddrView.Location = new System.Drawing.Point(79, 24); + this.ipaddrView.Name = "ipaddrView"; + this.ipaddrView.Size = new System.Drawing.Size(83, 12); + this.ipaddrView.TabIndex = 1; + this.ipaddrView.Text = "255.255.255.255"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(4, 46); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(69, 12); + this.label10.TabIndex = 2; + this.label10.Text = "SubnetMask:"; + // + // maskView + // + this.maskView.AutoSize = true; + this.maskView.Location = new System.Drawing.Point(79, 46); + this.maskView.Name = "maskView"; + this.maskView.Size = new System.Drawing.Size(83, 12); + this.maskView.TabIndex = 3; + this.maskView.Text = "255.255.255.255"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(22, 68); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(51, 12); + this.label12.TabIndex = 4; + this.label12.Text = "Gateway:"; + // + // gatewayView + // + this.gatewayView.AutoSize = true; + this.gatewayView.Location = new System.Drawing.Point(79, 68); + this.gatewayView.Name = "gatewayView"; + this.gatewayView.Size = new System.Drawing.Size(83, 12); + this.gatewayView.TabIndex = 5; + this.gatewayView.Text = "255.255.255.255"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(260, 24); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(36, 12); + this.label14.TabIndex = 6; + this.label14.Text = "DNS1:"; + // + // dns1view + // + this.dns1view.AutoSize = true; + this.dns1view.Location = new System.Drawing.Point(302, 24); + this.dns1view.Name = "dns1view"; + this.dns1view.Size = new System.Drawing.Size(83, 12); + this.dns1view.TabIndex = 7; + this.dns1view.Text = "255.255.255.255"; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(260, 46); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(36, 12); + this.label16.TabIndex = 8; + this.label16.Text = "DNS2:"; + // + // dns2View + // + this.dns2View.AutoSize = true; + this.dns2View.Location = new System.Drawing.Point(302, 46); + this.dns2View.Name = "dns2View"; + this.dns2View.Size = new System.Drawing.Size(83, 12); + this.dns2View.TabIndex = 9; + this.dns2View.Text = "255.255.255.255"; + // + // label18 + // + this.label18.AutoSize = true; + this.label18.Location = new System.Drawing.Point(268, 68); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(28, 12); + this.label18.TabIndex = 10; + this.label18.Text = "Mac:"; + // + // macView + // + this.macView.AutoSize = true; + this.macView.Location = new System.Drawing.Point(302, 68); + this.macView.Name = "macView"; + this.macView.Size = new System.Drawing.Size(99, 12); + this.macView.TabIndex = 11; + this.macView.Text = "FF:FF:FF:FF:FF:FF"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(468, 389); + this.Controls.Add(this.addNowBtn); + this.Controls.Add(this.delBtn); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.settingList); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.nicList); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.MinimumSize = new System.Drawing.Size(484, 428); + this.Name = "Form1"; + this.Text = "EthSwitcher"; + this.Load += new System.EventHandler(this.Form1_Load); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ComboBox nicList; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.ListBox settingList; + private System.Windows.Forms.Button addListBtn; + private System.Windows.Forms.Button setNowBtn; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Button delBtn; + private System.Windows.Forms.Button addNowBtn; + private System.Windows.Forms.TextBox dns2Box; + private System.Windows.Forms.TextBox dns1Box; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox gatewayBox; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox maskBox; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox ipaddrBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox nameBox; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label dns2View; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label dns1view; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label gatewayView; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label maskView; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label ipaddrView; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label macView; + private System.Windows.Forms.Label label18; + } +} + diff --git a/EthSwitcher/Form1.cs b/EthSwitcher/Form1.cs new file mode 100644 index 0000000..44b63cf --- /dev/null +++ b/EthSwitcher/Form1.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace EthSwitcher { + public partial class Form1 : Form { + + private NetworkAdapterController _controller; + private List _adapters; + + public Form1() { + InitializeComponent(); + } + + private void exitToolStripMenuItem_Click(object sender, EventArgs e) { + Application.Exit(); + } + + private void Form1_Load(object sender, EventArgs e) { + _controller = new NetworkAdapterController(); + + _adapters = _controller.GetAdapters(); + + nicList.DropDownStyle = ComboBoxStyle.DropDownList; + nicList.DataSource = _adapters; + + settingList.DataSource = ConfigList.GetInstance().GetNames(); + settingList.DisplayMember = "Name"; + } + + private void nicList_SelectedIndexChanged(object sender, EventArgs e) { + String nic = _adapters[nicList.SelectedIndex]; + + ipaddrView.Text = _controller.GetIPAddress(nic); + maskView.Text = _controller.GetSubnetMask(nic); + gatewayView.Text = _controller.GetGateway(nic); + String[] dns = _controller.GetDnsServers(nic); + dns1view.Text = dns[0]; + dns2View.Text = dns[1]; + macView.Text = _controller.GetMacAddress(nic); + } + + private void setNowBtn_Click(object sender, EventArgs e) { + String nic = _adapters[nicList.SelectedIndex]; + try { + IPAddress address; + if (String.IsNullOrWhiteSpace(ipaddrBox.Text) || (IPAddress.TryParse(ipaddrBox.Text, out address))) { + if (String.IsNullOrWhiteSpace(maskBox.Text) || IPAddress.TryParse(maskBox.Text, out address)) { + if (String.IsNullOrWhiteSpace(gatewayBox.Text) || + (IPAddress.TryParse(gatewayBox.Text, out address))) { + if (String.IsNullOrWhiteSpace(dns1Box.Text) || + (IPAddress.TryParse(dns1Box.Text, out address))) { + if (String.IsNullOrWhiteSpace(dns2Box.Text) || + (IPAddress.TryParse(dns2Box.Text, out address))) { + _controller.SetDNSServers(nic, new string[] { dns1Box.Text, dns2Box.Text }); + _controller.SetIPAddress(nic, ipaddrBox.Text, maskBox.Text); + _controller.SetGateway(nic, gatewayBox.Text); + + ipaddrView.Text = _controller.GetIPAddress(nic); + maskView.Text = _controller.GetSubnetMask(nic); + gatewayView.Text = _controller.GetGateway(nic); + String[] dns = _controller.GetDnsServers(nic); + dns1view.Text = dns[0]; + dns2View.Text = dns[1]; + macView.Text = _controller.GetMacAddress(nic); + } else { + MessageBox.Show("DNS2が不正です。"); + } + } else { + MessageBox.Show("DNS1が不正です。"); + } + } else { + MessageBox.Show("Gatewayが不正です。"); + } + } else { + MessageBox.Show("SubnetMaskが不正です。"); + } + } else { + MessageBox.Show("IPアドレスが不正です。"); + } + } catch (Exception) { + MessageBox.Show("未知のエラーが発生しました"); + } + } + + private void settingList_SelectedIndexChanged(object sender, EventArgs e) { + ConfigList.Config data = ConfigList.GetInstance().GetItem(settingList.SelectedIndex); + + if (data == null)return; + + ipaddrBox.Text = data.IpAddress; + maskBox.Text = data.Subnet; + gatewayBox.Text = data.Gateway; + dns1Box.Text = data.Dns1; + dns2Box.Text = data.Dns2; + nameBox.Text = data.Name; + } + + private void addNowBtn_Click(object sender, EventArgs e) { + NameDialog nd = new NameDialog(); + if (nd.ShowDialog(this) == DialogResult.OK) { + ConfigList.GetInstance().Add(nd.Name, ipaddrView.Text, maskView.Text, gatewayView.Text, dns1view.Text, dns2View.Text); + } + nd.Dispose(); + + settingList.DataSource = ConfigList.GetInstance().GetNames(); + } + + private void delBtn_Click(object sender, EventArgs e) { + ConfigList.Config data = ConfigList.GetInstance().GetItem(settingList.SelectedIndex); + + if (data == null)return; + + ConfigList.GetInstance().Remove(data); + + settingList.DataSource = ConfigList.GetInstance().GetNames(); + } + + private void addListBtn_Click(object sender, EventArgs e) { + ConfigList.Config data = new ConfigList.Config(); + + data.Name = nameBox.Text; + data.IpAddress = ipaddrBox.Text; + data.Subnet = maskBox.Text; + data.Gateway = gatewayBox.Text; + data.Dns1 = dns1Box.Text; + data.Dns2 = dns2Box.Text; + + ConfigList.GetInstance().Add(data); + settingList.DataSource = ConfigList.GetInstance().GetNames(); + } + } +} diff --git a/EthSwitcher/Form1.resx b/EthSwitcher/Form1.resx new file mode 100644 index 0000000..1641ad6 --- /dev/null +++ b/EthSwitcher/Form1.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 141, 17 + + \ No newline at end of file diff --git a/EthSwitcher/NameDialog.Designer.cs b/EthSwitcher/NameDialog.Designer.cs new file mode 100644 index 0000000..30a3318 --- /dev/null +++ b/EthSwitcher/NameDialog.Designer.cs @@ -0,0 +1,83 @@ +namespace EthSwitcher { + partial class NameDialog { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(34, 12); + this.label1.TabIndex = 0; + this.label1.Text = "Name"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(52, 6); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(140, 19); + this.textBox1.TabIndex = 1; + // + // button1 + // + this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; + this.button1.Location = new System.Drawing.Point(117, 31); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 2; + this.button1.Text = "OK"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // NameDialog + // + this.AcceptButton = this.button1; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(204, 60); + this.ControlBox = false; + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.MaximumSize = new System.Drawing.Size(220, 99); + this.MinimumSize = new System.Drawing.Size(220, 99); + this.Name = "NameDialog"; + this.Text = "名前を入力してください"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/EthSwitcher/NameDialog.cs b/EthSwitcher/NameDialog.cs new file mode 100644 index 0000000..ad36315 --- /dev/null +++ b/EthSwitcher/NameDialog.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace EthSwitcher { + public partial class NameDialog : Form { + + public String Name; + + public NameDialog() { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) { + Name = textBox1.Text; + DialogResult = DialogResult.OK; + } + } +} diff --git a/EthSwitcher/NameDialog.resx b/EthSwitcher/NameDialog.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/EthSwitcher/NameDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/EthSwitcher/NetworkAdapterController.cs b/EthSwitcher/NetworkAdapterController.cs new file mode 100644 index 0000000..dfa6796 --- /dev/null +++ b/EthSwitcher/NetworkAdapterController.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management; +using System.Text; +using System.Threading.Tasks; + +namespace EthSwitcher { + public class NetworkAdapterController { + + private ManagementClass _managementClass; + private ManagementObjectCollection _nics; + + public NetworkAdapterController() { + init(); + } + + public void init() { + _managementClass = new ManagementClass("Win32_NetworkAdapterConfiguration"); + _nics = _managementClass.GetInstances(); + } + + public List GetAdapters() { + init(); + List list = new List(); + foreach (ManagementBaseObject nic in _nics) { + list.Add((string) nic["Caption"]); + } + return list; + } + + public String GetIPAddress(String adapter) { + init(); + String ip = "NoIPAddress"; + foreach (ManagementBaseObject nic in _nics) { + if (nic["Caption"].Equals(adapter)) { + if ((bool) nic["IPEnabled"]) { + if ((bool) nic["DHCPEnabled"]) { + if (nic["IPAddress"] != null) { + ip = "DHCP:" + ((String[])nic["IPAddress"])[0]; + break; + } else { + ip = "DHCP"; + break; + } + } else if (nic["IPAddress"] != null) { + ip = ((String[]) nic["IPAddress"])[0]; + break; + } + } else { + ip = "IP Not Active"; + } + } + } + return ip; + } + + public String GetSubnetMask(String adapter) { + init(); + String mask = ""; + foreach (ManagementBaseObject nic in _nics) { + if (nic["Caption"].Equals(adapter)) { + if ((bool)nic["IPEnabled"]) { + if (nic["IPSubnet"] != null) { + mask = ((String[]) nic["IPSubnet"])[0]; + } + } + + break; + } + } + return mask; + } + + public String GetGateway(String adapter) { + init(); + String gw = ""; + foreach (ManagementBaseObject nic in _nics) { + if (nic["Caption"].Equals(adapter)) { + if ((bool)nic["IPEnabled"]) { + if (nic["DefaultIPGateway"] != null) { + gw = ((String[])nic["DefaultIPGateway"])[0]; + } + } + break; + } + } + return gw; + } + + public String[] GetDnsServers(String adapter) { + init(); + String[] dns = {"", ""}; + foreach (ManagementBaseObject nic in _nics) { + if (nic["Caption"].Equals(adapter)) { + if ((bool)nic["IPEnabled"]) { + if (nic["DNSServerSearchOrder"] != null) { + String[] d = (string[]) nic["DNSServerSearchOrder"]; + dns[0] = d[0]; + if (d.Count() >= 2) { + dns[1] = d[1]; + } + } + } + break; + } + } + return dns; + } + + public String GetMacAddress(String adapter) { + init(); + String mac = ""; + foreach (ManagementBaseObject nic in _nics) { + if (nic["Caption"].Equals(adapter)) { + mac = (string) nic["MACAddress"]; + break; + } + } + return mac; + } + + /*Adapter Setting*/ + public bool SetIPAddress(String adapter, String ip_address, String subnet_mask) { + init(); + if (String.IsNullOrWhiteSpace(ip_address) || String.IsNullOrWhiteSpace(subnet_mask)) { + foreach (var o in _nics) { + var nic = (ManagementObject) o; + if (nic["Caption"].Equals(adapter)) { + nic.InvokeMethod("EnableDHCP", null, null); + return false; + } + } + return true; + } else { + foreach (var o in _nics) { + var nic = (ManagementObject) o; + if (nic["Caption"].Equals(adapter)) { + var newIP = nic.GetMethodParameters("EnableStatic"); + + newIP["IPAddress"] = new[] {ip_address}; + newIP["SubnetMask"] = new[] {subnet_mask}; + + nic.InvokeMethod("EnableStatic", newIP, null); + return true; + } + } + } + return false; + } + + public bool SetGateway(String adapter, String gateway) { + init(); + if (String.IsNullOrWhiteSpace(gateway)) { + gateway = null; + } + foreach (var o in _nics) { + var nic = (ManagementObject) o; + if (nic["Caption"].Equals(adapter)) { + var newGateway = nic.GetMethodParameters("SetGateways"); + if (gateway != null) { + newGateway["DefaultIPGateway"] = new[] {gateway}; + newGateway["GatewayCostMetric"] = new[] {1}; + } else + { + newGateway = null; + } + + nic.InvokeMethod("SetGateways", newGateway, null); + return true; + } + } + return false; + } + + public bool SetDNSServers(String adapter, String[] dnsservers) { + init(); + if (String.IsNullOrWhiteSpace(dnsservers[0])) { + dnsservers = null; + } else if(String.IsNullOrWhiteSpace(dnsservers[1])) { + dnsservers = new[] {dnsservers[0]}; + } + + foreach (var o in _nics) { + var nic = (ManagementObject) o; + if (nic["Caption"].Equals(adapter)) { + var newDNS = nic.GetMethodParameters("SetDNSServerSearchOrder"); + + if (dnsservers != null) { + newDNS["DNSServerSearchOrder"] = dnsservers; + } else { + newDNS["DNSServerSearchOrder"] = new string[]{}; + } + + nic.InvokeMethod("SetDNSServerSearchOrder", newDNS, null); + return true; + } + } + return false; + } + } +} diff --git a/EthSwitcher/Program.cs b/EthSwitcher/Program.cs new file mode 100644 index 0000000..36d4275 --- /dev/null +++ b/EthSwitcher/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace EthSwitcher { + static class Program { + /// + /// アプリケーションのメイン エントリ ポイントです。 + /// + [STAThread] + static void Main() { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/EthSwitcher/Properties/AssemblyInfo.cs b/EthSwitcher/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..fa182d0 --- /dev/null +++ b/EthSwitcher/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 +// アセンブリに関連付けられている情報を変更するには、 +// これらの属性値を変更してください。 +[assembly: AssemblyTitle("EthSwitcher")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("EthSwitcher")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから +// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 +// その型の ComVisible 属性を true に設定してください。 +[assembly: ComVisible(false)] + +// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です +[assembly: Guid("2c9f35b8-83d5-4c8b-a661-db6ed42be2c4")] + +// アセンブリのバージョン情報は、以下の 4 つの値で構成されています: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を +// 既定値にすることができます: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/EthSwitcher/Properties/Resources.Designer.cs b/EthSwitcher/Properties/Resources.Designer.cs new file mode 100644 index 0000000..c7706a3 --- /dev/null +++ b/EthSwitcher/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// このコードはツールによって生成されました。 +// ランタイム バージョン:4.0.30319.34209 +// +// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 +// コードが再生成されるときに損失したりします +// +//------------------------------------------------------------------------------ + +namespace EthSwitcher.Properties { + + + /// + /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 + /// + // このクラスは StronglyTypedResourceBuilder クラスが ResGen + // または Visual Studio のようなツールを使用して自動生成されました。 + // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に + // ResGen を実行し直すか、または VS プロジェクトをリビルドします。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// このクラスに使用される、キャッシュされた ResourceManager のインスタンスを返します。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EthSwitcher.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、 + /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/EthSwitcher/Properties/Resources.resx b/EthSwitcher/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/EthSwitcher/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/EthSwitcher/Properties/Settings.Designer.cs b/EthSwitcher/Properties/Settings.Designer.cs new file mode 100644 index 0000000..0c364cd --- /dev/null +++ b/EthSwitcher/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34209 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace EthSwitcher.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/EthSwitcher/Properties/Settings.settings b/EthSwitcher/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/EthSwitcher/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +