Ejemplo n.º 1
0
        private string GetFileName()
        {
            string dir = GetDataDirectory();

            string path = dir + _instrument.ToString() + "_" + CUtilTime.GeDateString(DateTime.Now).ToString() + ".dat";

            return(path);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            //upd 2018-04-22
            if (args.Length < 1)
            {
                Console.WriteLine("Invalid arguments. Usage: ");
                Console.WriteLine("MySQLDumper DATABASE_NAME");
                return;
            }

            string dbName = args[0];

            Process          proc      = new Process();
            ProcessStartInfo startInfo = new ProcessStartInfo();

            string path = Environment.GetEnvironmentVariable("DB_BACKUPS_PATH");

            string tm      = CUtilTime.GeDateString(DateTime.Now);
            string dirName = String.Format("{0}\\{1}\\{2}\\{3}", path, DateTime.Now.Year.ToString("D4"), DateTime.Now.Month.ToString("D2"), tm);

            CUtil.CreateDirIfNotExist(dirName);

            if (Directory.Exists(dirName))
            {
                Directory.CreateDirectory(dirName);
            }

            string tmCurrent = CUtilTime.GetDateTimeString(DateTime.Now);

            string fname = String.Format("{0}\\fulldump_{1}.sql", dirName, tmCurrent);


            startInfo.FileName  = @"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe";
            startInfo.Arguments = String.Format(@"--user=root --password=profinvest --routines --complete-insert {0} --result-file {1}",
                                                dbName,
                                                fname);


            proc.StartInfo = startInfo;

            proc.Start();
        }
/*
 *  public  string GetDirName_Isin_TF( EnmTF TF, DateTime dt)
 *  {
 *      return IsinDir + @"\" + TF.ToString();
 *  }
 *
 *  public string GetDirName_Isin_TF_Date(EnmTF TF, DateTime dt)
 *  {
 *      return GetDirName_Isin_TF(TF, dt) + @"\" + CUtil.GeDateString(dt);
 *  }
 *
 */

        /*public string GetFileName(EnmTF TF, DateTime dt)
         * {
         *
         *  return String.Format(@"{0}\{1}_{2}.xml", IsinDir, CUtilTime.GeDateString(dt), TF.ToString());
         *
         * }
         */
        public string GetFileName(string TF, DateTime dt)
        {
            return(String.Format(@"{0}\{1}_{2}.xml", IsinDir, CUtilTime.GeDateString(dt), TF));
        }