static void Main(string[] args) { string directoryPath; directoryPath = ChooseDirectory(); FileAccessLogic logic = new FileAccessLogic(); logic.Recursive = true; logic.Verbose = true; logic.FilePattern = "*.txt"; logic.OnProcess += new FileAccessProcessEventHandler(OnProcessSimpleList); logic.OnNotify += new FileAccessNotifyEventHandler(OnNotify); Console.WriteLine(""); Console.WriteLine("Processing file or folder " + directoryPath); Console.WriteLine("Press any key to start:"); Console.ReadKey(); Console.WriteLine("******************************"); logic.Execute(directoryPath); Console.WriteLine("******************************"); Console.WriteLine(""); Console.WriteLine("Total length of all text files is {0}", sTotaTextFilesLength); Console.ReadKey(); }
static void Main(string[] args) { //if(args.Length < 1) //{ // Console.WriteLine("Missing file or folder path:" + // "\nUsage: TotalTextFilesLength filepath\\folderPath"); // return; //} // string directoryPath = args[0]; string directoryPath = ChooseDirectory(); FileAccessLogic logic = new FileAccessLogic(); logic.Recursive = true; logic.FilePattern = "*.txt"; logic.onProcess += new FileAccessProcessEventHandler(OnProcessSimpleList); logic.onNotify += new FileAccessNotifyEventHandler(OnNotify); Console.WriteLine(""); Console.WriteLine("Processing file or folder " + directoryPath); Console.WriteLine("Press any key to start:"); Console.ReadKey(); Console.WriteLine("************************************"); logic.Execute(directoryPath); Console.WriteLine("Total length of all text files is {0} bytes", sTotalTextFilesLength); Console.WriteLine("************************************"); Console.WriteLine(""); Console.ReadKey(); }
static void Main(string[] args) { string directoryPath = Directory.GetCurrentDirectory(); Console.WriteLine("Enter file formats space separated. Example( txt log exe )"); FileAccessLogic logic = new FileAccessLogic(); string userpatterns = Console.ReadLine(); string[] patterns = userpatterns.Split(' '); logic.Recursive = true; logic.onProcess += new FileAccessProcessEventHandler(OnProcessSimpleList); logic.onNotify += new FileAccessNotifyEventHandler(OnNotify); Console.WriteLine("Processing current folder " + directoryPath + " for latest files of type \"" + userpatterns + "\""); Console.WriteLine("Press any key to start:"); Console.ReadKey(); Console.WriteLine("************************************"); foreach (string pattern in patterns) { logic.FilePattern = "*." + pattern; logic.Execute(directoryPath); try { temp.Logic.Notify(String.Format("Listing \t{0} \t{1} \t{2}", String.Format("{0,-110}", temp.FileInfo.FullName), temp.FileInfo.Length + " bytes", File.GetLastWriteTime(temp.FileInfo.FullName))); } catch (Exception e) { Console.WriteLine("File of type {0} does not exist", pattern); } temp = null; } Console.WriteLine("************************************"); Console.WriteLine(""); Console.ReadKey(); }
static void Main(string[] args) { //bool recursive = false, // skip = false, // forcewritable = false, //for (int i = 0; i < args.Length; ++i) //{ //} string directoryPath; //if (args.Length < 1) //{ // //Console.WriteLine("Missing file or folder path:" + // // "\nUsage: TotalTextFilesLength filePath\\folderPath"); // //return; // directoryPath = ChooseDirectory(); //} //else //{ // directoryPath = args[0]; //} //directoryPath = args[0]; directoryPath = ChooseDirectory(); FileAccessLogic logic = new FileAccessLogic(); logic.Recursive = true; logic.Verbose = true; logic.FilePattern = "*.txt"; logic.OnProcess += new FileAccessProcessEventHandler(OnProcessSimpleList); logic.OnNotify += new FileAccessNotifyEventHandler(OnNotify); Console.WriteLine(""); Console.WriteLine("Processing file or folder " + directoryPath); Console.WriteLine("Press any key to start:"); Console.ReadKey(); Console.WriteLine("******************************"); logic.Execute(directoryPath); Console.WriteLine("******************************"); Console.WriteLine(""); Console.WriteLine("Total length of all text files is {0}", sTotaTextFilesLength); Console.ReadKey(); }
static void Main(string[] args) { process.StartInfo.FileName = "C:/Windows/Microsoft.NET/Framework64/v4.0.30319/msbuild.exe"; if (args.Length < 1 || args[0] == "--help" || args[0] == "/help" || args[0] == "--help") { Console.Write(args[0]); Console.WriteLine("\n" + "\nUsage: MyBuildApp -{buildmode} -{target} folderPath\n\nExample: MyBuildApp -Release -Build H:\\threadSamples\n"); Console.ReadKey(); return; } //process.StartInfo.FileName = "msbuild"; if (args.Length > 2) { if (args[1] == "-Release" || args[2] == "-Release") { buildmode = "Release"; } if (args[1] == "-Debug" || args[2] == "-Debug") { buildmode = "Debug"; } if (args[1] == "-Rebuild" || args[2] == "-Rebuild") { target = "Rebuild"; } if (args[1] == "-Clean" || args[2] == "-Clean") { target = "Clean"; } } //process.StartInfo.Arguments = "somefile.txt"; //string directoryPath = args[0]; string directoryPath = args[args.Length - 1];// ChooseDirectory(); FileAccessLogic logic = new FileAccessLogic(); logic.Recursive = true; logic.FilePattern = "*.vcxproj"; logic.onProcess += new FileAccessProcessEventHandler(OnProcessSimpleList); logic.onNotify += new FileAccessNotifyEventHandler(OnNotify); Console.WriteLine(""); Console.WriteLine("Processing file or folder " + directoryPath); Console.WriteLine("Press any key to start:"); Console.ReadKey(); Console.WriteLine("************************************"); logic.Execute(directoryPath); Console.WriteLine("Build Complete"); Console.WriteLine("************************************"); Console.WriteLine(""); Console.ReadKey(); }
static void Main(string[] args) { string directoryPath; string[] fileTypes; fileTypes = ChooseFileTypes();//.Split(' '); directoryPath = ChooseDirectory(); FileAccessLogic logic = new FileAccessLogic(); logic.Recursive = true; logic.Verbose = true; logic.FilePattern = "*.*"; logic.OnProcess += new FileAccessProcessEventHandler(OnProcessSimpleList); logic.OnNotify += new FileAccessNotifyEventHandler(OnNotify); Console.WriteLine(""); Console.WriteLine("Processing file or folder " + directoryPath); Console.WriteLine("Press any key to start:"); Console.ReadKey(); Console.WriteLine(""); Console.WriteLine("******************************"); Console.WriteLine(""); foreach (string extension in fileTypes) { logic.FilePattern = "*." + extension; logic.Execute(directoryPath); if (latestFile != null && logic.Verbose) { AccumulateLength(logic, latestFile); Console.WriteLine("Full Path: {0},", latestFile.FullName); Console.WriteLine("Size: {0}, Last Modified: {1}", latestFile.Length, latestFile.LastWriteTime); Console.WriteLine(); } latestFile = null; } Console.WriteLine("******************************"); Console.WriteLine(""); Console.WriteLine("Total length of latest files is {0}", sTotaTextFilesLength); Console.ReadKey(); }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Missing file or folder path: \nUsage: batchFileProcessor filepath(folderpath)"); return; } FileAccessLogic accessor = new FileAccessLogic(); accessor.OnNotify += testNotify; accessor.OnProcess += findTotalFilesLength; accessor.Recursive = true; accessor.Execute(args[0]); Console.WriteLine("Total Files length in directory {0} is {1}", args[0], totalFilesLen); // Keep the console window open in debug mode. Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Missing file or folder path: \nUsage: batchFileProcessor filepath(folderpath)"); return; } // This is another comment // This is another comment FileAccessLogic accessor = new FileAccessLogic(); accessor.FilePattern = "*.txt"; accessor.OnProcess += ProcessFile; accessor.Recursive = true; accessor.Execute(args[0]); Console.WriteLine("{0} *.txt files in directory \"{1}\" with total size {2} bytes and average size {3} bytes", fileCount, args[0], totalFilesLen, (float)totalFilesLen / fileCount); // Keep the console window open in debug mode. Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static int Main(string[] args) { string[] fileTypes = { "vcxproj", "csproj" }; directoryPath = ChooseDirectory(); /// going through the files and building msbuild scripts FileAccessLogic logic = new FileAccessLogic(); logic.Recursive = true; logic.Verbose = false; logic.FilePattern = "*.*"; logic.OnProcess += new FileAccessProcessEventHandler(OnProcessSimpleList); logic.OnNotify += new FileAccessNotifyEventHandler(OnNotify); Console.WriteLine(""); Console.WriteLine("Processing files in folder " + directoryPath); Console.WriteLine("Press any key to start:"); Console.ReadKey(); Console.WriteLine(""); Console.WriteLine("******************************"); Console.WriteLine(""); foreach (string extension in fileTypes) { logic.FilePattern = "*." + extension; logic.Execute(directoryPath); } Console.WriteLine("******************************"); Console.WriteLine(""); Console.WriteLine("Total length of msbuild files is {0}", sTotaTextFilesLength); Console.WriteLine(""); /// copying executables Console.WriteLine("Copying executables to bin\\ folder..."); Console.WriteLine(""); Console.WriteLine("******************************"); Console.WriteLine(""); if (Directory.Exists(directoryPath.TrimEnd('\\') + @"\bin")) { Directory.Delete(directoryPath.TrimEnd('\\') + @"\bin", true); } Directory.CreateDirectory(directoryPath.TrimEnd('\\') + @"\bin"); sTotaTextFilesLength = 0; logic.Recursive = true; logic.Verbose = true; logic.FilePattern = "*.exe"; logic.OnProcess -= new FileAccessProcessEventHandler(OnProcessSimpleList); logic.OnProcess += new FileAccessProcessEventHandler(OnProcessExecutables); logic.Execute(directoryPath); Console.WriteLine("******************************"); Console.WriteLine(""); Console.WriteLine("Total length of executable files is {0}", sTotaTextFilesLength); Console.WriteLine(""); /// compressing executables Compress(directoryPath.TrimEnd('\\') + @"\bin"); Console.ReadKey(); return(0); }