C# 代码

View Code
var systemRoot = System.Environment.SystemDirectory;
Process.Start(systemRoot[0].ToString() + @":\Program Files\Common Files\microsoft shared\ink\TabTip.exe");

读取文本文件并范围listarray类型 

View Code
 1  private ArrayList ReadTxt()
 2         {
 3             string path = Application.StartupPath;
 4             string pathtxt = System.IO.Path.Combine(path, "Elevation.txt");
 5             StreamReader sr = new StreamReader(pathtxt);
 6             string line;
 7             ArrayList linearr = new ArrayList();                 
 8             while ((line = sr.ReadLine()) != null)
 9             {
10                 linearr.Add(line);
11  
12             }
13             return linearr;        
14         }

读取文本文件的另一种方法

View Code

获取系统信息

View Code
 1  private string GetSystemInfo()
 2         {
 3             string info = string.Empty;
 4             info+= SystemInformation.UserName+Environment.NewLine;
 5             info += SystemInformation.ComputerName + Environment.NewLine;
 6             info += System.Environment.OSVersion.Platform.ToString() + Environment.NewLine;
 7             info += System.Environment.OSVersion.ServicePack + Environment.NewLine;
 8             info += System.Environment.OSVersion.ToString() + Environment.NewLine;
 9             return info;
10         }

 

View Code
  public void WriteLog(string LogContent)
        {
            using (StreamWriter sw = new StreamWriter("c:\\Log.txt", true))
            {
                sw.WriteLine(LogContent);
                sw.Close();
            }

        }

 

 

 

 

 

 

 

 

 

posted @ 2013-03-25 17:20  xjzhangdc  阅读(154)  评论(0编辑  收藏  举报