Esempio n. 1
0
        public SystemSettingsSwitcherSettings(IObjectData data) : base(data)
        {
            // prepare settings
            bool enableSystemSettingsSwitch = Defaults.EnableSystemSettingsSwitch;
            ActualProxySettings actualProxy = null;

            if (data != null)
            {
                // get settings from data
                enableSystemSettingsSwitch = data.GetBooleanValue(SettingNames.EnableSystemSettingsSwitch, enableSystemSettingsSwitch);
                // Note that ActualProxy should not be empty but null if the settings do not exist.
                actualProxy = data.GetObjectValue(SettingNames.ActualProxy, actualProxy, this.CreateActualProxySettings);
            }

            // set settings
            try {
                // may throw ArgumentException for an invalid value
                this.EnableSystemSettingsSwitch = enableSystemSettingsSwitch;
                this.ActualProxy = actualProxy;
            } catch (Exception exception) {
                throw new FormatException(exception.Message);
            }

            return;
        }
Esempio n. 2
0
        public SystemSettingsSwitcherSettings(SystemSettingsSwitcherSettings src) : base(src)
        {
            // argument checks
            if (src == null)
            {
                throw new ArgumentNullException(nameof(src));
            }

            // clone members
            this.EnableSystemSettingsSwitch = src.EnableSystemSettingsSwitch;
            this.ActualProxy = Clone(src.ActualProxy);

            return;
        }
        public ActualProxySettings(ActualProxySettings src) : base(src)
        {
            // argument checks
            if (src == null)
            {
                throw new ArgumentNullException(nameof(src));
            }

            // clone members
            this.host = src.host;
            this.port = src.port;
            this.configurationScript = src.configurationScript;

            return;
        }