コード例 #1
0
ファイル: Receiver.cs プロジェクト: SolomonBier/streamvis
        static Stream ParseStream(Port port, string streamString)
        {
            string[] details = streamString.Split('=');

            switch (details.Length)
            {
                case 1:
                    Path path = new Path(details[0]);
                    string name = port.GetName(path);
                    return name == null ? new Stream(path) : new Stream(path, name);
                case 2: return new Stream(new Path(details[0]), details[1]);
                default: throw new ArgumentException("streamString");
            }
        }
コード例 #2
0
ファイル: Receiver.cs プロジェクト: SolomonBier/streamvis
 static IEnumerable<Stream> GetStreams(Port port, string[] portString)
 {
     switch (portString.Length)
     {
         case 1:
             return
             (
                 from path in port.ValidPaths
                 let name = port.GetName(path)
                 select name == null ? new Stream(path) : new Stream(path, name)
             )
             .ToArray();
         case 2:
             return
             (
                 from range in portString[1].Split(',')
                 from stream in ParseRange(port, range)
                 select stream
             )
             .ToArray();
         default: throw new ArgumentException("portString");
     }
 }