public static void Initialize() { config = Config.Load(); _traceDelegates = new List<TraceDelegate>(); var tracePath = Path.Combine(ExceptionHandler.LogsPath, "Traces"); var filePath = Path.Combine(tracePath, TraceFilenameFormat); if (!Directory.Exists(Path.GetDirectoryName(filePath))) Directory.CreateDirectory(Path.GetDirectoryName(filePath)); var textWriter = File.CreateText(filePath); AddTraceLogger(s => { textWriter.WriteLine("[%]: %".Form(DateTime.Now.ToLongTimeString(), s)); textWriter.Flush(); }); /*#if DEBUG var consoleThread = new Thread(AddConsole) { IsBackground = true, }; //consoleThread.Start(); #endif*/ }
public override void HandlePacket(Packet packet) { config = Config.Load(); _client = packet.Client; _authClient = packet.AuthClient; _packet = packet; _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey); switch (_packet.PacketType) { case PacketTypes.SearchFiles: SearchFile(); break; case PacketTypes.ApproveFile: ApproveFile(); break; case PacketTypes.RequestFile: RequestFile(); break; case PacketTypes.RemoveFile: RemoveFile(); break; case PacketTypes.CreateFileTree: CreateFileTree(); break; } }