コード例 #1
0
 bool Check(TagSet a, TagSet b)
 {
     if (a.Count < 1 || b.Count < 1)
     {
         return(false);
     }
     return(a.ContainsAny(b));
 }
コード例 #2
0
 public static bool IgnoreAutofix(this TagSet set)
 {
     if (set == null)
     {
         Control.Logger.Error.Log("Found null tagset!");
         throw new NullReferenceException();
     }
     return(set.ContainsAny(AutoFixerFeature.Shared.IgnoreAutofixTags));
 }
コード例 #3
0
        internal static bool IsIgnoredByTags(TagSet tags, string[] ignoredTags)
        {
            if (tags == null || ignoredTags == null)
            {
                return(false);
            }
            var otherTags = new TagSet(ignoredTags);

            return(tags.ContainsAny(otherTags, false));
        }
コード例 #4
0
ファイル: Helper.cs プロジェクト: n1neb4ll/StoreTagEnabler
 public static bool meetsNewReqs(StarSystem instance, TagSet reqTags, TagSet exTags, TagSet curTags)
 {
     try {
         if (!curTags.ContainsAny(exTags, true))
         {
             foreach (string item in reqTags)
             {
                 if (!curTags.Contains(item))
                 {
                     if (item.StartsWith("time"))
                     {
                         string[] times = item.Split('_');
                         if (!(instance.Sim.DaysPassed >= int.Parse(times[1])))
                         {
                             return(false);
                         }
                     }
                     else if (item.StartsWith("rep"))
                     {
                         string[] reps = item.Split('_');
                         int      test = instance.Sim.GetRawReputation(Helper.getfaction(reps[1]));
                         if (!(test >= int.Parse(reps[2])))
                         {
                             return(false);
                         }
                     }
                     else
                     {
                         return(false);
                     }
                 }
             }
             Logger.LogLine("Return true");
             return(true);
         }
         return(false);
     }
     catch (Exception e) {
         Logger.LogError(e);
         return(false);
     }
 }
コード例 #5
0
        public static bool MeetsNewReqs(StarSystem instance, TagSet reqTags, TagSet exTags, TagSet curTags)
        {
            try {
                if (!curTags.ContainsAny(exTags, false))
                {
                    //Check exclution for time and rep
                    foreach (string item in exTags)
                    {
                        if (item.StartsWith("time"))
                        {
                            string[] times = item.Split('_');
                            if ((instance.Sim.DaysPassed >= int.Parse(times[1])))
                            {
                                return(false);
                            }
                        }
                        else if (item.StartsWith("rep"))
                        {
                            string[] reps = item.Split('_');
                            int      test = instance.Sim.GetRawReputation(Helper.getfaction(reps[1]));
                            if ((test >= int.Parse(reps[2])))
                            {
                                return(false);
                            }
                        }
                    }

                    //Check requirements for time and rep
                    foreach (string item in reqTags)
                    {
                        if (!curTags.Contains(item))
                        {
                            if (item.StartsWith("time"))
                            {
                                string[] times = item.Split('_');
                                if (!(instance.Sim.DaysPassed >= int.Parse(times[1])))
                                {
                                    return(false);
                                }
                            }
                            else if (item.StartsWith("rep"))
                            {
                                string[] reps = item.Split('_');
                                int      test = instance.Sim.GetRawReputation(Helper.getfaction(reps[1]));
                                if (!(test >= int.Parse(reps[2])))
                                {
                                    return(false);
                                }
                            }
                            else
                            {
                                return(false);
                            }
                        }
                    }
                    return(true);
                }
                return(false);
            }
            catch (Exception e) {
                PersistentMapClient.Logger.LogError(e);
                return(false);
            }
        }