Ejemplo n.º 1
0
        public static void Run()
        {
            if (System.IO.File.Exists("Config-Realm.xml") == false)
                return;

            PacketHandler.Init();

            TextReader configReader = File.OpenText("Config-Realm.xml");

            if (configReader == null)
                throw new Exception("Unable to open Config-Realm.xml");

            var doc = new XmlDocument();
            var xmlReader = XmlReader.Create(configReader);

            doc.Load(xmlReader);

            var els = doc.GetElementsByTagName("Realm");

            foreach (XmlNode node in els)
            {
                var el = node as XmlElement;

                string port = el.GetAttribute("Port");

                if (port == null)
                    throw new Exception("Config-Realm.xml includes a Realm entry that does not specify Port");

                string realmid = el.GetAttribute("RealmID");

                if (realmid == null)
                    throw new Exception("Config-Realm.xml includes a Realm entry that does not specify RealmID");

                string realmname = el.GetAttribute("Name");

                if (realmname == null)
                    throw new Exception("Config-Realm.xml includes a Realm entry that does not specify Name");
                
                string realmaddress = el.GetAttribute("Address");

                if (realmaddress == null)
                    throw new Exception("Config-Realm.xml includes a Realm entry that does not specify Address");

                RealmSettings settings = new RealmSettings();
                settings.ID = int.Parse(realmid);
                settings.RealmID = settings.ID;
                settings.Name = realmname;
                settings.Address = realmaddress;
                settings.Port = UInt16.Parse(port);

                string attrib;
                attrib = el.GetAttribute("MaxPlayers"); if (attrib != null && attrib.Length > 0) settings.MaxPlayers = int.Parse(attrib);
                attrib = el.GetAttribute("RealID"); if (attrib != null && attrib.Length > 0) settings.RealmID = int.Parse(attrib);
                attrib = el.GetAttribute("RequiredAccountLevel"); if (attrib != null && attrib.Length > 0) settings.RequiredAccountLevel = int.Parse(attrib);
                attrib = el.GetAttribute("Category"); if (attrib != null && attrib.Length > 0) settings.Cat = int.Parse(attrib);

                RealmClient client = new RealmClient(settings);
                client.Run();

                //RealmPacketHandler 
            }
        }
Ejemplo n.º 2
0
 public RealmClient(RealmSettings realmsettings)
 {
     settings = realmsettings;
 }
Ejemplo n.º 3
0
 public static object DeepCopier(object original)
 {
     Shared.RealmSettings input = ((Shared.RealmSettings)(original));
     Shared.RealmSettings result = new Shared.RealmSettings();
     Orleans.Serialization.SerializationContext.Current.RecordObject(original, result);
     result.Address = input.Address;
     result.Cat = input.Cat;
     result.ID = input.ID;
     result.Lol = input.Lol;
     result.MaxPlayers = input.MaxPlayers;
     result.Name = input.Name;
     result.Port = input.Port;
     result.RealmID = input.RealmID;
     result.RequiredAccountLevel = input.RequiredAccountLevel;
     return result;
 }
Ejemplo n.º 4
0
 public static object Deserializer(System.Type expected, global::Orleans.Serialization.BinaryTokenStreamReader stream)
 {
     Shared.RealmSettings result = new Shared.RealmSettings();
     result.Address = ((string)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(string), stream)));
     result.Cat = ((int)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(int), stream)));
     result.ID = ((int)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(int), stream)));
     result.Lol = ((string)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(string), stream)));
     result.MaxPlayers = ((int)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(int), stream)));
     result.Name = ((string)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(string), stream)));
     result.Port = ((ushort)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(ushort), stream)));
     result.RealmID = ((int)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(int), stream)));
     result.RequiredAccountLevel = ((int)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(int), stream)));
     return result;
 }
Ejemplo n.º 5
0
 public void SetRealmSettings(RealmSettings s) { settings = s; }