Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Net;
- using System.Net.Sockets;
- using System.IO;
- using System.Threading;
- using System.Text.RegularExpressions;
- using System.Runtime.InteropServices;
- using System.Media;
- using System.Diagnostics;
- namespace WindowsFormsApplication1
- {
- public class IniFile
- {
- public string path;
- [DllImport("kernel32")]
- private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
- [DllImport("kernel32")]
- private static extern long GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
- 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)
- {
- StringBuilder temp = new StringBuilder(255);
- GetPrivateProfileString(Section, key, "", temp, 255, this.path);
- return temp.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment