1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.IO;
- namespace MOTINOVA_Motor_Factory_Set
- {
- public class server_cfg
- {
- public string IP;
- public string Port;
- public string User;
- public string PassWd;
- public string RootPath;
- public string Local;
- public void MyServerOption(string fileName)
- {
- //加载配置文件
- StreamReader objReader = new StreamReader(fileName);
- string sLine = "";
- List<string> array_CfgInfo = new List<string>();
- while (sLine != null)
- {
- sLine = objReader.ReadLine();
- array_CfgInfo.Add(sLine);
- }
- objReader.Close();
- //设定服务器配置
- IP = array_CfgInfo[0].Substring(array_CfgInfo[0].LastIndexOf("=") + 1);
- Port = array_CfgInfo[1].Substring(array_CfgInfo[1].LastIndexOf("=") + 1);
- User = array_CfgInfo[2].Substring(array_CfgInfo[2].LastIndexOf("=") + 1);
- PassWd = array_CfgInfo[3].Substring(array_CfgInfo[3].LastIndexOf("=") + 1);
- RootPath = array_CfgInfo[4].Substring(array_CfgInfo[4].LastIndexOf("=") + 1);
- Local = array_CfgInfo[5].Substring(array_CfgInfo[5].LastIndexOf("=") + 1);
- }
- }
- }
|