private void HandleCrashLogFileRequest(CrashLogFileRequestPacket packet)
        {
            // Rewrite
            if (!Authorized)
            {
                SendPacket(new AuthorizationDisconnectPacket { Reason = "Not authorized!" });
                return;
            }

            if (File.Exists(Core.Setting.ApplicationDirectory + "\\CrashLogs\\" + packet.CrashLogFilename))
            {
                SendPacket(new CrashLogFileResponsePacket { CrashLogFilename = packet.CrashLogFilename, CrashLogFile = File.ReadAllText(Core.Setting.ApplicationDirectory + "\\CrashLogs\\" + packet.CrashLogFilename) });
            }
        }
예제 #2
0
        private void HandleCrashLogFileRequest(CrashLogFileRequestPacket packet)
        {
            if (!Authorized)
            {
                SendPacket(new AuthorizationDisconnectPacket {Reason = "Not authorized!"});
                return;
            }

            if (Storage.CrashLogFolder.CheckExistsAsync(packet.CrashLogFilename).Result == ExistenceCheckResult.FileExists)
                using (var reader = new StreamReader(Storage.CrashLogFolder.GetFileAsync(packet.CrashLogFilename).Result.OpenAsync(FileAccess.Read).Result))
                {
                    var logText = reader.ReadToEnd();
                    SendPacket(new CrashLogFileResponsePacket {CrashLogFilename = packet.CrashLogFilename, CrashLogFile = logText});
                }
        }