• Windows Mobile 读写配置文件


    读写INI:

     首先,得到当前exe的运行路径  
      ApplicationPath   =   Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);  
      下面是操作INI文件的类  

    using System;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.IO;

    namespace Ini
    {
        
    ///   <summary>   
        
    ///   Ini的摘要说明。   
        
    ///   </summary>   

        public class IniFile
        
    {

            
    public string path;

           
    写入信息文件

            
    读取信息文件

            
    public IniFile(string INIPath)
            
    {
                path 
    = INIPath;
            }


            
    public void IniWriteValue(string Section, string Key, string Value)
            
    {
                WritePrivateProfileString(Section, Key, Value, 
    this.path);
            }


            
    public string IniReadValue(string Section, string Key)
            
    {
                
    return GetPrivateProfileString(Section, Key, ""this.path);
            }


        }

    }

    使用方法  
      写信息文件  
      IniFile   NewIni   =   new   IniFile(ApplicationPath   +   "\\Test.ini");  
      NewIni.IniWriteValue("测试信息","测试一","1");  
       
      读取  
      IniFile   NewIni   =   new   IniFile(ApplicationPath   +   "\\Test.ini");  
      string   a   =   NewIni   .IniReadValue("测试信息","测试一");  
       
      读取结果  
      a   =   1

     备注:以上代码在HP   2490(WM5)上测试通过


     

  • 相关阅读:
    9 jmeter之检查点
    8 jmeter之集合点
    7 jmeter之参数化
    6 jmeter元件的作用域与执行顺序
    5 jmeter性能测试小小的实战
    4 jmeter badboy脚本开发技术详解
    3 jmeter的两种录制方法
    2 jmeter常用功能介绍-测试计划、线程组
    Errors occurred during the build. Errors running builder 'DeploymentBuilder' on project
    常见异常总结
  • 原文地址:https://www.cnblogs.com/greatandforever/p/1595794.html
Copyright © 2020-2023  润新知