コード例 #1
0
        public UniversalPlatformVersion(string version, string buildVersion,
                                        string versionName, string marketingName,
                                        string codeName, JsonArray contractsArray)
        {
            Version       = version;
            BuildVersion  = buildVersion;
            VersionName   = versionName;
            MarketingName = marketingName;
            CodeName      = codeName;

            if (contractsArray == null)
            {
                return;
            }

            UniversalPlatformContract contract;

            for (uint index = 0; index < contractsArray.Count; index++)
            {
                JsonObject entry = contractsArray.GetObjectAt(index);

                contract = new UniversalPlatformContract(
                    entry["name"].GetString(),
                    entry["version"].GetString()
                    );
                VersionContracts.Add(contract);
                FilteredContracts.Add(contract);
            }
        }
コード例 #2
0
 public bool FitsFilter(string[] keywords)
 {
     FilteredContracts.Clear();
     VersionContracts.ForEach(contract =>
     {
         if (contract.FitsFilter(keywords))
         {
             FilteredContracts.Add(contract);
         }
     });
     if (FilteredContracts.Count == 0)
     {
         VersionContracts.ForEach(contract =>
         {
             FilteredContracts.Add(contract);
         });
     }
     return(keywords.All(key =>
     {
         if (Version.Contains(key, StringComparison.InvariantCultureIgnoreCase))
         {
             return true;
         }
         if (BuildVersion.Contains(key, StringComparison.InvariantCultureIgnoreCase))
         {
             return true;
         }
         if (VersionName.Contains(key, StringComparison.InvariantCultureIgnoreCase))
         {
             return true;
         }
         if (MarketingName.Contains(key, StringComparison.InvariantCultureIgnoreCase))
         {
             return true;
         }
         if (CodeName.Contains(key, StringComparison.InvariantCultureIgnoreCase))
         {
             return true;
         }
         if (FilteredContractsCount(key) > 0)
         {
             return true;
         }
         // No matches, return false
         return false;
     }
                         ));
 }