Ejemplo n.º 1
0
        public static bool MoveMcfToBackup(string mcfFullPath)
        {
            bool   res = false;
            string srcPath;
            string name;
            string trgPath;

            try
            {
                srcPath = Path.GetDirectoryName(mcfFullPath);
                name    = Path.GetFileNameWithoutExtension(mcfFullPath);

                trgPath = Path.Combine(srcPath, "saved");
                OasConfig.CheckPath(trgPath);

                if (File.Exists(Path.Combine(trgPath, name)))
                {
                    File.Delete(Path.Combine(trgPath, name));
                }
                Move(mcfFullPath, Path.Combine(trgPath, name), true);

                res = true;
            }
            catch (Exception ex)
            {
                LastError = String.Format("error during moving mcf '{0}' to backup", ex.Message);
            }

            return(res);
        }
Ejemplo n.º 2
0
        public static bool MoveEmsToBackup(string emsFullPath)
        {
            bool   res = false;
            string srcPath;
            string name;
            string trgPath;

            try
            {
                srcPath = Path.GetDirectoryName(emsFullPath);
                name    = Path.GetFileNameWithoutExtension(emsFullPath);

                trgPath = Path.Combine(srcPath, "saved");
                OasConfig.CheckPath(trgPath);

                string[] caseFiles = Directory.GetFiles(srcPath, name + "*.*");
                foreach (var f in caseFiles)
                {
                    if (File.Exists(Path.Combine(trgPath, Path.GetFileName(f))))
                    {
                        File.Delete(Path.Combine(trgPath, Path.GetFileName(f)));
                    }
                    File.Move(f, Path.Combine(trgPath, Path.GetFileName(f)));
                }

                res = true;
            }
            catch (Exception ex)
            {
                LastError = String.Format("error during moving file '{0}' to backup", ex.Message);
            }

            return(res);
        }