Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 08:48

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

Advertisement



5165 Exception Error! HELP!~

Discussion on 5165 Exception Error! HELP!~ within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
5165 Exception Error! HELP!~

okay so I am going to post here my code since not much people are willing to help me without it...here is my LoadCharacter void in database.cs I get like 3 errors in there saying "unable to read beyond end of stream", something like dat...and another error on character.cs but I mainly think it's in Load Character...

so plz HELP ME as I cannot login to the game cuz of dis damm error >.>...

LoadCharacter(MINE-ORIGINAL):

Code:
public static Game.Character LoadCharacter(string Name, ref string Account)
        {
            try
            {
                Game.Character C = new NewestCOServer.Game.Character();
                if (File.Exists(@"C:\OldCODB\Users\Characters\" + Name + ".chr"))
                {
                    FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + Name + ".chr", FileMode.Open);
                    BinaryReader BR = new BinaryReader(FS);
                    C.Name = Name;
                    Account = BR.ReadString();
                    C.EntityID = BR.ReadUInt32();
                    C.Avatar = BR.ReadUInt16();
                    C.Body = BR.ReadUInt16();
                    C.Hair = BR.ReadUInt16();

                    C.Loc = new NewestCOServer.Game.Location();
                    C.Loc.Map = BR.ReadUInt16();
                    C.Loc.X = BR.ReadUInt16();
                    C.Loc.Y = BR.ReadUInt16();
                    C.Loc.PreviousMap = BR.ReadUInt16();

                    C.Job = BR.ReadByte();
                    C.PreviousJob1 = BR.ReadByte();
                    C.Level = BR.ReadByte();
                    C.Experience = BR.ReadUInt64();

                    C.Str = BR.ReadUInt16();
                    C.Agi = BR.ReadUInt16();
                    C.Vit = BR.ReadUInt16();
                    C.Spi = BR.ReadUInt16();
                    C.StatPoints = BR.ReadUInt16();
                    C.CurHP = BR.ReadUInt16();
                    C.CurMP = BR.ReadUInt16();
                    C.Nobility.Donation = BR.ReadUInt64();

                    C.Nobility.ListPlace = -1;
                    if (C.Nobility.Donation >= 3000000)
                    {
                        C.Nobility.ListPlace = 50;
                        for (int i = 49; i >= 0; i--)
                        {
                            if (C.Nobility.Donation >= Game.World.EmpireBoard[i].Donation)
                                C.Nobility.ListPlace--;
                        }
                        if (C.Nobility.ListPlace < 50)
                        {
                            if (C.Nobility.Donation >= 30000000 && C.Nobility.Donation <= 100000000)
                                C.Nobility.Rank = Game.Ranks.Knight;
                            else if (C.Nobility.Donation >= 100000000 && C.Nobility.Donation <= 200000000)
                                C.Nobility.Rank = Game.Ranks.Baron;
                            else if (C.Nobility.Donation >= 200000000 && C.Nobility.Donation <= 300000000)
                                C.Nobility.Rank = Game.Ranks.Earl;
                            else if (C.Nobility.ListPlace >= 15 && C.Nobility.ListPlace <= 50)
                                C.Nobility.Rank = Game.Ranks.Duke;
                            else if (C.Nobility.ListPlace >= 3 && C.Nobility.ListPlace <= 15)
                                C.Nobility.Rank = Game.Ranks.Prince;
                            else if (C.Nobility.ListPlace <= 3)
                                C.Nobility.Rank = Game.Ranks.King;
                        }
                    }

                    C.Silvers = BR.ReadUInt32();
                    C.CPs = BR.ReadUInt32();
                    C.WHSilvers = BR.ReadUInt32();
                    C.VP = BR.ReadUInt64();
                    C.PKPoints = BR.ReadUInt16();
                    ushort GID = BR.ReadUInt16();

                    if (Features.Guilds.AllTheGuilds.Contains(GID))
                    {
                        C.MyGuild = (Features.Guild)Features.Guilds.AllTheGuilds[GID];

                        uint Don = BR.ReadUInt32(); ;
                        byte GR = BR.ReadByte();
                        if (((Hashtable)C.MyGuild.Members[GR]).Contains(C.EntityID))
                        {
                            C.GuildDonation = Don;
                            C.GuildRank = (Features.GuildRank)GR;

                            C.MembInfo = (Features.MemberInfo)((Hashtable)C.MyGuild.Members[GR])[C.EntityID];
                            C.MembInfo.Level = C.Level;
                            C.GuildDonation = C.MembInfo.Donation;
                            C.GuildRank = C.MembInfo.Rank;
                        }
                        else
                            C.MyGuild = null;
                    }
                    else BR.ReadBytes(5);

                    C.Equips = new NewestCOServer.Game.Equipment();
                    C.Equips.ReadThis(BR);
                    C.Inventory = new ArrayList(40);
                    byte InventoryCount = BR.ReadByte();
                    for (byte i = 0; i < InventoryCount; i++)
                    {
                        Game.Item I = new NewestCOServer.Game.Item();
                        I.ReadThis(BR);
                        C.Inventory.Add(I);
                    }
                    C.Warehouses = new NewestCOServer.Game.Banks();
                    C.Warehouses.ReadThis(BR);

                    C.Skills = new Hashtable();
                    byte SkillCount = BR.ReadByte();
                    for (byte i = 0; i < SkillCount; i++)
                    {
                        Game.Skill S = new NewestCOServer.Game.Skill();
                        S.ReadThis(BR);
                        C.Skills.Add(S.ID, S);
                        if (S.ID == 3060)
                            C.CanReflect = true;
                    }

                    C.Profs = new Hashtable();
                    byte ProfCount = BR.ReadByte();
                    for (byte i = 0; i < ProfCount; i++)
                    {
                        Game.Prof P = new NewestCOServer.Game.Prof();
                        P.ReadThis(BR);
                        if (!C.Profs.Contains(P.ID))
                            C.Profs.Add(P.ID, P);
                    }

                    C.Friends = new Hashtable();
                    byte FriendCount = BR.ReadByte();
                    for (byte i = 0; i < FriendCount; i++)
                    {
                        Game.Friend F = new NewestCOServer.Game.Friend();
                        F.ReadThis(BR);
                        if (!C.Friends.Contains(F.UID))
                            C.Friends.Add(F.UID, F);
                    }

                    C.Enemies = new Hashtable();
                    byte EnemyCount = BR.ReadByte();
                    for (byte i = 0; i < EnemyCount; i++)
                    {
                        Game.Enemy E = new NewestCOServer.Game.Enemy();
                        E.ReadThis(BR);
                        if (!C.Enemies.Contains(E.UID))
                            C.Enemies.Add(E.UID, E);
                    }
                    try
                    {
                        C.DoubleExp = BR.ReadBoolean();
                        C.DoubleExpLeft = BR.ReadInt32();
                        C.BlessingLasts = BR.ReadInt32();
                        C.BlessingStarted = DateTime.FromBinary(BR.ReadInt64());

                        C.LuckyTime = BR.ReadUInt32();
                        C.ExpBallsUsedToday = BR.ReadByte();
                        C.Reborns = BR.ReadByte();
                        C.Merchant = (NewestCOServer.Game.MerchantTypes)BR.ReadByte();
                        C.VipLevel = BR.ReadByte();
                        try
                        {
                            C.LastLogin = DateTime.FromBinary(BR.ReadInt64());
                        }
                        catch { C.LastLogin = DateTime.Now; }
                        C.TrainTimeLeft = BR.ReadUInt16();
                        C.InOTG = BR.ReadBoolean();
                        C.LotteryUsed = BR.ReadByte();

                        try
                        {
                            C.WHPassword = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));

                            if (!C.MyClient.ValidWHPass(C.WHPassword))
                                C.WHPassword = "0";
                        }
                        catch { C.WHPassword = "0"; C.UniversityPoints = 0; }

                        try
                        {
                            C.Spouse = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
                            C.UniversityPoints = BR.ReadUInt32();
                        }
                        catch
                        {
                            C.VipLevel = 0;
                            C.ExpBallsUsedToday = 0;
                            C.LotteryUsed = 0;
                            C.TrainTimeLeft = 0;
                            C.InOTG = false;
                            C.LotteryUsed = 0;
                            C.WHPassword = "0";
                            C.Spouse = "None";
                            C.UniversityPoints = 0;
                        }
                        LoadFlowerRank(Name);
                    }
                    catch (Exception ex) { Console.WriteLine(ex.ToString()); }
                    FS.Flush();
                    BR.Close();
                    FS.Close();
                    C.Loaded = true;
                }
                return C;
            }
            catch (Exception Exc) { Console.WriteLine(Exc); return null; }
        }
