惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
WordPress大学
WordPress大学
雷峰网
雷峰网
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Latest news
Latest news
Spread Privacy
Spread Privacy
T
Threat Research - Cisco Blogs
T
Tor Project blog
博客园 - Franky
U
Unit 42
K
Kaspersky official blog
博客园_首页
G
GRAHAM CLULEY
美团技术团队
I
Intezer
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
The Hacker News
The Hacker News
B
Blog
云风的 BLOG
云风的 BLOG
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Securelist
Last Week in AI
Last Week in AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
Martin Fowler
Martin Fowler
Schneier on Security
Schneier on Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
SegmentFault 最新的问题
W
WeLiveSecurity
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
J
Java Code Geeks
Cyberwarzone
Cyberwarzone
爱范儿
爱范儿
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The GitHub Blog
The GitHub Blog
S
Security @ Cisco Blogs
GbyAI
GbyAI
P
Proofpoint News Feed
D
Docker
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
T
Tenable Blog
V2EX - 技术
V2EX - 技术
The Register - Security
The Register - Security
V
Vulnerabilities – Threatpost
B
Blog RSS Feed

博客园 - 曾伟

不干胶、热敏打印 wpf 滚屏数据显示 net core quartz调度 warp打包 nssm部署到windowsservice c# webapi 过滤器token、sign认证、访问日志 c# NPOI文件操作 WCF多种调用方式兼容 网页打印javascript:window.print() window.showModalDialog弹出对话框刷新问题 ASP.NET] 选择文件夹的对话框 常用SQL语句书写技巧 控制同一exe程序打开多次 - 曾伟 - 博客园 IIS6 MMC检测到此管理单元发生一个错误,建议您关闭并重新启动mmc 在上传文件时限制上传文件的大小,并捕捉超过文件大小限制的 - 曾伟 - 博客园 Lucene的例子 javascript 获取标签具体位置 - 曾伟 - 博客园 JavaScript实现类,有多种方法。 Javascript实现截图功能(代码) 终端服务器超出了最大允许连接数 DBCC CHECKDB 数据库或表修复
c# ini文件操作
曾伟 · 2019-06-05 · via 博客园 - 曾伟
public class INIConfigHelper
    {
        public string Path;     //INI文件名
        [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);

        //声明读写INI文件的API函数     
        public INIConfigHelper(string iniPath)
        {
            Path = iniPath;
        }

        //类的构造函数,传递INI文件名
        public void IniWriteValue(string section, string key, string value)
        {
            WritePrivateProfileString(section, key, value, this.Path);
        }

        //读INI文件         
        public string IniReadValue(string section, string key)
        {
            var temp = new StringBuilder(256);
            int i = GetPrivateProfileString(section, key, "", temp, 256, this.Path);
            return temp.ToString();
        }
    }
private INIConfigHelper configReader = new INIConfigHelper(string.Concat(AppDomain.CurrentDomain.BaseDirectory, "Config\\Counter.ini"));
读取节点:
string section = "time";
                string startTimeStr = configReader.IniReadValue(section, "start");
更新节点:
configReader.IniWriteValue("time", "start", maxTime.ToString("yyyy-MM-dd HH:mm:ss"));