コード例 #1
0
ファイル: Program.cs プロジェクト: jas88/PACStest
        /*
         * FINDSCU with patient who DOES have data
         */
        static bool Test234(int n, bool fetch, Options o)
        {
            var pid = n switch
            {
                3 => o.EmptyID,
                4 => o.BadID,
                6 => o.EmptyID,
                7 => o.BadID,
                _ => o.GoodID
            };
            var    selfname = (n == 9) ? "HICtestBadName" : o.SelfName;
            var    pacsname = (n == 10) ? "HICtestBadName" : o.PacsName;
            var    movename = (n == 11)?"HICtestBadName":o.MoveName;
            string pacshost;
            string pacsport;

            if (n == 7)
            {
                // Cut off outbound connection mid-stream
                pacsport = (o.PacsPort + 1).ToString();
                pacshost = "127.0.0.1";
                BreakerSocket(o.PacsPort + 1, 1024, o.PacsHost, o.PacsPort, o.Verbose);
            }
            else
            {
                pacsport = o.PacsPort.ToString();
                pacshost = o.PacsHost;
            }

            int selfport;

            if (n == 8)
            {
                // Cut off incoming connection mid-stream
                selfport = o.SelfPort + 1;
                BreakerSocket(o.SelfPort, 10240, "127.0.0.1", selfport, o.Verbose);
            }
            else
            {
                selfport = o.SelfPort;
            }

            var args =
                $"-P -k \"0008,0052=STUDY\" -k \"0010,0020={pid}\" -k \"0008,0020={o.DateRange}\" {pacshost} {pacsport} -aet {selfname} -aec {pacsname}";

            if (fetch)
            {
                // ReSharper disable once HeapView.BoxingAllocation
                args = $"{args} -aem {movename} --port {selfport}";
            }
            else
            {
                args = $"{args} -k \"0008,1030=\"";
            }
            var p = new ProcResult(fetch?"movescu":"findscu", args, o.Verbose);

            if (!String.IsNullOrWhiteSpace(p.Stdout))
            {
                File.WriteAllText($"{n}-out.txt", p.Stdout);
            }
            if (!String.IsNullOrWhiteSpace(p.Stderr))
            {
                File.WriteAllText($"{n}-err.txt", p.Stderr);
            }

            return(n switch
            {
                2 => p.Stderr?.Contains($"[{o.GoodID}]", StringComparison.InvariantCultureIgnoreCase) ?? false,
                3 => String.IsNullOrWhiteSpace(p.Stdout) && string.IsNullOrWhiteSpace(p.Stderr),
                4 => String.IsNullOrWhiteSpace(p.Stdout) && string.IsNullOrWhiteSpace(p.Stderr),
                9 => p.Stderr?.Contains("MoveDestinationUnknown") ?? false,
                11 => p.Stderr?.Contains("error") ?? false,
                _ => p.Exitcode == 0
            });
コード例 #2
0
ファイル: Program.cs プロジェクト: jas88/PACStest
        static bool Test1(Options o)
        {
            var p = new ProcResult("echoscu", $"{o.PacsHost} {o.PacsPort.ToString()}", o.Verbose);

            return(p.Exitcode == 0);
        }