Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     try
     {
         Start();
         var config = PrepareConfig();
         om.Backup(config);
         End();
     }
     catch (Exception ex)
     {
         try
         {
             Log.log.Fatal("Crashed.");
             Log.log.Fatal("Message:" + ex.Message);
             Log.log.Fatal("Data:" + ex.Data);
             Log.log.Fatal("TargetSite:" + ex.TargetSite);
             Log.log.Fatal("StackTrace:" + ex.StackTrace);
             Log.log.Fatal("Source:" + ex.Source);
         }
         catch (Exception subex)
         {
             TextStreamClass.Write(CRASH_FILE_NAME, "Crashed" + "\r\n");
             var now = DateTime.Now;
             TextStreamClass.Append(CRASH_FILE_NAME, now.ToShortDateString() + " " + now.ToShortTimeString() + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "------inner------" + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "Message:" + ex.Message + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "Data:" + ex.Data);
             TextStreamClass.Append(CRASH_FILE_NAME, "TargetSite:" + ex.TargetSite + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "StackTrace:" + ex.StackTrace + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "Source:" + ex.Source + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "------outter------" + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "Message:" + subex.Message + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "Data:" + subex.Data + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "TargetSite:" + subex.TargetSite + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "StackTrace:" + subex.StackTrace + "\r\n");
             TextStreamClass.Append(CRASH_FILE_NAME, "Source:" + subex.Source + "\r\n");
         }
     }
 }
Ejemplo n.º 2
0
        private static void CreateEmptyFile()
        {
            Config config = new Config
            {
                BackupOracles = new BackupOracle[] {
                    new BackupOracle {
                        OracleDatabase      = "",
                        OracleUsername      = "",
                        OraclePassword      = "",
                        FullBackup          = true,
                        BackupTables        = null,
                        BackupDirectoryPath = ""
                    },
                    new BackupOracle {
                        OracleDatabase = "",
                        OracleUsername = "",
                        OraclePassword = "",
                        FullBackup     = false,
                        BackupTables   = new  BackupTable[] {
                            new BackupTable {
                                Tablename             = "Table1",
                                ClearTableAfterBackup = false
                            },
                            new BackupTable {
                                Tablename             = "Table2",
                                ClearTableAfterBackup = true
                            }
                        },
                        BackupDirectoryPath = ""
                    }
                }
            };
            string json = JsonConvert.SerializeObject(config, new JsonSerializerSettings {
                Formatting = Formatting.Indented, StringEscapeHandling = StringEscapeHandling.EscapeNonAscii
            });

            TextStreamClass.Write(configFilePath, json);
        }