コード例 #1
0
        // HACK: GetAllColorNames collects the available color names by brute forcing the OS function.
        //   Since there is currently no known way to retrieve all possible color names,
        //   the method below just tries all indices from 0 to 0xFFF ignoring errors.
        public List <String> GetAllColorNames()
        {
            List <String> allColorNames = new List <String>();

            for (UInt32 i = 0; i < 0xFFF; i++)
            {
                IntPtr typeNamePtr = UxTheme.GetImmersiveColorNamedTypeByIndex(i);
                if (typeNamePtr != IntPtr.Zero)
                {
                    IntPtr typeName = (IntPtr)Marshal.PtrToStructure(typeNamePtr, typeof(IntPtr));
                    allColorNames.Add(Marshal.PtrToStringUni(typeName));
                }
            }

            return(allColorNames);
        }
コード例 #2
0
ファイル: AccentColorSet.cs プロジェクト: gigaherz/SmoothRun
        // HACK: GetAllColorNames collects the available color names by brute forcing the OS function.
        //   Since there is currently no known way to retrieve all possible color names,
        //   the method below just tries all indices from 0 to 0xFFF ignoring errors.
        public List <string> GetAllColorNames()
        {
            var allColorNames = new List <string>();

            for (uint i = 0; i < 0xFFF; i++)
            {
                var typeNamePtr = UxTheme.GetImmersiveColorNamedTypeByIndex(i);
                if (typeNamePtr == IntPtr.Zero)
                {
                    continue;
                }

                var typeName = (IntPtr)Marshal.PtrToStructure(typeNamePtr, typeof(IntPtr));
                allColorNames.Add(Marshal.PtrToStringUni(typeName));
            }

            return(allColorNames);
        }