Esempio n. 1
0
 public void LoadConfig()
 {
     if (!File.Exists(ConfigPath))
     {
         Config = new ScuConfig();
     }
     else
     {
         XmlSerializer serializer = new XmlSerializer(typeof(ScuConfig));
         using (FileStream fs = new FileStream(ConfigPath, FileMode.Open)) {
             try {
                 Config = (ScuConfig)serializer.Deserialize(fs);
             }
             catch {
                 Config = new ScuConfig();
             }
         }
     }
     tbLocalAE.Text                 = Config.LocalAE;
     tbRemoteAE.Text                = Config.RemoteAE;
     tbRemoteHost.Text              = Config.RemoteHost;
     nuRemotePort.Value             = Config.RemotePort;
     nuMaxPdu.Value                 = Config.MaxPdu;
     nuTimeout.Value                = Config.Timeout;
     cbTransferSyntax.SelectedIndex = Config.TransferSyntax;
     nuQuality.Value                = Config.Quality;
     cbUseTls.Checked               = Config.UseTls;
 }
Esempio n. 2
0
        public void SaveConfig()
        {
            if (Config == null)
            {
                Config = new ScuConfig();
            }
            Config.LocalAE        = tbLocalAE.Text;
            Config.RemoteAE       = tbRemoteAE.Text;
            Config.RemoteHost     = tbRemoteHost.Text;
            Config.RemotePort     = (int)nuRemotePort.Value;
            Config.MaxPdu         = (uint)nuMaxPdu.Value;
            Config.Timeout        = (int)nuTimeout.Value;
            Config.TransferSyntax = cbTransferSyntax.SelectedIndex;
            Config.Quality        = (int)nuQuality.Value;
            Config.UseTls         = cbUseTls.Checked;
            XmlSerializer serializer = new XmlSerializer(Config.GetType());

            using (FileStream fs = new FileStream(ConfigPath, FileMode.Create)) {
                try {
                    serializer.Serialize(fs, Config);
                    fs.Flush();
                }
                catch {
                }
            }
        }
Esempio n. 3
0
 public void SaveConfig()
 {
     if (Config == null)
         Config = new ScuConfig();
     Config.LocalAE = tbLocalAE.Text;
     Config.RemoteAE = tbRemoteAE.Text;
     Config.RemoteHost = tbRemoteHost.Text;
     Config.RemotePort = (int)nuRemotePort.Value;
     Config.MaxPdu = (uint)nuMaxPdu.Value;
     Config.Timeout = (int)nuTimeout.Value;
     Config.TransferSyntax = cbTransferSyntax.SelectedIndex;
     Config.Quality = (int)nuQuality.Value;
     Config.UseTls = cbUseTls.Checked;
     XmlSerializer serializer = new XmlSerializer(Config.GetType());
     using (FileStream fs = new FileStream(ConfigPath, FileMode.Create)) {
         try {
             serializer.Serialize(fs, Config);
             fs.Flush();
         }
         catch {
         }
     }
 }
Esempio n. 4
0
 public void LoadConfig()
 {
     if (!File.Exists(ConfigPath)) {
         Config = new ScuConfig();
     }
     else {
         XmlSerializer serializer = new XmlSerializer(typeof(ScuConfig));
         using (FileStream fs = new FileStream(ConfigPath, FileMode.Open)) {
             try {
                 Config = (ScuConfig)serializer.Deserialize(fs);
             }
             catch {
                 Config = new ScuConfig();
             }
         }
     }
     tbLocalAE.Text = Config.LocalAE;
     tbRemoteAE.Text = Config.RemoteAE;
     tbRemoteHost.Text = Config.RemoteHost;
     nuRemotePort.Value = Config.RemotePort;
     nuMaxPdu.Value = Config.MaxPdu;
     nuTimeout.Value = Config.Timeout;
     cbTransferSyntax.SelectedIndex = Config.TransferSyntax;
     nuQuality.Value = Config.Quality;
     cbUseTls.Checked = Config.UseTls;
 }