2nd error:

Code:
public void ReadThis(System.IO.BinaryReader BR)
        {
            TCWarehouse = new ArrayList(20);
            byte Count = BR.ReadByte();
            for (byte i = 0; i < Count; i++)
            {
                Item I = new Item();
                I.ReadThis(BR);
                if (I.ID != 0)
                    TCWarehouse.Add(I);
            }

            PCWarehouse = new ArrayList(20);
            Count = BR.ReadByte();
            for (byte i = 0; i < Count; i++)
            {
                Item I = new Item();
                I.ReadThis(BR);
                if (I.ID != 0)
                    PCWarehouse.Add(I);
            }

            ACWarehouse = new ArrayList(20);
            Count = BR.ReadByte();
            for (byte i = 0; i < Count; i++)
            {
                Item I = new Item();
                I.ReadThis(BR);
                if (I.ID != 0)
                    ACWarehouse.Add(I);
            }

            DCWarehouse = new ArrayList(20);
            Count = BR.ReadByte();
            for (byte i = 0; i < Count; i++)
            {
                Item I = new Item();
                I.ReadThis(BR);
                if (I.ID != 0)
                    DCWarehouse.Add(I);
            }

            BIWarehouse = new ArrayList(20);
            Count = BR.ReadByte();
            for (byte i = 0; i < Count; i++)
            {
                Item I = new Item();
                I.ReadThis(BR);
                if (I.ID != 0)
                    BIWarehouse.Add(I);
            }

            MAWarehouse = new ArrayList(20);
            Count = BR.ReadByte();
            for (byte i = 0; i < Count; i++)
            {
                Item I = new Item();
                I.ReadThis(BR);
                if (I.ID != 0)
                    MAWarehouse.Add(I);
            }
        }
    }
