Exemplo n.º 1
0
        private static void SavePOINT(NativeMethods.POINT value, IObjectData data, bool omitDefault)
        {
            // argument checks
            Debug.Assert(data != null);

            // save POINT value
            // there values are not omitted
            data.SetInt32Value(SettingNames.X, value.X);
            data.SetInt32Value(SettingNames.Y, value.Y);

            return;
        }
Exemplo n.º 2
0
        protected override void SaveTo(IObjectData data, bool omitDefault)
        {
            // argument checks
            Debug.Assert(data != null);

            // save settings
            data.SetBooleanValue(SettingNames.Start, this.Start, omitDefault, this.Start == Defaults.Start);
            data.SetInt32Value(SettingNames.ResumeTryCount, this.ResumeTryCount, omitDefault, this.ResumeTryCount == Defaults.ResumeTryCount);
            data.SetInt32Value(SettingNames.ResumeDelay, this.ResumeDelay, omitDefault, this.ResumeDelay == Defaults.ResumeDelay);
            data.SetInt32Value(SettingNames.ResumeInterval, this.ResumeInterval, omitDefault, this.ResumeInterval == Defaults.ResumeInterval);

            return;
        }
Exemplo n.º 3
0
        private static void SaveRECT(NativeMethods.RECT value, IObjectData data, bool omitDefault)
        {
            // argument checks
            Debug.Assert(data != null);

            // save RECT value
            // there values are not omitted
            data.SetInt32Value(SettingNames.Left, value.Left);
            data.SetInt32Value(SettingNames.Top, value.Top);
            data.SetInt32Value(SettingNames.Right, value.Right);
            data.SetInt32Value(SettingNames.Bottom, value.Bottom);

            return;
        }
Exemplo n.º 4
0
        private static void SaveWINDOWPLACEMENT(NativeMethods.WINDOWPLACEMENT value, IObjectData data, bool omitDefault)
        {
            // argument checks
            Debug.Assert(data != null);

            // save WINDOWPLACEMENT value
            // there values are not omitted
            data.SetInt32Value(SettingNames.Flags, value.Flags);
            data.SetInt32Value(SettingNames.ShowCmd, value.ShowCmd);
            data.SetObjectValue(SettingNames.MinPosition, value.MinPosition, SavePOINT);
            data.SetObjectValue(SettingNames.MaxPosition, value.MaxPosition, SavePOINT);
            data.SetObjectValue(SettingNames.NormalPosition, value.NormalPosition, SaveRECT);

            return;
        }
            public static IObjectData Format(Version value, IObjectDataValueFactory factory, bool omitDefault)
            {
                // argument checks
                if (value == null)
                {
                    return(null);
                }
                Debug.Assert(factory != null);

                IObjectData data = factory.CreateEmptyObjectData();

                data.SetInt32Value(Major, value.Major, omitDefault, value.Major == 0);
                data.SetInt32Value(Minor, value.Minor, omitDefault, value.Minor == 0);
                return(data);
            }
            public static IObjectData Format(DateTime value, IObjectDataValueFactory factory, bool omitDefault)
            {
                // argument checks
                if (value == null)
                {
                    return(null);
                }
                Debug.Assert(factory != null);

                IObjectData data = factory.CreateEmptyObjectData();

                data.SetInt32Value(Year, value.Year, omitDefault, value.Year == 0);
                data.SetInt32Value(Month, value.Month, omitDefault, value.Month == 0);
                data.SetInt32Value(Day, value.Day, omitDefault, value.Day == 0);
                return(data);
            }
Exemplo n.º 7
0
        protected override void SaveTo(IObjectData data, bool omitDefault)
        {
            // argument checks
            Debug.Assert(data != null);

            // state checks
            Debug.Assert(this.Address != null);
            Debug.Assert(IPEndPoint.MinPort <= this.Port && this.Port <= IPEndPoint.MaxPort);
            Debug.Assert(0 <= this.Backlog);

            // save settings
            data.SetValue(SettingNames.Address, this.Address, CreateIPAddressValue);                    // not omittable
            data.SetInt32Value(SettingNames.Port, this.Port);                                           // not omittable
            data.SetInt32Value(SettingNames.Backlog, this.Backlog, omitDefault, isDefault: this.Backlog == Defaults.Backlog);

            return;
        }
