Register for your free account! | Forgot your password?

You last visited: Today at 15:32

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] InI File Reader

Discussion on [Release] InI File Reader within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
TheLeGend209's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 157
Received Thanks: 15
[Release] InI File Reader

Well This Should be All.

Quote:
public class IniFile2
{
public string FileName;

public IniFile2()
{
}

public IniFile2(string _FileName)
{
this.FileName = _FileName;
}

[DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
private static extern int GetPrivateProfileStringA(string Section, string Key, string _Default, StringBuilder Buffer, int BufferSize, string FileName);
[DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
private static extern int WritePrivateProfileStringA(string Section, string Key, string Arg, string FileName);

public byte ReadByte(string Section, string Key, byte _Default)
{
byte buf = _Default;
byte.TryParse(this.ReadString(Section, Key, _Default.ToString(), 6), out buf);
return buf;
}

public short ReadInt16(string Section, string Key, short _Default)
{
short buf = _Default;
short.TryParse(this.ReadString(Section, Key, _Default.ToString(), 9), out buf);
return buf;
}

public int ReadInt32(string Section, string Key, int _Default)
{
int buf = _Default;
int.TryParse(this.ReadString(Section, Key, _Default.ToString(), 15), out buf);
return buf;
}

public sbyte ReadSByte(string Section, string Key, byte _Default)
{
sbyte buf = (sbyte)_Default;
sbyte.TryParse(this.ReadString(Section, Key, _Default.ToString(), 6), out buf);
return buf;
}

public string ReadString(string Section, string Key, string _Default)
{
return this.ReadString(Section, Key, _Default, 255);
}

public string ReadString(string Section, string Key, string _Default, int BufSize)
{
StringBuilder Buffer = new StringBuilder(BufSize);
GetPrivateProfileStringA(Section, Key, _Default, Buffer, BufSize, this.FileName);
return Buffer.ToString();
}

public ushort ReadUInt16(string Section, string Key, ushort _Default)
{
ushort buf = _Default;
ushort.TryParse(this.ReadString(Section, Key, _Default.ToString(), 9), out buf);
return buf;
}

public uint ReadUInt32(string Section, string Key, uint _Default)
{
uint buf = _Default;
uint.TryParse(this.ReadString(Section, Key, _Default.ToString(), 15), out buf);
return buf;
}

public void Write(string Section, string Key, object Value)
{
WritePrivateProfileStringA(Section, Key, Value.ToString(), this.FileName);
}

public void Write(string Section, string Key, string Value)
{
WritePrivateProfileStringA(Section, Key, Value, this.FileName);
}

}
TheLeGend209 is offline  
Old 06/28/2009, 01:59   #2
 
elite*gold: 20
Join Date: May 2008
Posts: 1,103
Received Thanks: 254
You better give him the credits u know u didnt do this
Pete1990 is offline  
Old 06/28/2009, 03:07   #3
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
Weeeeeeeeeeeeeeeee I see a major problem with this class , Good job on conserving memory when reading specific data types though. Have fun figuring out the problem.
InfamousNoone is offline  
Reply


Similar Threads Similar Threads
[Release] DBC File Editor
01/23/2011 - CO2 PServer Guides & Releases - 34 Replies
Hey guys this is exactly what it says. I haven't fully tested this but I have changed a couple of things around in the source. This should work for 5165. If it doesnt tell me and I will edit some more and try and get it fully working. This was not originally released by me and I cant remember the name of the person who did release this. Hopefully people will use this and release their work to the community. I will not help people out with this. It is a very simple program to use. ...
anyone has .STG file reader?
11/16/2009 - Grand Chase Philippines - 6 Replies
does anyone know any .stg file reader abnd editor?? i cant seem to find one lemmeknow post link here ill check the thread regularly
[Java Release with Source] Account Info Saver & Reader
09/13/2008 - CO2 Programming - 5 Replies
Okay, i've updated the Acount Info Saver to make the files un-readable unless you use this, or just right click and open with notepad xD. So, anyways, pretty simple, i just had it remove the .txt extension, and made this program to read the text file itself. How to use - Just type your login ID you used to save the file with, and it should read it :) Note to a Mod: You can delete my old thread of the Saver, or you can keep it so people can learn how to write text files in java, doesnt...
anyine have edf file reader???
05/08/2008 - RF Online - 4 Replies
another question for you guys....where can i find an EDF file reader???? anyways.... dodge can really be changed using CE and with the BIND program. first you need to copy the BIN file of RF online then paste to another folder(edit it) and bind it to the rfonline.BIN file.... and pooffff.....the dodge can work now... ill give you guys a link on the website so you can download it and the TUT will also be included there.... itll take somemore time....before i can do that, coz' my friend...



All times are GMT +1. The time now is 15:33.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.