winform INI文件操作辅助类】的更多相关文章

using System;using System.Runtime.InteropServices;using System.Text; namespace connectCMCC.Utils{ /// <summary> /// INI文件操作辅助类 /// </summary> public class IniFileUtil { public string path; /// <summary> /// 传入INI文件路径构造对象 /// </summary…
Config.ini 文件操作 [SYS] sysname=hy company=hyhy tel=2 using System; using System.Collections.Generic; using System.Text; namespace Common { public class SetINI { // 声明INI文件的写操作函数 WritePrivateProfileString() [System.Runtime.InteropServices.DllImport("ke…
ini 文件操作记要(1): 使用 TIniFile unit Unit1; interface uses   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,   Dialogs, StdCtrls; type   TForm1 = class(TForm)     Button1: TButton;     Button2: TButton;     Button3: TButton;    …
/// <summary> /// Ini文件操作类 /// </summary> public class Ini { // 声明INI文件的写操作函数 WritePrivateProfileString() [System.Runtime.InteropServices.DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, str…
介绍C#如何对ini文件进行读写操作,C#可以通过调用[kernel32.dll]文件中的 WritePrivateProfileString()和GetPrivateProfileString()函数分别对ini文件进行读和写操作.包括:读取key的值.保存key的值.读取所有section.读取所有key.移除section.移除key等操作. 目录 1. ini文件介绍 2. 读取操作:包括读取key的值.读取所有section.读取所有key等操作. 3. 写入操作: 包括保存key的值…
ini文件,是windows操作系统下的配置文件,ini文件是一种按照特点方式排列的文本文件,它的构成分为三部分,结构如下: [Section1] key 1 = value2 key 1 = value2 …… [Section2] key 1 = value1 key 2 = value2 …… 文件由若干个段落(section)组成,每个段落又分成若干个键(key)和值(value). C#和Win32 API函数 C#并不像C++,拥有属于自己的类库.C#使用的类库是.Net框架为所有.…
在开源中国看到的操作ini文件的,写的还不看,留着以后用 using System; using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Collections; using System.Collections.Specialized; namespace wuyisky{ /**//**/ /**//// <summary> /// IniFiles的类 /// <…
详情介绍:http://zh.wikipedia.org/wiki/INI%E6%96%87%E4%BB%B6 示例: 下面是一个虚拟的程序,其INI文件有两个小节,前面的小节是用来设置拥有者的信息,而后面的小节是用来设置数据库的位置.前面的注解记载谁最后编辑此文件,而后面的注解记录为何不使用域名而是使用IP地址. [owner] name=John Doe organization=Acme Products [database] server=192.0.2.42 ; use IP addr…
一.加密模块 1.有解密的加密方式(base64) #base64加密 import base64 str_encrypt = input("输入要加密的字符串:\n") base64_encrypt = base64.b64encode(str_encrypt.encode('utf-8')) print("BASE64加密串:\n"+str(base64_encrypt,'utf-8')) # 解密 str_decrypt = input("输入要解密…
最近做了一个查错工具,运用了winform文件操作的知识,做了几点总结,不全面,只总结了几点项目里用过的知识(关于以下内容只是个人的理解和总结,不对的地方请多指教,有补充的可以评论留言大家一起讨论学习). 一:基础知识 1.根据文件路径得到文件夹对象:DirectoryInfo di = new DirectoryInfo(filepath); 2.根据文件路径得到路径下所有的子目录的名称(包含路径)的集合: string[] diArray = Directory.GetDirectories…
1.使用TIniFile unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton;…
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TBu…
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace MyCommanHelper { /// <summary> /// 操作ini配置文件 /// </summary> public class INIHelper { // Methods #region DLL导入…
unit Unit1; interface uses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls; type  TForm1 = class(TForm)    Button1: TButton;    Button2: TButton;    procedure FormCreate(Sender: TObject);    procedure Fo…
灵活的数据源 不光光可以从文件读取配置,还支持 []byte 类型的纯数据读取和基于 io.ReadCloser 的流式读取. 多种格式兼容 各种文件种类的广泛支持,包括但不限于 my.cnf..gitconfig 甚至不可解析的分区. 自然类型增强 将值自动转换为指定的 Go 语言原生类型,让代码更加专注于逻辑处理而不是坑爹的类型转换. 结构体映射 映射配置文件到用户定义的 struct{} 结构体中,在完成操作后还能从结构体反向映射成对应的配置文件. 超神般的辅助 自动类型转换.候选值限制.…
#pragma once #include <string> #include <sstream> typedef std::basic_string<TCHAR> tstring; class CIniCfg { public: CIniCfg() { TCHAR szTemp[MAX_PATH]; GetModuleFileName(NULL, szTemp, sizeof(szTemp)); LPTSTR p = _tcsrchr(szTemp, _T('.'))…
using System;using System.Collections.Generic;using System.Text;using System.Xml;using System.Configuration;using System.Reflection; namespace ProcessErrorDataTools{ public class ConfigManager { private static Configuration _configuration; public sta…
/// <summary> /// Copies a string into the specified section of an initialization file. /// </summary> /// <param name="lpAppName">The name of the section to which the string will be copied. If the section does not exist, it is…
使用INI配置文件,简单便捷. 该辅助工具类为C#操作INI文件的辅助类,源码在某位师傅的基础上完善的来,因为忘记最初的来源了,因此不能提及引用,在此深感遗憾,并对贡献者表示感谢. using System; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; namespace Eyuan.Common { pub…
ini 文件操作记要(1): 使用 TIniFileunit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;typeTForm1 = class(TForm)    Button1: TButton;    Button2: TButton;    Button3: TButton;    Button4: TButton…
c# 利用动态库DllImport("kernel32")读写ini文件 自从读了设计模式,真的会改变一个程序员的习惯.我觉得嘛,经验也可以从一个人的习惯看得出来,看他的代码编写习惯能看出一个程序员的经验.说啥呢,为啥又会说说设计模式去了呢,好吧,咱是来讨论读写ini文件的. 为什么要来讨论读写ini文件呢,难道有数据库我们就不用读写文件了吗,什么数据都从数据库读取出来吗,有些东西是根据客户的习惯,就没必要去读取数据库了,或者说,比如你要做一个记住密码的功能,如果在web端,你还可以用…
基于C#winform设计. 首先创建一个类,我命名为IniFiles.并引入命名空间using System.Runtime.InteropServices; 接着,声明API函数 [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); [DllImport("k…
在做项目过程中,有时需要保存一些简单的配置信息,可以使用xml,也可以使用INI文件.下面是C#中读取INI的方法,相信大部分朋友都使用过这种方式.INI文件的存储方式如下, [section] key=value key=value 读取写入方法, [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, st…
主要还是使用的INI文件操作的API,只是把参数修改下. BOOL WINAPI WritePrivateProfileString( __in LPCTSTR lpAppName, __in LPCTSTR lpKeyName, __in LPCTSTR lpString, __in LPCTSTR lpFileName ); MSDN里这样说的: lpKeyName The name of the key to be associated with a string. If the key…
  在程序中经常要用到设置或者其他少量数据的存盘,以便程序在下一次执行的时候可以使用,比如说保存本次程序执行时窗口的位置.大小.一些用户设置的 数据等等,在 Dos 下编程的时候,我们一般自己产生一个文件,由自己把这些数据写到文件中,然后在下一次执行的时候再读出来使用.在 Win32 编程中当然你也可以这样干,但 Windows 已经为我们提供了两种方便的办法,那就是使用注册表或者 ini 文件(Profile)来保存少量数据.本文中先介绍一下 .ini 文件的使用. ini 文件是文本文件,中…
原文 http://blog.chinaunix.net/uid-23480430-id-3016899.html InnoSetup支持一些INI文件操作函数, 例如GetIniString,IniKeyExists等等.. 利用这些已有的函数,读取/删除/检测键值是否存在,都没有问题.   但是,想要列出一个INI文件有哪些Sections,  某个Section下面有哪些键值, 就没法做到了.   所幸InnoSetup有个很好用的 LoadStringsFromFile 函数, 用来读取…
    关于文件操作集锦 取得该快捷方式的指向EXE关键词:快捷方式 LNK unit Unit1; interface usesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls; typeTForm1 = class(TForm)Button1: TButton;procedure Button1Click(Sender: TObject);private{ P…
C# 使用文件流来读写ini文件 背景 之前采用ini文件作为程序的配置文件,觉得这种结构简单明了,配置起来也挺方便.然后操作方式是通过WindowsAPI,然后再网上找到一个基于WindowsAPI封装的help类,用起来倒也顺手.用的多了,觉得还可以使用文件流来操作,后来就发现了EasyConfig. EasyConfig是一个纯C#的开源ini文件操作库,但是在使用上有诸多不便,只是个人感觉,于是个人将其改造了一下,是自己喜欢用的风格. 资源下载 如果不清楚ini文件结构,请百度一下,这里…
背景 之前采用ini文件作为程序的配置文件,觉得这种结构简单明了,配置起来也挺方便.然后操作方式是通过WindowsAPI,然后再网上找到一个基于WindowsAPI封装的help类,用起来倒也顺手.用的多了,觉得还可以使用文件流来操作,后来就发现了EasyConfig. EasyConfig是一个纯C#的开源ini文件操作库,但是在使用上有诸多不便,只是个人感觉,于是个人将其改造了一下,是自己喜欢用的风格. 资源下载 如果不清楚ini文件结构,请百度一下,这里贴一个示例文件. [Video]…
C#如何读写和创建INI文件 分类: c#程序设计2011-11-27 20:42 4935人阅读 评论(2) 收藏 举报 inic#stringbuffernullfile 在做项目过程中,有时需要保存一些简单的配置信息,可以使用xml,也可以使用INI文件.下面是C#中读取INI的方法,相信大部分朋友都使用过这种方式.INI文件的存储方式如下, [section] key=value key=value 读取写入方法, [DllImport("kernel32")] private…