//private UDP _Server = null; /// <summary> /// Initializes a new instance of the <see cref="Loader"/> class. /// </summary> public Loader() { Performance Perf = new Performance(); // Safe Start.. this._Launcher = new Launcher(); // Core this._MessageFactory = new MessageFactory(); this._CommandFactory = new Command_Factory(); this._ResourcesManager = new ResourcesManager(); this._Loggers = new Loggers(); // Databases //this._Redis = new Redis(); //this._MySQL = new MySQL_Backup(); // User-Side //this._EventsHandler = new EventsHandler(); //this._Parser = new Parser(); // Files //this._Fingerprint = new Fingerprint(); //this._CSV = new CSV(); this._Home = new Home(); // Optimizations this._Checker = new Checker(); // Network // this._WebAPI = new WebAPI(); this._Gateway = new Gateway(); // this._Server = new UDP(); // Test //new Test(); Console.WriteLine($"Servidor iniciado en {Perf.Stop().Milliseconds} Milisegundos.\n"); }
/// <summary> /// Starts the Thread /// </summary> public static void Start() { T = new Thread(() => { Gateway g = new Gateway(); //PacketManager ph = new PacketManager(); _CommandFactory = new Command_Factory(); _MessageFactory = new MessageFactory(); _ResourcesManager = new ResourcesManager(); MessageManager dp = new MessageManager(); _ObjectManager = new ObjectManager(); dp.Start(); //ph.Start(); // ApiManager api = new ApiManager(); ControlTimer.StopPerformanceCounter(); ControlTimer.Setup(); ConfUCS.IsServerOnline = true; Console.WriteLine("Server started, let's play Clash Royale!"); }); T.Start(); }
public void ReadFromFile(BinaryReader reader) { unk0 = reader.ReadUInt32(); uint count1 = reader.ReadUInt32(); uint count2 = reader.ReadUInt32(); Lines = new StreamMapLine[count1]; for (int i = 0; i < count1; i++) { StreamMapLine Line = new StreamMapLine(); Line.LineType = (EStreamMapLineType)reader.ReadInt32(); Line.GameID = XBinCoreUtils.ReadStringPtrWithOffset(reader); Line.MissionID = XBinCoreUtils.ReadStringPtrWithOffset(reader); Line.PartID = XBinCoreUtils.ReadStringPtrWithOffset(reader); Line.TableCommandsOffset = reader.ReadInt32(); Line.TableCommandsOffset_DEBUG = (int)(reader.BaseStream.Position + Line.TableCommandsOffset - 4); Line.NumTableCommands0 = reader.ReadInt32(); Line.NumTableCommands1 = reader.ReadInt32(); Line.IsAsync = reader.ReadInt32(); // Could be bAsync. Lines[i] = Line; } for (int i = 0; i < count1; i++) { StreamMapLine Line = Lines[i]; // Debug here. Make sure we are actually at the same offset as the Tables offset in the line. // If not, we will have big problems and undoubtedly fail. //if (Line.NumTableCommands0 > 0) //{ // Debug.Assert(reader.BaseStream.Position == Line.TableCommandsOffset_DEBUG, "We did not reach the Commands Offset"); //} reader.BaseStream.Seek(Line.TableCommandsOffset_DEBUG, SeekOrigin.Begin); // We have to read the declarations uint[] TableCommandOffsets = new uint[Line.NumTableCommands0]; uint[] TableCommandMagics = new uint[Line.NumTableCommands0]; // Create the array Line.TableCommands = new ICommand[Line.NumTableCommands0]; // Iterate and read them for (int z = 0; z < Line.TableCommands.Length; z++) { TableCommandOffsets[z] = reader.ReadUInt32(); uint ActualOffset = (uint)(reader.BaseStream.Position + TableCommandOffsets[z] - 4); TableCommandOffsets[z] = ActualOffset; TableCommandMagics[z] = reader.ReadUInt32(); } // Construct the Command. for (int z = 0; z < Line.TableCommands.Length; z++) { reader.BaseStream.Seek(TableCommandOffsets[z], SeekOrigin.Begin); ICommand Command = Command_Factory.ReadCommand(reader, TableCommandMagics[z]); Line.TableCommands[z] = Command; } } }