Exemplo n.º 1
0
 public bool Matches(IEnumerable <ProjectConfigurationPlatform> target)
 {
     if (target.Count() != TemplatedItems.Length)
     {
         return(false);
     }
     bool [] occurred = new bool [TemplatedItems.Length];
     foreach (var entry in target)
     {
         int idx = Array.FindIndex(TemplatedItems, i =>
                                   i.Property == entry.Property &&
                                   i.SolutionConfigurationName == entry.SolutionConfigurationName &&
                                   i.ConfigurationValue == entry.ConfigurationValue);
         if (idx < 0 || idx >= occurred.Length || occurred [idx])
         {
             return(false);
         }
         occurred [idx] = true;
     }
     return(occurred.All(b => b));
 }
        public override bool IsSatisfiedBy(Customer customer)
        {
            if (customer == null)
            {
                throw new ArgumentNullException(nameof(customer));
            }

            bool[] isSatisfied = new bool[3]
            {
                this.Check(this.ssnSpecification.IsSatisfiedBy(customer.Ssn),
                           LoanFailureReason.InvalidSsn),

                this.Check(this.creditScoreSpecification.IsSatisfiedBy(customer.CreditScore),
                           LoanFailureReason.LowCredit),

                this.Check(this.accountBalanceSpecification.IsSatisfiedBy(customer.BankAccount),
                           LoanFailureReason.NegativeBalance)
            };

            return(isSatisfied.All(x => x));
        }
        public virtual bool HasPrivateKey()
        {
            switch (Kty)
            {
            case JsonWebKeyType.EllipticCurve:
                return(false);

            case JsonWebKeyType.Octet:
                return(K != null);

            case JsonWebKeyType.Rsa:
            case JsonWebKeyType.RsaHsm:
                // MAY have private key parameters, but only ALL or NONE
                var privateParameters = new bool[] { D != null, DP != null, DQ != null, QI != null, P != null, Q != null };

                return(privateParameters.All((value) => value));

            default:
                return(false);
            }
        }
        public async Task Multiple_threads_can_use_the_same_generator_state()
        {
            const int threadCount = 50;
            const int valueCount  = 35;

            var generatedValues = await GenerateValuesInMultipleThreads(threadCount, valueCount);

            // Check that each value was generated once and only once
            var checks = new bool[threadCount * valueCount];

            foreach (var values in generatedValues)
            {
                Assert.Equal(valueCount, values.Count);
                foreach (var value in values)
                {
                    checks[value - 1] = true;
                }
            }

            Assert.True(checks.All(c => c));
        }
 private void _AddBytes(byte[] data)
 {
     if (Finallized)
     {
         throw new Exception("Stream File Already Closed");
     }
     else if (!_headerParsed)
     {
         if (data[4] != FLV_HEADER_BYTES[4])
         {
             // 七牛 直播云 的高端 FLV 头
             logger.Debug("FLV头[4]的值是 {0}", data[4]);
             data[4] = FLV_HEADER_BYTES[4];
         }
         var r = new bool[FLV_HEADER_BYTES.Length];
         for (int i = 0; i < FLV_HEADER_BYTES.Length; i++)
         {
             r[i] = data[i] == FLV_HEADER_BYTES[i];
         }
         bool succ = r.All(x => x);
         if (!succ)
         {
             throw new NotSupportedException("Not FLV Stream or Not Supported"); // TODO: custom Exception.
         }
         _headerParsed = true;
         _AddBytes(data.Skip(FLV_HEADER_BYTES.Length).ToArray());
     }
     else if (currentTag == null)
     {
         _buffer.Write(data, 0, data.Length);
         if (_buffer.Position >= MIN_BUFFER_SIZE)
         {
             _ParseTag(_buffer.GetBuffer().Take((int)_buffer.Position).ToArray());
         }
     }
     else
     {
         _WriteTagData(data);
     }
 }
