static void Main(string[] args) { MyClassTest obj = new MyClassTest(); obj.DoStuff(); Console.WriteLine("\nNumbers of Pages: "); Console.ReadKey(); }
public void DoStuff() { string pdfFilePath = @"C:\Users\brendan.sapience\Desktop\Customers\MFS\Batch 2\Prospectus\brs_pro_clean.pdf"; string outputPath = @"C:\AA_Tools\SplitPDFs"; int interval = 10; int pageNameSuffix = 0; // Intialize a new PdfReader instance with the contents of the source Pdf file: PdfReader reader = new PdfReader(pdfFilePath); FileInfo file = new FileInfo(pdfFilePath); string pdfFileName = file.Name.Substring(0, file.Name.LastIndexOf(".")) + "-"; MyClassTest obj = new MyClassTest(); for (int pageNumber = 1; pageNumber <= reader.NumberOfPages; pageNumber += interval) { pageNameSuffix++; string newPdfFileName = string.Format(pdfFileName + "{0}", pageNameSuffix); SplitAndSaveInterval(pdfFilePath, outputPath, pageNumber, interval, newPdfFileName); } }
static void Main(string[] args) { // start by printing out any command line arguments if there are any if (args.Length > 0) { Console.WriteLine("Number of command line arguments is {0}", args.Length); foreach (var value in args) { Console.WriteLine(value); } } else { Console.WriteLine("no command line arguments"); } // output current application and user settings Console.WriteLine("Application setting"); Console.WriteLine("AppSetting1 = {0}", CSharpBasics.Properties.Settings.Default.AppSetting1); Console.WriteLine("AppSetting2 = {0}", CSharpBasics.Properties.Settings.Default.AppSetting2); Console.WriteLine("AppSetting3 = {0}", CSharpBasics.Properties.Settings.Default.AppSetting3); Console.WriteLine("UserSetting1 = {0}", CSharpBasics.Properties.Settings.Default.UserSetting1); Console.WriteLine("UserSetting2 = {0}", CSharpBasics.Properties.Settings.Default.UserSetting2); Console.WriteLine("UserSetting3 = {0}", CSharpBasics.Properties.Settings.Default.UserSetting3); // increment the integer user setting each time run and save it. // the change should show up in the output next invocation of the program CSharpBasics.Properties.Settings.Default.UserSetting2++; Properties.Settings.Default.Save(); // use a FileSystemWatcher object as an example of an event handler function using (FileSystemWatcher watcher = new FileSystemWatcher()) { watcher.NotifyFilter = NotifyFilters.DirectoryName | NotifyFilters.FileName; // watch all files in the current directory watcher.Path = Directory.GetCurrentDirectory(); watcher.Filter = "*.*"; // add event handlers for create and delete files watcher.Created += new FileSystemEventHandler(OnChanged); watcher.Deleted += new FileSystemEventHandler(OnChanged); // begin watching watcher.EnableRaisingEvents = true; // test some directory functions MyDirectory md = new MyDirectory(); md.TestDirectory(); // perform text file i/o tests MyTextFile mtf = new MyTextFile(); mtf.TestTextFiles(); // perform binary file i/o tests MyBinaryFile mbf = new MyBinaryFile(); mbf.TestBinaryFiles(); // end watching since we are done doing file I/O watcher.EnableRaisingEvents = false; } // perform class defintion test MyClassTest mct = new MyClassTest(); mct.TestClasses(); // perform some threading tests MyThreadTest mtt = new MyThreadTest(); mtt.ThreadTest(); }