Exemplo n.º 8
0
        protected override void SaveTo(IObjectData data, bool omitDefault)
        {
            // argument checks
            Debug.Assert(data != null);

            // state checks
            Debug.Assert(this.MainListener != null);
            // this.AdditionalListeners can be null
            Debug.Assert(0 < this.RetryCount);

            // save settings
            data.SetObjectValue(SettingNames.MainListener, this.MainListener, false, omitDefault, Defaults.IsDefaultMainListener(this.MainListener));
            data.SetObjectArrayValue(SettingNames.AdditionalListeners, this.AdditionalListeners, omitDefault, Defaults.IsDefaultAdditionalListeners(this.AdditionalListeners));
            data.SetInt32Value(SettingNames.RetryCount, this.RetryCount, omitDefault, this.RetryCount == Defaults.RetryCount);

            return;
        }
Exemplo n.º 9
0
        protected override void SaveTo(IObjectData data, bool omitDefault)
        {
            // argument checks
            Debug.Assert(data != null);

            // state checks
            EnsureIsValid();
            Debug.Assert(string.IsNullOrEmpty(this.Host) == false || string.IsNullOrEmpty(this.ConfigurationScript) == false);
            Debug.Assert(IPEndPoint.MinPort <= this.Port && this.Port <= IPEndPoint.MaxPort);

            // save settings (these settings are not omittable)
            string host      = this.Host;
            bool   isDefault = (host == null || AreSameHostName(host, Defaults.Host));

            data.SetStringValue(SettingNames.Host, this.Host, omitDefault, isDefault);
            data.SetInt32Value(SettingNames.Port, this.Port, omitDefault, this.Port == Defaults.Port);
            data.SetStringValue(SettingNames.ConfigurationScript, this.ConfigurationScript, omitDefault, this.ConfigurationScript == Defaults.ConfigurationScript);

            return;
        }
Exemplo n.º 10
0
        protected override void SaveTo(IObjectData data, bool omitDefault)
        {
            // argument checks
            Debug.Assert(data != null);

            // save settings
            data.SetInt32Value(SettingNames.InitialSetupLevel, this.InitialSetupLevel, omitDefault, this.InitialSetupLevel == Defaults.InitialSetupLevel);
            data.SetEnumValue(SettingNames.LogLevel, this.LogLevel, omitDefault, this.LogLevel == Defaults.LogLevel);
            data.SetValue(SettingNames.Culture, this.Culture, CreateCultureInfoValue, omitDefault, Defaults.IsDefaultCulture(this.Culture));
            data.SetBooleanValue(SettingNames.NoLogo, this.NoLogo, omitDefault, this.NoLogo == Defaults.NoLogo);
            // Credentials: Note that only persistent credentials are saved.
            IEnumerable <CredentialSettings> persistentCredentials = GetPersistentCredentials();

            data.SetObjectArrayValue(SettingNames.Credentials, persistentCredentials, omitDefault, Defaults.IsDefaultCredentials(persistentCredentials));
            // SystemSettingsSwitcher: overwrite mode, not omittable (that is, isDefault should be false)
            data.SetObjectValue(SettingNames.SystemSettingsSwitcher, this.SystemSettingsSwitcher, true, omitDefault, false);
            // Proxy: replace mode, not omittable (that is, isDefault should be false)
            data.SetObjectValue(SettingNames.Proxy, this.Proxy, false, omitDefault, false);
            // GUI: overwrite mode, not omittable (that is, isDefault should be false)
            data.SetObjectValue(SettingNames.GUI, this.GUI, true, omitDefault, false);

            return;
        }