123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- // Copyright (c) 2012-2020 fo-dicom contributors.
- // Licensed under the Microsoft Public License (MS-PL).
- using Dicom.Log;
- using System;
- using System.Configuration;
- using System.Threading;
- namespace Worklist_SCP
- {
- public class Program
- {
- protected Program()
- {
- }
- static void Main(string[] args)
- {
- // Initialize log manager.
-
- LogManager.SetImplementation(ConsoleLogManager.Instance);
- var configIpAddress = ConfigurationManager.AppSettings["IpAddress"];
- var configPort = ConfigurationManager.AppSettings["Port"];
- var configAETitle = ConfigurationManager.AppSettings["AETitle"];
- var configModality = ConfigurationManager.AppSettings["Modality"];
- // AETitle,CallingAE,Modality,Port,IpAddress
-
- if(args.Length == 0) {
- Console.WriteLine("启动服务器 没有传入任何参数默认启动");
- } else if(args.Length == 1){
- ConsoleLogger.Instance.Debug("启动服务器 监听端口:{0}", args);
- configPort = args[0];
- //Console.WriteLine("启动服务器 监听端口:" + args[0]);
- } else if(args.Length == 3) {
- ConsoleLogger.Instance.Debug("启动服务器 监听端口:{0} 检查类型:{1} 设备AEtitle:{2}", args);
- configPort = args[0];
- configModality = args[1];
- configAETitle = args[2];
- //Console.WriteLine("启动服务器 监听端口:" + args[0] + "\t 检查类型:" + args[1] + "\t AEtitle" + args[2]);
- } else {
- ConsoleLogger.Instance.Debug("参数个数有误 传入了{0}个参数 请检查参数列表",args.Length);
- }
-
- Console.WriteLine($"Starting QR SCP server with AET: {configAETitle} on ipAdress {configIpAddress} port {configPort}");
- WorklistServer.Start(configIpAddress, int.Parse(configPort), configAETitle, configModality);
- Console.WriteLine("Press any key to stop the service");
- //Console.Read();
- //while (true)
- //{
- // // Console.WriteLine("Stopping QR service");
- //}
- //WorklistServer.Stop();
- for (; ; )
- {
- try
- {
- Thread.Sleep(10000);
- }
- catch (ThreadInterruptedException e)
- {
- ConsoleLogger.Instance.Error("捕获异常{0}", e.Message);
- }
- }
- }
- }
- }
|