Exemplo n.º 6
0
        private bool CorrectArgs(string[] args)
        {
            if (Usage == string.Empty)
            {
                return(args == null || args.Count() == 0);
            }

            string[] realArgs = Usage.Split(' ');

            bool[] correct = new bool[realArgs.Length];
            for (int i = 0; i < realArgs.Length; i++)
            {
                if ((i >= args.Count() && ((realArgs[i][0] == '[' && realArgs[i][realArgs[i].Length - 1] == ']'))))
                {
                    correct[i] = true;
                    continue;
                }
                if ((i >= args.Count() || string.IsNullOrWhiteSpace(args[i])))
                {
                    correct[i] = false;
                    continue;
                }

                string realArg = realArgs[i];
                string arg     = args[i];

                bool required = realArg[0] == '<' && realArg[realArg.Length - 1] == '>';
                bool optional = realArg[0] == '[' && realArg[realArg.Length - 1] == ']';

                if (required)
                {
                    correct[i] = i <= args.Length;
                }
                else if (optional)
                {
                    correct[i] = true;
                }
            }
            return(correct.All(o => o));
        }
Exemplo n.º 7
0
        static bool CanVisitAllRooms_BFS(IList <IList <int> > rooms)
        {
            var visit = new bool[rooms.Count];
            var queue = new Queue <int>();

            queue.Enqueue(0);
            visit[0] = true;
            while (queue.Count != 0)
            {
                var cur = queue.Dequeue();
                foreach (var next in rooms[cur])
                {
                    if (visit[next])
                    {
                        continue;
                    }
                    queue.Enqueue(next);
                    visit[next] = true;
                }
            }
            return(visit.All(x => x));
        }
Exemplo n.º 8
0
        public void Test()
        {
            const int MAX    = 10000;
            var       primes = MyMath.Primes(MAX).ToArray();

            for (int i = 1; i < primes.Length; i++)
            {
                Assert.True(primes[i - 1] < primes[i]);
            }
            bool[] table = new bool[MAX + 1];
            table[0] = true;
            table[1] = true;
            foreach (var item in primes)
            {
                Assert.False(table[item]);
                for (int i = item; i <= MAX; i += item)
                {
                    table[i] = true;
                }
            }
            Assert.True(table.All(x => x));
        }
Exemplo n.º 9
0
        /// <summary>
        /// Returns whether a number is pandigital to its own digit count,
        /// such that 2143 is pandigital to 4 digits.
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public bool IsPandigitalToOwnDigitCount(int number)
        {
            int digitCount = DigitHelper.DigitCount(number);

            bool[] nums = new bool[digitCount + 1];
            nums[0] = true;
            int temp = number;


            while (temp > 0)
            {
                int n = temp % 10;
                if (n > digitCount)
                {
                    return(false);                // it can't be pandigital is you have a 6 in a 5 digit number.
                }
                nums[n] = true;
                temp   /= 10;
            }

            return(nums.All(n => n));
        }
Exemplo n.º 10
0
    /// <summary>
    /// Is the player's ammo low?
    /// </summary>
    /// <returns></returns>
    public static bool InNeedOfWeapons()
    {
        //Maps the player's weapons to booleans based on whether they are low or not
        bool[] ammoIsLow = new bool[Commons.Inventory.WeaponSlots.Length];

        for (int i = 0; i < ammoIsLow.Length; i++)
        {
            var weapon = Commons.Inventory.WeaponSlots[i];

            if (weapon == null)
            {
                ammoIsLow[i] = true;
            }
            else
            {
                ammoIsLow[i] = weapon.Durability <= weapon.MaxDurability / 4f;
            }
        }

        //If all weapons are low on ammo, the player needs a new weapon
        return(ammoIsLow.All(i => i));
    }
Exemplo n.º 11
0
        private static bool CheckAvailability(int from, List <Edge>[] graph)
        {
            int n = graph.Length;

            bool[]      visited = new bool[n];
            Queue <int> queue   = new Queue <int>();

            queue.Enqueue(from);
            visited[from] = true;
            while (queue.Any())
            {
                from = queue.Dequeue();
                foreach (var edge in graph[from]
                         .Where(edge => !visited[edge.To]))
                {
                    queue.Enqueue(edge.To);
                    visited[edge.To] = true;
                }
            }

            return(visited.All(v => v));
        }