(in there it's line 768...)

3rd and last error:

Code:
public void ReadThis(System.IO.BinaryReader I)
        {
            byte Length = I.ReadByte();
            if (Length == 25)
            {
                UID = I.ReadUInt32();

                if (UID == 0) UID = (uint)Program.Rnd.Next(10000000);
                if (UID == 0) UID = (uint)World.Rnd.Next(10000000);

                ID = I.ReadUInt32();
                if (Database.DatabaseItems.Contains(ID))
                {
                    Plus = I.ReadByte();
                    Bless = I.ReadByte();
                    Enchant = I.ReadByte();
                    Soc1 = (Gem)I.ReadByte();
                    Soc2 = (Gem)I.ReadByte();
                    MaxDur = I.ReadUInt16();
                    CurDur = I.ReadUInt16();
                    FreeItem = I.ReadBoolean();
                    TalismanProgress = I.ReadUInt32();
                    Progress = I.ReadUInt16();
                    Color = (ArmorColor)I.ReadByte();
                }
                else
                {
                    UID = 0;
                    ID = 0;
                    I.ReadBytes(17);
                }
            }
            else I.ReadBytes(Length);
        }
    }
    public enum Ranks : byte { Serf = 0, Knight = 1, Baron = 3, Earl = 5, Duke = 7, Prince = 9, King = 12 }
(it's line 1224 I believe(in my source...)


PLZ HELP =D!!!btw they all have to do with " unable to read beyond end of stream" something like dat...
killersub is offline  
Old 03/01/2010, 09:29   #2


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Your reading to the end of the file, theres no more data to read. Thats what that exception means.
Korvacs is offline  
Old 03/01/2010, 15:27   #3
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
Quote:
Originally Posted by Korvacs View Post
Your reading to the end of the file, theres no more data to read. Thats what that exception means.
so do u have ANY idea to fix cuz idk wtf is an exception knowing I'm a newbie here >.>...I would LOVE sum help from any1 cuz wit this error I can't even log in da client...
killersub is offline  
Old 03/01/2010, 19:31   #4
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
I really need help...If anyone is WILLING to help me in anyway please comment or pm me cuz I really need this fixed even tv will help! come on help a poor noobley out :'(
killersub is offline  
Reply


Similar Threads Similar Threads
Error with 5165
06/23/2010 - CO2 Private Server - 7 Replies
I get this error when i debug the project in c# http://img139.imageshack.us/img139/6204/errorcy.j pg Any idea how can i fix this? Edit: I'm getting another error when a char log in http://img28.imageshack.us/img28/4418/error2zh.jp g
5165 Error!
03/04/2010 - CO2 Private Server - 4 Replies
I followed Korvacs guide to run a 5165 server on Windows 7. Afterwards I tried to run the server, it got to the point where it says "Dmaps loaded successfully in 208 milliseconds" At that point it will go back to Visual C# and highlight In DMap.cs line 124 I need help.
5165 Error X_X
02/20/2010 - CO2 Private Server - 1 Replies
Aite since i like aint a decent coder, I got a error on ma source The name 'Skill' does not exist in this current context It was for the Reflect Fix Release, for (int n = 0; n < 5; n++) { BW.Write((byte)0);//WH Count
how i fix this error in c# 5165
01/16/2010 - CO2 Private Server - 15 Replies
how i fix this error http://img85.imageshack.us/img85/1940/48502865.jp g
[Help] plz what is that error 5165
12/31/2009 - CO2 Private Server - 11 Replies
when im made my server non hamachi in 5165 thats give me that error when any one try to logging to my server and he can't log and im changed the source and still same prop http://i46.tinypic.com/1zvu99s.jpg



All times are GMT +1. The time now is 08:50.


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.