static void Main(string[] args) { Console.WriteLine("SysDVR-Client - 3.0 by exelix"); Console.WriteLine("https://github.com/exelix11/SysDVR \r\n"); if (args.Length < 1) { PrintGuide(false); } else if (args[0].Contains("help")) { PrintGuide(true); return; } bool IsUsbMode = true; IMutliStreamManager Streams = null; bool NoAudio = false, NoVideo = false; bool HasArg(string arg) => Array.IndexOf(args, arg) != -1; NoAudio = HasArg("--no-audio"); NoVideo = HasArg("--no-video"); if (NoVideo && NoAudio) { Console.WriteLine("Specify at least a video or audio target"); return; } if (args.Length == 0 || args[0].ToLower() == "rtsp") { Streams = new RTSP.SysDvrRTSPServer(!NoVideo, !NoAudio, false); } else if (args[0].ToLower() == "bridge") { IsUsbMode = false; Streams = new TCPBridgeManager(!NoVideo, !NoAudio, args[1]); } else { Streams = ParseLegacyArgs(args); } Console.WriteLine("Starting stream, press return to stop"); if (IsUsbMode) { StartUsbStreaming(Streams, args); } else { StartManagedStreaming(Streams, args); } }
static void Main(string[] args) { Console.WriteLine("SysDVR-Client - 3.0 by exelix"); Console.WriteLine("https://github.com/exelix11/SysDVR \r\n"); if (args.Length < 1) { PrintGuide(false); } else if (args[0].Contains("help")) { PrintGuide(true); return; } bool IsUsbMode = true; IMutliStreamManager Streams = null; bool NoAudio = false, NoVideo = false; int Port; bool HasArg(string arg) => Array.IndexOf(args, arg) != -1; string ArgValue(string arg) { int index = Array.IndexOf(args, arg); if (index == -1) { return(null); } if (args.Length <= index + 1) { return(null); } return(args[index + 1]); } int?ArgValueInt(string arg) { var a = ArgValue(arg); if (int.TryParse(a, out int res)) { return(res); } return(null); } NoAudio = HasArg("--no-audio"); NoVideo = HasArg("--no-video"); Port = ArgValueInt("--port") ?? 6666; if (Port <= 1024) { Console.WriteLine("Warning: ports lower than 1024 are usually reserved and may require administrator privileges"); } if (NoVideo && NoAudio) { Console.WriteLine("Specify at least a video or audio target"); return; } if (args.Length == 0 || args[0].ToLower() == "rtsp") { Streams = new RTSP.SysDvrRTSPServer(!NoVideo, !NoAudio, false, Port); } else if (args[0].ToLower() == "bridge") { IsUsbMode = false; Streams = new TCPBridgeManager(!NoVideo, !NoAudio, args[1], Port); } else { Streams = ParseLegacyArgs(args); } Console.WriteLine("Starting stream, press return to stop"); if (IsUsbMode) { StartUsbStreaming(Streams, args); } else { StartManagedStreaming(Streams, args); } }