Exemplo n.º 12
0
        //   [TestMethod]
        ///TODO: Fix this test!
        public void PublishOrderedCommands_TwoCommandsAreSendInOrder_CommandsAreExecutedInOrder()
        {
            var resetEvent        = new ManualResetEventSlim(false);
            var commandsCompleted = new bool[2];

            var filterManager = new FilterManager();
            var processor     = new CommandProcessor(null, filterManager);
            var command       = new TestCommand(CommandState.New, shouldCompleteAfterExecute: false)
            {
                Order = 13
            };

            command.RegisterForStateChange(Observer.Create <CommandState>(b =>
            {
                if (b == CommandState.Successed)
                {
                    commandsCompleted[0] = true;
                }
            }));

            var command2 = new TestCommand(CommandState.New, shouldCompleteAfterExecute: true)
            {
                Order = 2
            };

            command2.RegisterForStateChange(Observer.Create <CommandState>(b =>
            {
                if (b == CommandState.Successed)
                {
                    commandsCompleted[1] = true;
                    resetEvent.Set();
                }
            }));
            processor.PublishOrderedCommands(new[] { command, command2 });

            resetEvent.Wait();

            Assert.IsTrue(commandsCompleted.All(f => f));
        }
Exemplo n.º 13
0
        static long Distance(List <int>[] adj, List <int>[] cost, int s, int t) // Dijkstra algorithm implemented with two simple arrays as a queue data structure
        {
            long[] dist  = new long[adj.Length];                                // storage for the graph with values that are on purpose bigger than allowed
            bool[] known = new bool[adj.Length];
            for (int i = 0; i < adj.Length; i++)
            {
                dist[i] = int.MaxValue; known[i] = false;
            }            // we use max. integer values while 'dist' was declared as long
            dist[s] = 0; // the only non-max value to start with is going to be the start node, so when we start scanning edges we will start updating distances from the start implicitly

            while (true)
            {
                int u = ExtractMin(dist, known);          // the whole point of this algorithm is to follow the smallest edge, as the other ones can only be bigger (relevant for non-negative) values
                if (u == -1 || known.All(x => x == true)) // first condition checks for non-connected nodes and the second if all nodes have been verified
                {
                    break;
                }

                for (int i = 0; i < adj[u].Count; i++)  // in this case we use indices inside the lists in order to maintain the relation between 'adj' and 'cost'
                {
                    int v = adj[u][i];                  // v stores the index of the node on the other end of the edge, as usual

                    if (dist[v] > dist[u] + cost[u][i]) // for direct neighbours we RELAX THE EDGES if possible
                    {
                        dist[v] = dist[u] + cost[u][i];
                    }
                }
                known[u] = true; // this is how we can CHANGE THE PRIORITY
            }

            if (dist[t] == int.MaxValue)
            {
                return(-1);
            }
            else
            {
                return(dist[t]);
            }
        }
Exemplo n.º 14
0
        static bool Solve(Random r)
        {
            var n = 580;
            var requiredBlockCount = 23;
            var blocks             = 0;
            var bools = new bool[9];

            for (int i = 0; i < n; i++)
            {
                bools[r.Next(9)] = true;
                if (bools.All(z => z))
                {
                    blocks++;
                    if (blocks == requiredBlockCount)
                    {
                        return(true);
                    }
                    bools = new bool[9];
                }
            }
            return(false);
        }
Exemplo n.º 15
0
        public void reply_with_404_to_every_request_when_there_are_no_registered_controllers()
        {
            var requests  = new[] { "/ping", "/streams", "/gossip", "/stuff", "/notfound", "/magic/url.exe" };
            var successes = new bool[requests.Length];
            var errors    = new string[requests.Length];
            var signals   = new AutoResetEvent[requests.Length];

            for (var i = 0; i < signals.Length; i++)
            {
                signals[i] = new AutoResetEvent(false);
            }

            _portableServer.Publish(new SystemMessage.SystemInit());

            for (var i = 0; i < requests.Length; i++)
            {
                var i1 = i;
                _portableServer.BuiltInClient.Get(_serverEndPoint.ToHttpUrl(requests[i]),
                                                  TimeSpan.FromMilliseconds(10000),
                                                  response =>
                {
                    successes[i1] = response.HttpStatusCode == (int)HttpStatusCode.NotFound;
                    signals[i1].Set();
                },
                                                  exception =>
                {
                    successes[i1] = false;
                    errors[i1]    = exception.Message;
                    signals[i1].Set();
                });
            }

            foreach (var signal in signals)
            {
                signal.WaitOne();
            }

            Assert.IsTrue(successes.All(x => x), string.Join(";", errors.Where(e => !string.IsNullOrEmpty(e))));
        }
