Пример #1
0
 public static bool AddInformationLogInDataBase(InformationLog data, IdentifyClass userId = null, IdentifyClass dataId = null)
 {
     try
     {
         LogUserData     logData     = new LogUserData(data, dataId, userId);
         LogUserDataRoot logDataRoot = new LogUserDataRoot(logData);
         var             res         = logDataRoot.Save();
         if (res.Status == OperationStatusEnum.Failed)
         {
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         try
         {
             AddInformationLogInFile(new InformationLog(ex));
             AddInformationLogInFile(data, userId, dataId);
             return(false);
         }
         catch (Exception ex2)
         {
             return(false);
         }
     }
 }
Пример #2
0
        static void Main(string[] args)
        {
            _gameOver   = false;
            _statusText = "";
            Player      = new Player();

            InfoLog   = new InformationLog <int, string>();
            SectorMap = new Dictionary <int, Sector>();
            SectorMap.Add(0, new Sector(CurrentSector));
            SectorMap.TryGetValue(0, out _currentSectorMap);
            _currentSectorMap.JoinSector();

            _cancel = new Cancel();
            string fontFileName = "terminal8x8.png";
            string consoleTitle = "RobSpaceRoguelike";

            _rootConsole         = new RLRootConsole(fontFileName, ScreenWidth, ScreenHeight, 8, 8, 1f, consoleTitle);
            _rootConsole.Update += OnRootConsoleUpdate;
            _rootConsole.Render += OnRootConsoleRender;

            // TESTING - Only uncomment this if you want to pre-generate (and travel through) a number of systems.
            //TestRun(50000);

            //TestLog();

            _rootConsole.Run();
        }
Пример #3
0
        public static bool AddInformationLogInFile(InformationLog data, IdentifyClass userId = null, IdentifyClass dataId = null)
        {
            try
            {
                if (data == null)
                {
                    return(false);
                }

                if (!Directory.Exists(GetApplicationLogFileRoot()))
                {
                    return(false);
                }

                var fileAddress = GetApplicationLogFileRoot() + "/" + GetLogFileName() + ".MCMSLog";

                var message = "";
                message += "UserId : " + (userId?.ToString() ?? "NULL") + Environment.NewLine;
                message += "dataId : " + (dataId?.ToString() ?? "NULL") + Environment.NewLine;
                message += "----------------- Message Header -----------------------" + Environment.NewLine;
                message += data.PrintLong() + Environment.NewLine;
                message += "----------------- Message  Body  -----------------------" + Environment.NewLine;
                message += "->->-> " + data.SerializeObject().Replace(InformationLog.Seprator, "." + Environment.NewLine + "->->-> ") + Environment.NewLine;
                message += "----------------- End Of Message  ----------------------" + Environment.NewLine;

                using (var writer = new StreamWriter(fileAddress, true))
                {
                    writer.Write(message);
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }