• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            JS讀寫ini文件






            //////////////////////////////////////////////////////////////////////////////////////
            function print(){
            fso = new ActiveXObject("Scripting.FileSystemObject");
            tf = fso.CreateTextFile("E:\\test.ini", true); 
            tf.WriteLine("要寫入的內(nèi)容");
            tf.Close();
            }
            /////////////////////////////////////////////////////////////////////////////////////

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

            namespace Common
            {
                /// <summary>
                /// INI文件讀寫類。
                /// </summary>
             public class INIFile
             {
              public string path;

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

              [DllImport("kernel32")]
              private static extern long WritePrivateProfileString(string section,string key,string val,string filePath);

              [DllImport("kernel32")]
              private static extern int GetPrivateProfileString(string section,string key,string def, StringBuilder retVal,int size,string filePath);

             
              [DllImport("kernel32")]
              private static extern int GetPrivateProfileString(string section, string key, string defVal, Byte[] retVal, int size, string filePath);


              /// <summary>
              /// 寫INI文件
              /// </summary>
              /// <param name="Section"></param>
              /// <param name="Key"></param>
              /// <param name="Value"></param>
              public void IniWriteValue(string Section,string Key,string Value)
              {
               WritePrivateProfileString(Section,Key,Value,this.path);
              }

              /// <summary>
              /// 讀取INI文件
              /// </summary>
              /// <param name="Section"></param>
              /// <param name="Key"></param>
              /// <returns></returns>
              public string IniReadValue(string Section,string Key)
              {
               StringBuilder temp = new StringBuilder(255);
               int i = GetPrivateProfileString(Section,Key,"",temp, 255, this.path);
               return temp.ToString();
              }
              public byte[] IniReadValues(string section, string key)
              {
               byte[] temp = new byte[255];
               int i = GetPrivateProfileString(section, key, "", temp, 255, this.path);
               return temp;

              }


              /// <summary>
              /// 刪除ini文件下所有段落
              /// </summary>
              public void ClearAllSection()
              {
               IniWriteValue(null,null,null);
              }
              /// <summary>
              /// 刪除ini文件下personal段落下的所有鍵
              /// </summary>
              /// <param name="Section"></param>
              public void ClearSection(string Section)
              {
               IniWriteValue(Section,null,null);
              }

             }


            }

            posted on 2010-10-20 11:21 wrh 閱讀(3383) 評論(0)  編輯 收藏 引用


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            導(dǎo)航

            <2010年7月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            統(tǒng)計

            常用鏈接

            留言簿(19)

            隨筆檔案

            文章檔案

            收藏夾

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久99国产精品99久久 | 青青国产成人久久91网| 久久狠狠高潮亚洲精品| 99久久精品无码一区二区毛片 | 久久66热人妻偷产精品9| 国产高潮久久免费观看| 久久精品免费一区二区| 亚洲一区二区三区日本久久九| 亚洲а∨天堂久久精品9966| 狠狠狠色丁香婷婷综合久久五月| 一日本道伊人久久综合影| 国产亚洲婷婷香蕉久久精品 | 久久精品人成免费| 久久中文精品无码中文字幕| 欧美伊香蕉久久综合类网站| 色偷偷偷久久伊人大杳蕉| 婷婷久久五月天| 久久无码一区二区三区少妇| 97精品国产97久久久久久免费| 亚洲AV日韩AV永久无码久久| 久久久久久曰本AV免费免费| 激情五月综合综合久久69| 久久噜噜电影你懂的| 久久久噜噜噜www成人网| 亚洲AV无码久久精品狠狠爱浪潮| 无码8090精品久久一区| 久久综合九色综合欧美就去吻| 亚洲国产二区三区久久| 国产产无码乱码精品久久鸭| 久久精品天天中文字幕人妻| 久久久久久久亚洲Av无码| 无码精品久久久久久人妻中字| 99久久国产宗和精品1上映| 午夜精品久久久久久影视riav| 无码任你躁久久久久久| 久久婷婷五月综合97色直播| 欧美精品乱码99久久蜜桃| 亚洲午夜久久久久久久久电影网| 亚洲国产精品无码久久| 无码国产69精品久久久久网站| 久久久国产精品亚洲一区|