/// <summary> /// If not called with command line parameters, this will ask for the necessary parameters /// </summary> static void GetLoginParams() { Console.Write("XProtect server (url): "); _url = Console.ReadLine(); if (!_url.StartsWith("http://", true, null)) { _url = "http://" + _url; } Console.Write("Authentication: Windows Default, Windows or Basic (D/W/B) "); string str = Console.ReadLine().ToUpper(); if (str != null) { _auth = Authorizationmodes.DefaultWindows; if (str.StartsWith("W", true, null)) { _auth = Authorizationmodes.Windows; } if (str.StartsWith("B", true, null)) { _auth = Authorizationmodes.Basic; } } if (_auth != Authorizationmodes.DefaultWindows) { Console.Write("Username: "******"Password: "******"Full path and name of csv file containing the cameras to add "); _cvsFile = Console.ReadLine(); }
/// <summary> /// If not called with command line parameters, this will ask for the necessary parameters /// </summary> static void GetLoginParams() { Console.Write("XProtect server (url): "); _url = Console.ReadLine(); if (!_url.StartsWith("http://", true, null)) { _url = "http://" + _url; } Console.Write("Authentication: Windows Default, Windows or Basic (D/W/B) "); string str = Console.ReadLine(); if (str != null) { _auth = Authorizationmodes.DefaultWindows; if (str.StartsWith("W", true, null)) { _auth = Authorizationmodes.Windows; } if (str.StartsWith("B", true, null)) { _auth = Authorizationmodes.Basic; } } if (_auth != Authorizationmodes.DefaultWindows) { Console.Write("Username: "******"Password: "******"*"); } // Exit if Enter key is pressed. } while (key.Key != ConsoleKey.Enter); _securePwd.MakeReadOnly(); Console.WriteLine(); } Console.Write("Search for a camera name that contains: "); _camerasearch = Console.ReadLine(); }
static void Main(string[] args) { VideoOS.Platform.SDK.Environment.Initialize(); VideoOS.Platform.SDK.Media.Environment.Initialize(); VideoOS.Platform.SDK.Export.Environment.Initialize(); _resetEvent = new AutoResetEvent(false); if (args.Length == 5) { _url = args[0]; if (!_url.StartsWith("http://", true, null)) { _url = "http://" + _url; } string auth = args[1]; if (auth.StartsWith("B", true, null)) { _auth = Authorizationmodes.Basic; } if (auth.StartsWith("W", true, null)) { _auth = Authorizationmodes.Windows; } if (auth.StartsWith("D", true, null)) { _auth = Authorizationmodes.DefaultWindows; } _user = args[2]; _securePwd = ConvertToSecureString(args[3]); _securePwd.MakeReadOnly(); _camerasearch = args[4]; } else { if (args.Length == 3) { _url = args[0]; if (!_url.StartsWith("http://", true, null)) { _url = "http://" + _url; } string auth = args[1]; if (auth.StartsWith("D", true, null)) { _auth = Authorizationmodes.DefaultWindows; } _camerasearch = args[2]; } else { GetLoginParams(); } } if (LoginUsingCredentials()) { if (FindCamera()) { GetRes(); GetDefaultStream(); GetStreams(); } Console.WriteLine(Environment.NewLine + "Press any key to exit."); } Console.ReadKey(); Environment.Exit(0); }
static void Main(string[] args) { VideoOS.Platform.SDK.Environment.Initialize(); if (args.Length == 5) { _url = args[0]; if (!_url.StartsWith("http://", true, null)) { _url = "http://" + _url; } string auth = args[1]; if (auth.StartsWith("B", true, null)) { _auth = Authorizationmodes.Basic; } if (auth.StartsWith("W", true, null)) { _auth = Authorizationmodes.Windows; } if (auth.StartsWith("D", true, null)) { _auth = Authorizationmodes.DefaultWindows; } _user = args[2]; _pass = args[3]; _cvsFile = args[4]; } else { if (args.Length == 3) { _url = args[0]; if (!_url.StartsWith("http://", true, null)) { _url = "http://" + _url; } string auth = args[1]; if (auth.StartsWith("D", true, null)) { _auth = Authorizationmodes.DefaultWindows; } _cvsFile = args[2]; } else { GetLoginParams(); } } if (LoginUsingCurrentCredentials()) { int counter = 0; string line; try { System.IO.StreamReader file = new System.IO.StreamReader(_cvsFile); while ((line = file.ReadLine()) != null) { System.Console.WriteLine("Adding- " + line); if (AddCamera(line)) { counter++; Console.WriteLine("Added - " + line); } } } catch (Exception e) { Console.WriteLine("Exception" + e.Message); } Console.WriteLine(counter + " cameras added in total."); Console.WriteLine(Environment.NewLine + "Press any key to exit."); } Console.ReadKey(); Environment.Exit(0); }