Example #1
0
        private void SetGateWayLicense()
        {
            if (null == ServerState.Instance.ServerService)
            {
                return;
            }

            AdvancedSettings serverSettings = AdvancedSettings.Open(ServerState.Instance.ServerService.ServiceDirectory);
            List <string>    gatewaysList   = serverSettings.GetAddInCustomData <List <string> >(typeof(GatewaySettingsPresenter).Name, typeof(GatewayServer).Name);

            if (null == gatewaysList)
            {
                gatewaysList = new List <string>();
            }

            ServerState.Instance.ServiceAdmin.LoadServices(gatewaysList);

            foreach (string gatewayService in gatewaysList)
            {
                if (ServerState.Instance.ServiceAdmin.Services.ContainsKey(gatewayService))
                {
                    DicomService gateway    = ServerState.Instance.ServiceAdmin.Services[gatewayService];
                    string       configFile = Path.Combine(gateway.ServiceDirectory, "settings.xml");

                    gateway.Settings.LicenseFile = ServerState.Instance.ServerService.Settings.LicenseFile;
                    AddInUtils.Serialize <ServerSettings>(gateway.Settings, configFile);
                }
            }
        }
Example #2
0
        public void Configure(IWin32Window Parent, ServerSettings Settings, string ServerDirectory)
        {
            ConfigureDialog configure   = new ConfigureDialog();
            SecurityOptions options     = null;
            string          optionsFile = DicomSecurity.GetOptionsFile(ServerDirectory);


            DicomSecurity.InitializeSecurity(ServerDirectory, Settings.AETitle);
            try
            {
                options = AddInUtils.DeserializeFile <SecurityOptions>(optionsFile);
            }
            catch
            {
                options = new SecurityOptions();
            }

            configure.Text = Settings.AETitle + " Security Options";
            configure.propertyGridOptions.SelectedObject = options;
            // SetupOwnerWindow(new HandleRef(this, Parent.Handle), new HandleRef(this, configure.Handle));
            if (configure.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    AddInUtils.Serialize <SecurityOptions>(options, optionsFile);
                }
                catch { }
            }
        }
Example #3
0
        public static void InitializeSecurity(string ServerDirectory, string DisplayName)
        {
            CheckServerDirectory(ServerDirectory, DisplayName);
            string optionsFile = GetOptionsFile(ServerDirectory);

            try
            {
                if (File.Exists(optionsFile))
                {
                    _securityOptions = AddInUtils.DeserializeFile <SecurityOptions>(optionsFile);
                }
            }
            catch
            {
                _securityOptions = new SecurityOptions();
            }

            // If any of the options have changed, then rewrite
            // This code gets executed the first time the security addin is loaded
            // This is used to locate the certificate files (CA.pem, server.pem) and prepend the directory
            // If this happens, then we change the password to "test"
            // After the security options have loaded the first time, the code below never executes
            if (_securityOptions.FixFileNames(ServerDirectory))
            {
                try
                {
                    _securityOptions.KeyFilePassword = "******";
                    AddInUtils.Serialize <SecurityOptions>(_securityOptions, optionsFile);
                }
                catch (Exception)
                {
                }
            }
        }
Example #4
0
        public void Save()
        {
            string timeStamp   = "{0:yyyy-MM-dd_hh-mm-ss-tt}".FormatWith(DateTime.Now);
            string sopInstance = Dataset.GetValue <string>(DicomTag.SOPInstanceUID, string.Empty);
            string name        = string.Format("Store-{0}-{1}.fail", sopInstance, timeStamp);
            string fileName    = Path.Combine(Module.FailureDirectory, name);
            string dsFileName  = Path.Combine(Module.FailureDirectory, "{0}-{1}.dcm".FormatWith(sopInstance, timeStamp));

            FileName = dsFileName;
            AddInUtils.Serialize(this, fileName);
            Dataset.Save(dsFileName, DicomDataSetSaveFlags.None);
        }
Example #5
0
        public void Configure(IWin32Window Parent, ServerSettings Settings, string ServerDirectory)
        {
            ConfigureDialog configure = new ConfigureDialog();

            string optionsFile = HL7ServerMWL.GetOptionsFile(ServerDirectory);

            HL7ServerMWL.InitializeOptions(ServerDirectory, Settings.AETitle);

            configure.Text = Settings.AETitle + " HL7 Server Options";
            //configure.propertyGridOptions.SelectedObject = options;
            // SetupOwnerWindow(new HandleRef(this, Parent.Handle), new HandleRef(this, configure.Handle));
            if (configure.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    AddInUtils.Serialize <HL7Options>(HL7ServerMWL.HL7Options, optionsFile);
                }
                catch { }
            }
        }
        public static void InitializeOptions(string ServerDirectory, string DisplayName)
        {
            CheckServerDirectory(ServerDirectory, DisplayName);
            string optionsFile = GetOptionsFile(ServerDirectory);

            try
            {
                if (File.Exists(optionsFile))
                {
                    _hl7Options = AddInUtils.DeserializeFile <HL7Options>(optionsFile);
                }
                else
                {
                    AddInUtils.Serialize <HL7Options>(_hl7Options, optionsFile);
                }
            }
            catch
            {
                _hl7Options = new HL7Options();
            }
        }