Exemplo n.º 1
0
        public static void AddDateToMsgName(string filename, DateTime date)
        {
            // round minutes
            if (date.Second >= 30)
            {
                date = date.AddSeconds(30);
            }

            string dateText = date.ToString("yyyyMMdd-HHmm_");

            // stop if dateText is allready in filename
            if (filename.Contains(dateText))
            {
                return;
            }

            int    index       = filename.LastIndexOf('\\') + 1;
            string newFilename = filename.Insert(index, dateText);

            if (System.IO.File.Exists(newFilename))
            {
                HandleConsoleWindow.ShowConsoleWindow();
                Console.WriteLine($"Die Datei: \"{newFilename}\" ist bereits vorhanden!");
                Console.WriteLine($"Die Datei: \"{filename}\" ist demnach doppelt und sollte gelöscht werden.");
                Console.WriteLine();
                Console.WriteLine("Please press any key to continue...");
                Console.ReadKey();
            }
            else
            {
                System.IO.File.Move(filename, newFilename);
            }
        }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     if (args.Length > 0 && MessageHandler.IsMsgFile(args[0]))
     {
         MessageHandler.ProcessMsgList(args);
     }
     else if (args.Length > 0 && System.IO.Directory.Exists(args[0]))
     {
         MessageHandler.ProcessCompleteFolder(args[0]);
     }
     else if (args.Length == 0)
     {
         string path = System.IO.Directory.GetCurrentDirectory();
         MessageHandler.ProcessCompleteFolder(path);
     }
     else
     {
         HandleConsoleWindow.ShowConsoleWindow();
         Console.WriteLine("The given Argument is not valid. Please use a *.msg file or a folder path!");
         Console.WriteLine($"Argument: {args[0]}");
         Console.WriteLine();
         Console.WriteLine("Please press any key to close this application...");
         Console.ReadKey();
     }
 }