//[STAThread] private static int Main(string[] args) { ServiceProvider.ConfigureLog(); Log.InfoWithWriteLine("digiCamControl command line utility running\n"); _arguments = new InputArguments(args, "/"); if (!args.Any() || _arguments.Contains("help")) { ShowHelp(); Console.ReadLine(); return(0); } if (_arguments.Contains("verbose")) { Log.IsVerbose = true; Log.InfoWithWriteLine(String.Format("Running in /verbose mode\n\t{0}\n\t{1}\n", ApplicationInformation.ExecutingAssembly, ApplicationInformation.CompileDate)); } if (Log.IsVerbose) { Log.VerboseWithWriteLine("Input arguments:"); int argc = 0; foreach (string arg in args) { Log.VerboseWithWriteLine(String.Format(" [{0,-2}]. {1}", argc, arg)); argc++; } Log.VerboseWithWriteLine(String.Format("\nProcessed arguments:\n{0}\n", _arguments.ToString(" "))); } InitApplication(); Thread.Sleep(1000); while (CamerasAreBusy()) { Thread.Sleep(1); } if (args != null && args.Count() == 1 && File.Exists(args[0])) { RunScript(args[0]); return(0); } if (ServiceProvider.DeviceManager.ConnectedDevices.Count == 0) { Console.WriteLine("No connected device was found ! Exiting"); return(0); } int exitCodes = ExecuteArgs(); Thread.Sleep(250); if ((Log.IsVerbose) && (_arguments.Contains("capture") || _arguments.Contains("capturenoaf") || _arguments.Contains("captureall") || _arguments.Contains("captureallnoaf"))) { /* We report this here, since the capture command has already fired above and that populated the data! */ foreach (CameraControl.Devices.BaseCameraDevice _b in ServiceProvider.DeviceManager.ConnectedDevices) { StringBuilder c = new StringBuilder(_b.ToString()); c.Append(String.Format("\n\tAdvanced properties ({0}):", _b.AdvancedProperties.Count)); foreach (Object x in _b.AdvancedProperties) { if (x is CameraControl.Devices.Classes.PropertyValue <long> ) { CameraControl.Devices.Classes.PropertyValue <long> l = (CameraControl.Devices.Classes.PropertyValue <long>)x; c.Append(String.Format("\n\t\t{0} {1}", l.Tag, l.Value)); } else if (x is CameraControl.Devices.Classes.PropertyValue <int> ) { CameraControl.Devices.Classes.PropertyValue <int> i = (CameraControl.Devices.Classes.PropertyValue <int>)x; c.Append(String.Format("\n\t\t{0} {1}", i.Tag, i.Value)); } else if (x is CameraControl.Devices.Classes.PropertyValue <uint> ) { CameraControl.Devices.Classes.PropertyValue <uint> u = (CameraControl.Devices.Classes.PropertyValue <uint>)x; c.Append(String.Format("\n\t\t{0} {1}", u.Tag, u.Value)); } } Log.VerboseWithWriteLineAlways(c); } } Thread thread = new Thread(WaitForCameras); thread.Start(); Dispatcher.Run(); return(exitCodes); }