private static void HandleFiles(ProcessFile processFile, string filePattern) { if (filePattern.Contains("*")) { ProcessAsterix(filePattern, processFile); } else if (filePattern.Equals("-r")) { Stack <string> stack = new Stack <string>(); stack.Push(Directory.GetCurrentDirectory()); while (stack.Count > 0) { string dir = stack.Pop(); DirectoryInfo dirInfo = new DirectoryInfo(dir); string pattern = Path.Combine(dirInfo.FullName, "*.jpg"); ProcessAsterix(pattern, processFile); try { foreach (string dn in Directory.GetDirectories(dir)) { stack.Push(dn); } } catch (Exception ex) { log.WarnFormat("Failed to find directory: {0}", ex); } } } else { ProcessOneFile(filePattern, processFile); } }
private static void SetParams(string[] args, ProcessFile processFile) { if (args.Count() == 1) { processFile.ExifTool = GetExifToolFullName(); } else { if (args.Count() == 2) { if (args[1].Equals(Simulate, StringComparison.InvariantCultureIgnoreCase)) { processFile.ExifTool = GetExifToolFullName(); processFile.Simulate = true; } else { processFile.ExifTool = args[1]; } } else if (args.Count() == 3) { processFile.ExifTool = args[1]; processFile.Simulate = args[2].Equals(Simulate, StringComparison.InvariantCultureIgnoreCase); } } }
private static void ProcessAsterix(string filePattern, ProcessFile processFile) { FileInfo[] files = GetFiles(filePattern); foreach (FileInfo file in files) { processFile.FileName = file.FullName; processFile.Start(); } }
private static void Main(string[] args) { if (args.Count() == 0) { Console.WriteLine("PreGoogle filename [exiftool] [simulate]"); } else { InitilizeLogging(); Console.Clear(); ProcessFile processFile = new ProcessFile(log); SetParams(args, processFile); HandleFiles(processFile, args[0]); } }
private static string ParseValue(XmlNode node) { string text = string.Empty; if (node != null) { text = node.InnerText; if (node.Attributes != null && node.Attributes.Count > 0 && node.Attributes[0].Value == "http://www.w3.org/2001/XMLSchema#base64Binary") { text = Encoding.Default.GetString(Convert.FromBase64String(text)); } if (!String.IsNullOrWhiteSpace(text)) { text = ProcessFile.LocalizedText(text); } } return(text); }
private static void ProcessOneFile(string fileName, ProcessFile processFile) { processFile.FileName = fileName; processFile.Start(); }