[Release] Extremely basic (but working/bugless) C# Source

01/24/2012 06:55 12k#316
Granted its not hard; You made a character creation packet yet dont no how to make a console command?
01/24/2012 16:27 corbit15#317
haha yeah it was late so i didn't even try because i was really tired. ill give it a shot later when i have time though. The only thing is i'm not completely sure how i would go about saving the account info to the file with the other accounts.


#EDIT
ok i guess i do need some help on making the command :/. Could someone give me an example or maybe a tip?
01/25/2012 13:33 I don't have a username#318
pseudo
Code:
void NewCharacter(string name, string password) {
IniFile ini = new IniFile("database\\accounts\\" + name + ".ini", "Account");
ini.WriteString("Account", name);
ini.WriteString("Password", password)
}
01/25/2012 13:51 Kiyono#319
Well since this source and Project Manifest are similar in many ways, here's my account creating command for that source:
Code:
                        case "/account":
                        {
                            ServerDatabase.NewUsername(Commands[1], Commands[2]);
                            break;
                        }
Code:
        public static void NewUsername(string Username, string Password)
        {
            IniFile ini = new IniFile(Path + "\\Accounts\\" + Username + ".ini");
            if (File.Exists(ini.FileName))
            {
                Program.WriteLine("Username is taken.");
            }
            else
            {
                ini.WriteString("Account", "Username", Username);
                ini.WriteString("Account", "Password", Password);
                ini.WriteString("Character", "Name", "INVALIDNAME");
                DirectoryInfo info = new DirectoryInfo(Path + "\\Accounts\\");
                ini.WriteString("Character", "UID", "1000000" + info.GetFiles().Length);
                ini.WriteString("Character", "GM", "2");
                Program.WriteLine("Account was successfully created.");
            }
        }
Shouldn't be too hard to change.
01/25/2012 16:49 corbit15#320
Quote:
Originally Posted by Kiyono View Post
Well since this source and Project Manifest are similar in many ways, here's my account creating command for that source:
Code:
                        case "/account":
                        {
                            ServerDatabase.NewUsername(Commands[1], Commands[2]);
                            break;
                        }
Code:
        public static void NewUsername(string Username, string Password)
        {
            IniFile ini = new IniFile(Path + "\\Accounts\\" + Username + ".ini");
            if (File.Exists(ini.FileName))
            {
                Program.WriteLine("Username is taken.");
            }
            else
            {
                ini.WriteString("Account", "Username", Username);
                ini.WriteString("Account", "Password", Password);
                ini.WriteString("Character", "Name", "INVALIDNAME");
                DirectoryInfo info = new DirectoryInfo(Path + "\\Accounts\\");
                ini.WriteString("Character", "UID", "1000000" + info.GetFiles().Length);
                ini.WriteString("Character", "GM", "2");
                Program.WriteLine("Account was successfully created.");
            }
        }
Shouldn't be too hard to change.

Alright well i got everything changed with no errors but when i use the command the account isn't created.
i put the NewUsername void in Database.cs
and the command in Commands.cs
Did i misplace them?
01/25/2012 17:14 Kiyono#321
I don't know, didn't try it with this source. Tried breakpointing? And just to be sure you did use it in this format right? /account <username> <password>
01/26/2012 00:59 corbit15#322
Quote:
Originally Posted by Kiyono View Post
I don't know, didn't try it with this source. Tried breakpointing? And just to be sure you did use it in this format right? /account <username> <password>
Just got home so i'll try breakpointing now. And yeah i did it in that format.

#EDIT
Alright well nothing happened when i used breakpoints.
Maybe i messed up something in one of the codes?

My command:
case "/account":
{
Database.NewUsername(args[1], args[2]);
break;
}

NewUsername void:
public static void NewUsername(string Username, string Password)
{
IniFile wrtr = new IniFile(DatabasePath + @"\Accounts\" + Username + ".ini");
if (File.Exists(wrtr.FileName))
{
Console.WriteLine("Username is taken.");

}
else
{
wrtr.Write("Account", "Username", Username);
wrtr.Write("Account", "Password", Password);
wrtr.Write("Character", "Name", "INVALIDNAME");
DirectoryInfo info = new DirectoryInfo(DatabasePath + @"\Accounts\");
wrtr.Write("Character", "UID", "1000000" + info.GetFiles().Length);
wrtr.Write("Character", "GM", "2");
Console.WriteLine("Account was successfully created.");
}
}


P.S sorry i don't know how to make spoilers :/
01/29/2012 09:26 mauripan#323
is there anyone can give a merror of the DL link of the first page files please....
01/29/2012 14:40 F i n c h i#324
Merror? o.o
01/30/2012 01:42 sitdownson#325
Mirror-Link o.o?
01/30/2012 07:02 corbit15#326
If you go back about 2 or 3 pages i posted a link.
02/15/2012 19:43 xBlackPlagu3x#327
Does anybody have an opinion on which revision to use? I mainly just want this source to use as a reference, so which ever rev would help out with that the best, is the rev I'd like to use.
02/15/2012 19:59 Kiyono#328
Quote:
Originally Posted by xBlackPlagu3x View Post
Does anybody have an opinion on which revision to use? I mainly just want this source to use as a reference, so which ever rev would help out with that the best, is the rev I'd like to use.
The newest; revision 3 but I guess that Arco's versions would be fine too. Oh and tao posted a slightly changed version (referred to as 3.1).
03/17/2012 19:15 Spirited#329
Mirror: [Only registered and activated users can see links. Click Here To Register...]
03/29/2012 23:08 PKDemon#330
i know this is an old post but can anyone re-upload as meagupload links dont work anymore ?