Example #1
0
        public static NamePosition GetNamePosition(string regName, global::GME.MGA.IMgaFCO subject)
        {
            string       regValue = subject.RegistryValue[regName];
            NamePosition result;
            int          enumValue = 0;

            if (string.IsNullOrEmpty(regValue))
            {
                regValue = DefaultValues[regName];
            }

            enumValue = int.Parse(regValue);
            string enumName = Enum.GetName(typeof(NamePosition), enumValue);

            if (Enum.TryParse(enumName, out result))
            {
                return(result);
            }
            else
            {
                throw new FormatException(String.Format(
                                              "{0} = {1} could not be parsed as {2}.",
                                              regName,
                                              regValue,
                                              result.GetType().FullName));
            }
        }
Example #2
0
        public static int GetIntValueByName(
            string regName,
            global::GME.MGA.IMgaFCO subject)
        {
            string regValue = subject.RegistryValue[regName];
            int    result;

            if (string.IsNullOrEmpty(regValue))
            {
                regValue = DefaultValues[regName];
            }

            if (int.TryParse(regValue, out result))
            {
                return(result);
            }
            else
            {
                throw new FormatException(String.Format(
                                              "{0} = {1} could not be parsed as {2}.",
                                              regName,
                                              regValue,
                                              result.GetType().FullName));
            }
        }
Example #3
0
 public static void SetIntValueByName(
     string regName,
     global::GME.MGA.IMgaFCO subject,
     int value)
 {
     subject.RegistryValue[regName] = value.ToString();
 }
Example #4
0
 public static void SetBoolValueByName(
     string regName,
     global::GME.MGA.IMgaFCO subject,
     bool value)
 {
     subject.RegistryValue[regName] = value.ToString().ToLowerInvariant();
 }
Example #5
0
 public static void SetStrValueByName(
     string regName,
     global::GME.MGA.IMgaFCO subject,
     string value)
 {
     subject.RegistryValue[regName] = value;
 }
Example #6
0
 public static void SetColorValueByName(
     string regName,
     global::GME.MGA.IMgaFCO subject,
     System.Drawing.Color value)
 {
     subject.RegistryValue[regName] = String.Format(
         "0x{0:x2}{1:x2}{2:x2}",
         value.R,
         value.G,
         value.B);
 }
Example #7
0
        public static string GetStrValueByName(
            string regName,
            global::GME.MGA.IMgaFCO subject)
        {
            string regValue = subject.RegistryValue[regName];

            if (string.IsNullOrEmpty(regValue))
            {
                return(DefaultValues[regName]);
            }
            else
            {
                return(regValue);
            }
        }
Example #8
0
        public static System.Drawing.Color GetColorValueByName(
            string regName,
            global::GME.MGA.IMgaFCO subject)
        {
            string regValue = subject.RegistryValue[regName];

            System.Drawing.Color result = System.Drawing.Color.Gray;

            if (string.IsNullOrEmpty(regValue))
            {
                regValue = DefaultValues[regName];
            }
            int color = Convert.ToInt32(regValue.Substring("0x".Length), 16);

            result = System.Drawing.ColorTranslator.FromWin32(color);

            return(result);
        }
Example #9
0
 public PreferencesSet(global::GME.MGA.IMgaFCO impl)
     : base(impl)
 {
 }
Example #10
0
        public PreferencesFCO(global::GME.MGA.IMgaFCO impl)
        {
            Contract.Requires(impl != null);

            this.Impl = impl;
        }
Example #11
0
 public PreferencesConnection(global::GME.MGA.IMgaFCO impl)
     : base(impl)
 {
 }