Exemplo n.º 16
0
        /*
         * Called when Include Synonyms is checked.
         * Matches the contents of a file to the
         * search terms and synonyms. Returns contains if all the
         * terms or their synonyms are matched.
         * @param string[] aFile, List<HashSet<string>> newSearch
         * @return Boolean contains
         */
        static public Boolean FileMatchTermDb(string[] aFile, List <HashSet <string> > newSearch)
        {
            Boolean contains = false;                         //Boolean variable for return value

            bool[] containsTerms = new bool[newSearch.Count]; //Boolean array set to length of passed in newSearch.
            for (int i = 0; i < newSearch.Count; i++)         //iterates over newSearch
            {
                foreach (string aWord in aFile)               //fires if aWord contains term currently being iterated.
                {
                    if (newSearch[i].Contains(aWord))         //fires if aWord contains term currently being iterated.
                    {
                        containsTerms[i] = true;              //sets Boolean for that term to true
                    }
                }
            }

            if (containsTerms.All(x => x)) //fires if file contains a search term or its' synonym.
            {
                contains = true;           //sets return variable to true
            }
            return(contains);              //returns Boolean.
        }
Exemplo n.º 17
0
        public PlayerState Play(int x, int y, State state)
        {
            // Make the move
            BoardState[x, y] = state;
            MoveCount++;

            // Assigning (self OR check) so whenever one of the
            // items is set to true it won't change back to false
            var fails = new bool[4];

            for (var i = 0; i < BoardSize; i++)
            {
                // Check current row
                fails[0] = fails[0] || BoardState[x, i] != state;

                // Check current column
                fails[1] = fails[1] || BoardState[i, y] != state;

                // Move is in diagonal, check current diagonal
                fails[2] = fails[2] || x != y || BoardState[i, i] != state;

                // Check current anti diagonal
                fails[3] = fails[3] || BoardState[i, (BoardSize - 1) - i] != state;

                // All checks failed, so no winning combination
                if (fails.All(f => f))
                {
                    break;
                }

                if (i == BoardSize - 1)
                {
                    return(PlayerState.Win);
                }
            }

            return(MoveCount == BoardSize * BoardSize ?
                   PlayerState.Draw : PlayerState.Neutral);
        }
