1using System; 2using System.Drawing; 3using System.Collections; 4using System.ComponentModel; 5using System.Windows.Forms; 6using System.IO; 7using System.Runtime.InteropServices; 8using System.Text; 9namespace ini 10 ... {11 / ** ////
48 /// summary> 49 Protected Override Void Dispose (Bool Disposing) 50 ... {51 if (Disposing) 52 ... {53 if (Components! = NULL) 54 ... {55 components.dispose ); 56} 57} 58 Base.Dispose (Disposing); 59} 60 61 Windows Form Designer Generated Code #REGION Windows Form Designer Generated Code 62 / ** ////
65 /// summary> 66 private void initializecomponent () 67 ... {68 this.button1 = new system.windows.Forms.Button (); 69 this.textBox1 = new system.windows.Forms.TextBox () 70 this.TextBox2 = new system.windows.Forms.TextBox (); 71 this.textBox3 = new system.windows.forms.textbox (); 72 this.button3 = new system.windows.Forms.Button (); 73 THIS.SUSPENDLAYOUT (); 74 // 75 // Button1 76 // 77 this.button1.location = new system.drawing.point (176, 16); 78 this.button1.name = "button1"; 79 this.button1 .Size = new system.drawing.size (88, 24); 80 this.button1.tabindex = 0; 81 this.button1.text = "Write Ini file"; 82 this.button1.click = new system.eventhandler This.button1_click; 83 // 84 // TEXTBOX1 85 // 86 this.textBox1.Location = new system.drawing.point (40, 8); 87 this.textbox1.name = "textbox1"; 88 this.TextBox1. Size = new system.drawing.size (96, 21); 89 this.textBox1.tabindex = 1; 90 this.textBox1.text = ""; 91 // 92 // textbox2 93 // 9 4 this.TextBox2.Location = new system.drawing.point (40, 40); 95 this.textbox2.name = "textbox2"; 96 this.textbox2.size = new system.drawing.size (96, 21); 97 THISTBOX2.TABINDEX = 2; 98 this.textbox2.text = ""; 99 // 100 // textbox3101 // 102 this.textBox3.Location = new system.drawing.point (40, 72); 103 this.TextBox3 .Name = "textbox3"; 104 this.textbox3.size = new system.drawing.size (96, 21); 105 this.textbox3.tabindex = 3; 106 this.TextBox3.text = ""; 107 // 108 / / Button3109 // 110 this.button3.location =
New system.drawing.point (176, 56); 111 this.button3.name = "button3"; 112 this.button3.size = new system.drawing.size (88, 24); 113 this.button3.tabindex = 6 114 this.button3.text = "Read Ini file"; 115 this.button3.click = new system.eventhandler (this.button3_click); 116 // 117 // Form1118 // 119 this.Drawing .Size (6, 14); 120 this.clientsize = new system.drawing.size (320, 117); 121 this.controls.add (this.button3); 122 this.controls.add (this.TextBox3); 123 THISCONTROLS.ADD (THIS.TEXTBOX2); 124 this.controls.add (this.textbox1); 125 this.controls.add (this.button1); 126 this.name = "form1"; 127 this.text = " INI "; 128 this.Load = new system.eventhandler (this.form1_load); 129 this.ResumeLayout (false); 130131} 132 # endregion133134 / ** ////
136 /// summary> 137 [stathread] 138 static void main () 139 ... {140 application.run (new form1 ()); 141} 142 private void server_info () 143 ... {144 String S = Application.executablePath; 145 String S1; 146 S1 = S.Replace ("ini.exe", "config.ini"); 147 // Write INI file 148 string filename = "FIATDATABASE"; 149 string path = S1; 150 string key1 = "DataBase"; 151 string keyValue1 = textBox1.Text; 152 string key2 = "Server"; 153 string keyValue2 = textBox2.Text; 154 string key3 = "UserId"; 155 string keyValue3 = textBox3.Text; 156 WritePrivateProfileString (FileName, key1, keyValue1, path); 157 WritePrivateProfileString (FileName, key2, keyValue2, path); 158 WritePrivateProfileString (FileName, key3, keyValue3, path); 159 MessageBox.Show ( "complete!"); 160} 161 // Read server information 162 163164 Private void button1_click (Object sender, system.eventargs e) 165 ... {166 server_info (); 167 168} 169170 Private void button2_click (Object Sender, System.EventArgs E) 171 ... {172 173 174} 1751 76 // Read Server Information 177 Private Void Read_SystemInfo () 178 ... {179 Try180 ... {181 // Get Configuration Information 182 String S = Application.executablePath; 183 String S1; 184 S1 = S.REPLACE (" Ini.exe "," config.ini "); 185 stringbuilder temp1 = new stringbuilder (255); 186 I1 = getPrivateProfileString (" FIATDATABASE "," Database "," ", TEMP1, 255, S1); 187 Database = Temp1 .Tostring (); 188 stringbuilder temp2 = new stringbuilder (255); 189 I2 = getPrivateProfileString ("FiatDatabase", "Server", ",", TEMP2, 255, S1);