示例#1
0
        public void BgrToColorForCorrectLeadingByteRemoval()
        {
            // Arrange
            Color expectedResult = Color.FromArgb(255, 255, 255);

            // Act
            Color actualResult = WindowCustomizationUtility.BgrToColor("12FFFFFF");

            // Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
示例#2
0
 private static void VerifyAndLaunch()
 {
     if (WindowCustomizationUtility.IsWindows10())
     {
         Application.Run(new MainForm());
     }
     else
     {
         MessageBox.Show(
             Strings.IncompatibleSystemErrorMessage,
             Strings.IncompatibleSystemErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
 }
        /// <summary>
        /// Loads inactive accent color from a given reg file.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns>RGB Color if AccentColorInactive value is found in a reg file, returns null otherwise.</returns>
        public Color?LoadInactiveAccentColorFromRegFile(string fileName)
        {
            Color?result = null;

            var lineFound = _fileSystem.File.ReadLines(fileName).SkipWhile(line => !line.Contains("\"AccentColorInactive\""))
                            .Take(1).SingleOrDefault();

            if (lineFound != null)
            {
                Match match = Regex.Match(lineFound, "dword:([A-Fa-f0-9]{6,8})");
                if (match.Success)
                {
                    result = WindowCustomizationUtility.BgrToColor(match.Groups[1].Value);
                }
            }

            return(result);
        }
示例#4
0
 public void BgrToColorThrowsExceptionWhenArgumentIsNotHex()
 {
     // Act
     WindowCustomizationUtility.BgrToColor("D5ZZ72");
 }
示例#5
0
 public void BgrToColorThrowsExceptionWhenLengthTooShort()
 {
     // Act
     WindowCustomizationUtility.BgrToColor("007d5");
 }