예제 #1
0
        public TestApp()
        {
            JsonLogger logger = new JsonLogger();

            logger.LogError("Test error 1");
            logger.LogDebug("Test debug 1");

            logger.LogError(new LogObject("test 2"));
            logger.LogDebug(new LogObject("test debug 2"));

            logger.LogError();
            logger.LogDebug();
        }
예제 #2
0
        private void PopulateRaces()
        {
            try
            {
                Races = Newtonsoft.Json.JsonConvert.DeserializeObject <List <DefaultRace> >(FileReader.ReadFile(FileHandlersCfg.FilePathRacesFile));
            }
            catch (Exception e)
            {
                JLogger.LogError(e);
                JLogger.LogDebug("Races could not be found. Creating new default Races file.");
            }

            if (Races != null)
            {
                if (Races.Any())
                {
                    return;
                }
            }

            Races = new ListOfDefaultRaces();

            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(Races);

            FileWriter.WriteFile(FileHandlersCfg.FilePathRacesFile, jsonString);
        }
예제 #3
0
 public static void TestConnection()
 {
     try
     {
         using (SqlConnection con = new SqlConnection(CONNECTIONSTRING))
         {
         }
     }
     catch (Exception e)
     {
         JsonLogger _logger = new JsonLogger();
         LogObject  lo      = new LogObject(e);
         _logger.LogError(lo);
     }
 }