my server is changing sources from an ini source into a mysql source and i dont want to restart all the accounts.. so i just decided to code something in that will convert the main stuff like equips, levels and cps into the new mysql source.. i have the whole code with no errors but for some reason it wont update.
here is the code
Code:
public static void Transfer(Client UClient)
{
Ini Transfer = new Ini(System.Windows.Forms.Application.StartupPath + @"\accounts\\" + UClient.Account + ".acc");
string CharName = Transfer.ReadValue("Account", "Charr");
Ini CharInfo = new Ini(System.Windows.Forms.Application.StartupPath + @"\characters\\" + CharName + ".chr");
string equip = CharInfo.ReadValue("Character", "Equipment");
Console.WriteLine("transfer in progress for account id " + UClient.Account + " and for char name " + CharName);
string level1 = CharInfo.ReadValue("Character", "Level");
string cps1 = CharInfo.ReadValue("Character", "CPs");
MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `Level` = " + level1 +", `CPs` = " + cps1 + ",`Equipment` = '" + equip, Connection);
Command.ExecuteNonQuery();
}
also i added the actual actication code under the Creat char.. so when someone creates the char with the same username it auto gives the stuff.. this is the code i put under the creat char
I'm not the best with ini but it seems to me like your not reading from the ini file.
Maybe you're just blind, cause I can see it just fine.
Code:
public static void Transfer(Client UClient)
{
[COLOR="Red"]Ini Transfer = new Ini(System.Windows.Forms.Application.StartupPath + @"\accounts\\" + UClient.Account + ".acc");[/COLOR]
[COLOR="Red"]string CharName = Transfer.ReadValue("Account", "Charr");[/COLOR]
Ini CharInfo = new Ini(System.Windows.Forms.Application.StartupPath + @"\characters\\" + CharName + ".chr");
string equip = CharInfo.ReadValue("Character", "Equipment");
Console.WriteLine("transfer in progress for account id " + UClient.Account + " and for char name " + CharName);
string level1 = CharInfo.ReadValue("Character", "Level");
string cps1 = CharInfo.ReadValue("Character", "CPs");
MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `Level` = " + level1 +", `CPs` = " + cps1 + ",`Equipment` = '" + equip, Connection);
Command.ExecuteNonQuery();
}
Quote:
Originally Posted by AndreaCo
my server is changing sources from an ini source into a mysql source and i dont want to restart all the accounts.. so i just decided to code something in that will convert the main stuff like equips, levels and cps into the new mysql source.. i have the whole code with no errors but for some reason it wont update.
here is the code
Code:
public static void Transfer(Client UClient)
{
Ini Transfer = new Ini(System.Windows.Forms.Application.StartupPath + @"\accounts\\" + UClient.Account + ".acc");
string CharName = Transfer.ReadValue("Account", "Charr");
Ini CharInfo = new Ini(System.Windows.Forms.Application.StartupPath + @"\characters\\" + CharName + ".chr");
string equip = CharInfo.ReadValue("Character", "Equipment");
Console.WriteLine("transfer in progress for account id " + UClient.Account + " and for char name " + CharName);
string level1 = CharInfo.ReadValue("Character", "Level");
string cps1 = CharInfo.ReadValue("Character", "CPs");
MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `Level` = " + level1 +", `CPs` = " + cps1 + ",`Equipment` = '" + equip, Connection);
Command.ExecuteNonQuery();
}
also i added the actual actication code under the Creat char.. so when someone creates the char with the same username it auto gives the stuff.. this is the code i put under the creat char
nah i found out wat was wrong.. the code was right but when i added the catch thing to show me what the error was it said that the mysql wont support the transfer of equipment.. but the levels and cps transfered fine.. thx anyways ^^