Exemplo n.º 18
0
        public bool IsConnectedGraph()
        {
            if (graph.Count <= 0)
            {
                return(false);
            }
            int vertex      = 0;
            int startVertex = 0;
            //int vertexConnected = 0;
            Queue <int> connections = new Queue <int>();

            bool[] isNewVertex = new bool[graph.Count];
            for (int i = 0; i < isNewVertex.Length; i++)
            {
                isNewVertex[i] = true;
            }
            connections.Enqueue(startVertex);
            //vertexConnected++;
            while (connections.Count > 0)
            {
                vertex = connections.Dequeue();
                //vertexConnected++;
                foreach (int connectedVertex in graph[vertex])
                {
                    if (!isNewVertex[connectedVertex])
                    {
                        continue;
                    }
                    connections.Enqueue(connectedVertex);
                    isNewVertex[connectedVertex] = false;
                }
            }
            if (!isNewVertex.All(isNew => isNew == false))
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 19
0
        public bool isSymmetric(Tile t)
        {
            int i = 0;

            bool[] symmetric = new bool[4] {
                false, false, false, false
            };

            foreach (Path p in paths)
            {
                foreach (Path pCheck in t.paths)
                {
                    if (p.isEqual(pCheck))
                    {
                        symmetric[i] = true;
                        break;
                    }
                }
                i++;
            }

            return(symmetric.All(x => x));
        }
Exemplo n.º 20
0
        // Complete the hackerrankInString function below.
        static string hackerrankInString(string s)
        {
            var hrs      = "hackerrank";
            var allChars = new bool[hrs.Length];

            var hrc = 0;
            var asc = 0;

            while (hrc < hrs.Length && asc < s.Length)
            {
                if (hrs[hrc] == s[asc])
                {
                    allChars[hrc++] = true;
                    asc++;
                }
                else
                {
                    asc++;
                }
            }

            return(allChars.All(x => x == true) ? "YES" : "NO");
        }
Exemplo n.º 21
0
        private bool isPandigital(int n)
        {
            int    i;
            string s = Convert.ToString(n);

            bool[] hasOnlyOne = new bool[s.Length + 1];
            hasOnlyOne[0] = true;   // no zeroes allowed.
            foreach (char ch in s)
            {
                i = (int)ch - (int)'0';
                if (i > s.Length)
                {
                    return(false);
                }
                if (hasOnlyOne[i])
                {
                    return(false);   // already got one...
                }
                hasOnlyOne[i] = true;
            }

            return(hasOnlyOne.All(x => x == true));
        }
Exemplo n.º 22
0
Arquivo: 2.cs Projeto: qifanyyy/CLCDSA
        private static int?LastNumber(int n)
        {
            if (n == 0)
            {
                return(null);
            }

            var seenDigits = new bool[10];
            int i          = 0;

            while (!seenDigits.All(d => d))
            {
                i++;
                var m = i * n;
                while (m > 0)
                {
                    seenDigits[m % 10] = true;
                    m /= 10;
                }
            }

            return(i * n);
        }
Exemplo n.º 23
0
        /*
         * Static as it has no class variables.
         * A ststic class to handle searching the contents of
         * files and matching them to term or term and synonym.
         */


        /*
         * Called when Include Synonyms is unchecked.
         * Matches the contents of a file to the
         * search terms. Returns contains if all the
         * terms are matched.
         * @param string[] aFile, string[] searchTerms
         * @return Boolean contains
         */
        static public Boolean FileMatchTerm(string[] aFile, string[] searchTerms)
        {
            bool[]  containsTerms = new bool[searchTerms.Length]; //Boolean array set to length of passed in searchTerms.
            Boolean contains      = false;                        //Boolean variable for return value.

            for (int i = 0; i < searchTerms.Length; i++)          //iterates over searchTerms
            {
                foreach (string aWord in aFile)                   //iterates over passed in aFile
                {
                    if (aWord == searchTerms[i].ToString())       //fires if aWord contains search term currently being iterated.
                    {
                        containsTerms[i] = true;                  //sets Boolean for that term to true.
                    }
                }
            }

            if (containsTerms.All(x => x)) //fires if file contains all search terms.
            {
                contains = true;           //sets return variable to true
            }

            return(contains);//returns Boolean.
        }
Exemplo n.º 24
0
    List <GameObject> Randomize(List <GameObject> List)
    {
        Debug.Log("Starting Randomization");
        List <GameObject> RandomList = new List <GameObject>();

        bool[] Switch   = new bool[List.Count];
        bool   Complete = false;
        int    count    = 0;

        Debug.Log(List.Count + " instance objects");

        while (!Complete)
        {
            int Rand = Random.Range(0, ObjCount);
            Debug.Log("Trying index " + Rand);
            if (!Switch[Rand])
            {
                Debug.Log("Placing in new List");

                RandomList.Add(List[Rand]);
                Switch[Rand] = true;
            }
            else
            {
                Debug.Log("Already in List");
            }
            Complete = Switch.All(x => x);
            count++;
            if (count >= 1000)
            {
                break;
            }
        }


        return(RandomList);
    }
Exemplo n.º 25
0
    public override IEnumerator <bool> EvaluateInput()
    {
        IEnumerator <bool>[] inputEvaluation = actionFragments.Select(af => af.EvaluateInput()).ToArray();
        bool[] results    = new bool[inputEvaluation.Length];
        bool[] hasResults = new bool[inputEvaluation.Length];

evaluate:
        for (int i = 0; i < inputEvaluation.Length; i++)
        {
            hasResults[i] = inputEvaluation[i].MoveNext();
            if (hasResults[i])
            {
                results[i] = inputEvaluation[i].Current;
            }
        }

        if (hasResults.All(h => !h) && !AnyOfThem)
        {
            yield return(results.Aggregate(false, (a, b) => a & b));
        }
        else if (hasResults.Any(h => !h) && results.Any(h => h) && AnyOfThem)
        {
            yield return(true);
        }
        else if (hasResults.All(h => !h) && results.All(h => !h))
        {
            yield return(false);

            yield break;
        }
        else
        {
            yield return(false);

            goto evaluate;
        }
    }
Exemplo n.º 26
0
        static bool HasAllCodes(string s, int k)
        {
            if (k > s.Length)
            {
                return(false);
            }
            int num = 0;

            for (int i = 0; i < k; i++)
            {
                num = num * 2 + 1;
            }
            var check   = new bool[num + 1];
            var str     = s.Substring(0, k);
            int tempNum = 0;

            foreach (var c in str)
            {
                tempNum = tempNum * 2 + (c - '0');
            }
            if (tempNum <= num)
            {
                check[tempNum] = true;
            }
            var pow = (int)Math.Pow(2, k - 1);

            for (int i = 1; i <= s.Length - k; i++)
            {
                tempNum -= (s[i - 1] - '0') * pow;
                tempNum  = tempNum * 2 + (s[i + k - 1] - '0');
                if (tempNum <= num)
                {
                    check[tempNum] = true;
                }
            }
            return(check.All(x => x));
        }
Exemplo n.º 27
0
        protected override void ExecuteActualQuery()
        {
            var results = new bool[ShardDatabaseCommands.Count];

            while (true)
            {
                var currentCopy = results;
                results = shardStrategy.ShardAccessStrategy.Apply(ShardDatabaseCommands, (dbCmd, i) =>
                {
                    if (currentCopy[i])                     // if we already got a good result here, do nothing
                    {
                        return(true);
                    }

                    var queryOp = shardQueryOperations[i];

                    using (queryOp.EnterQueryContext())
                    {
                        queryOp.LogQuery();
                        var result = dbCmd.Query(indexName, queryOp.IndexQuery, includes.ToArray());
                        return(queryOp.IsAcceptable(result));
                    }
                });
                if (results.All(acceptable => acceptable))
                {
                    break;
                }
                Thread.Sleep(100);
            }

            AssertNoDuplicateIdsInResults();

            var mergedQueryResult = shardStrategy.MergeQueryResults(IndexQuery, shardQueryOperations.Select(x => x.CurrentQueryResults).ToList());

            shardQueryOperations[0].ForceResult(mergedQueryResult);
            queryOperation = shardQueryOperations[0];
        }
Exemplo n.º 28
0
        public void InvokeMultipleExceptionTest()
        {
            var actionInvoked = new bool[3];

            Action @delegate = null;

            void Action1()
            {
                actionInvoked[0] = true;
            }

            void Action2()
            {
                actionInvoked[1] = true;
                throw new CustomException();
            }

            void Action3()
            {
                actionInvoked[2] = true;
                throw new CustomException2();
            }

            @delegate += Action1;
            @delegate += Action2;
            @delegate += Action3;

            var exception = Assert.ThrowsException <AggregateException>(() =>
            {
                AI4EUtilsDelegateExtensions.InvokeAll(@delegate, d => d());
            });

            Assert.IsTrue(actionInvoked.All());
            Assert.AreEqual(2, exception.InnerExceptions.Count());
            Assert.IsTrue(exception.InnerExceptions.Any(p => p is CustomException));
            Assert.IsTrue(exception.InnerExceptions.Any(p => p is CustomException2));
        }
    //Function that tests whether a side is correct
    bool testRightSide(string[][] bodyWords)
    {
        bool[]             rowCorrect = new bool[3];
        body_tile_behavior focusTile;

        // Loop for each row
        for (int i = 0; i < 3; i++)
        {
            // Loop for each column
            for (int j = 0; j < bodyWords[i].Length; j++)
            {
                focusTile = bodyTile[j, i, 1].GetComponent <body_tile_behavior>();
                // If selected and correct, set that row to correct
                if (focusTile.isSelected && (germanicWord[syllableCount] == bodyWords[i][j]))
                {
                    rowCorrect[i] = true;
                }
                // If selected and incorrect, set that row to incorrect and leave the loop
                else if (focusTile.isSelected && (germanicWord[syllableCount] != bodyWords[i][j]))
                {
                    rowCorrect[i] = false;
                    return(false);
                }
            }
        }
        if (rowCorrect.All(finished => finished))
        {
            finishedSyllables[1][syllableCount] = true;
            solved = true;
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 30
0
        public bool HasShaders(params SerializedProperty[] shaders)
        {
            if (serializedGraphicsSettings == null)
            {
                GraphicsSettings graphicsSettings = AssetDatabase.LoadAssetAtPath <GraphicsSettings>("ProjectSettings/GraphicsSettings.asset");
                serializedGraphicsSettings = new SerializedObject(graphicsSettings);
            }

            SerializedProperty arrayProp = serializedGraphicsSettings.FindProperty("m_AlwaysIncludedShaders");

            bool[] hasShaders = new bool[shaders.Length];
            for (int i = 0; i < arrayProp.arraySize; ++i)
            {
                SerializedProperty arrayElem = arrayProp.GetArrayElementAtIndex(i);
                for (int k = 0; k < shaders.Length; k++)
                {
                    if (shaders[k].objectReferenceValue == arrayElem.objectReferenceValue)
                    {
                        hasShaders[k] = true;
                    }
                }
            }
            return(hasShaders.All(x => x));
        }