Exemple #1
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 { }
            }
        }
Exemple #2
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)
                {
                }
            }
        }
        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();
            }
        }