static void TestJson() { DicomStation station = new DicomStation(StationCategories.Server) { AE = "a", IPAddress = null, }; //string output = JsonConvert.SerializeObject(station); //Console.WriteLine(output); JsonSerializer serializer = new JsonSerializer(); using (StreamWriter fs = new StreamWriter(@"D:\dias.json")) { using (JsonWriter writer = new JsonTextWriter(fs)) { serializer.Serialize(writer, station); } } using (StreamReader sr = File.OpenText(@"C:\Users\fmisx\Desktop\AadProvider.Configuration.json")) { JObject o = (JObject)JToken.ReadFrom(new JsonTextReader(sr)); Parallel.ForEach(o.AsJEnumerable(), item => { Console.WriteLine($"{item}"); }); } }
/// <summary> /// Test if the dicom station can be connected. /// Throw exception if the connecting fails. /// </summary> /// <param name="dicomStation"><see cref="DataModel.DicomStation"/></param> public static async Task TestConnectionAsync(this DicomStation dicomStation) { var client = new DicomClient(); client.NegotiateAsyncOps(); client.AddRequest(new DicomCEchoRequest()); await client.SendAsync(dicomStation.IPAddress, dicomStation.Port, false, "Test", dicomStation.AE); }
public async Task UploadAsync(IEnumerable <string> filenames, DicomStation dicomStation) { var client = new DicomClient(); // Create request and push to queue. foreach (var item in filenames) { client.AddRequest(new DicomCStoreRequest(item)); } // Send the request. await client.SendAsync(dicomStation.IPAddress, dicomStation.Port, false, _callingAE, dicomStation.AE); }
public async Task UploadAsync(string filename, DicomStation dicomStation) { await UploadAsync(new string[] { filename }, dicomStation); }
public void Upload(string filename, DicomStation dicomStation) { Upload(new string[] { filename }, dicomStation); }