Beispiel #1
0
        /// <summary>
        /// Convert OtherFlags to their AppCompatFlag REG_SZ representation.
        /// </summary>
        public static List <string> ToRegistryString(this OtherFlags enumValue)
        {
            var appCompatFlags = new List <string>();

            foreach (var flag in Enum.GetValues(typeof(OtherFlags)).Cast <OtherFlags>())
            {
                var description = OtherFlagsServices.Descriptions[flag];
                if (enumValue.HasFlag(flag) && !string.IsNullOrWhiteSpace(description))
                {
                    appCompatFlags.Add(description);
                }
            }
            return(appCompatFlags);
        }
Beispiel #2
0
        /// <summary>
        /// Convert settings to their AppCompatFlag REG_SZ representation.
        /// </summary>
        public static string ToRegistryString(CompatibilityMode compatibilityMode, ColorMode colorMode, DPIScaling dpiScaling, OtherFlags otherFlags, List <string> additionalFlags)
        {
            var substrings = new List <string>();

            // Add all flags
            substrings.AddRange(new List <string>()
            {
                compatibilityMode.ToRegistryString(),
                colorMode.ToRegistryString(),
                dpiScaling.ToRegistryString(),
            });
            substrings.AddRange(otherFlags.ToRegistryString());
            substrings.AddRange(additionalFlags);
            substrings = substrings.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();

            // On Windows 8 or above, a tilde is appended at beginning of the string.
            if (substrings.Any() && OSVersionServices.IsWindows8OrAbove)
            {
                substrings.Insert(0, RegistryServices.W8Prefix);
            }

            var appCompatFlags = string.Join(" ", substrings);

            return(appCompatFlags);
        }
 public int SameOtherFlags(BlockInfo other)
 {
     return(OtherFlags.Intersect(other.OtherFlags).Count());
 }