public static bool LoadBundleConfig(string BundleIniFile, ref Dictionary <string, BundleSettings> Bundles)
        {
            if (System.IO.File.Exists(BundleIniFile) == false)
            {
                CommandUtils.LogWarning("Unable to find bundle config ini file  {0}", BundleIniFile);
                return(false);
            }

            FileReference BundleFileReference = new FileReference(BundleIniFile);

            ConfigHierarchy BundleConfig    = new ConfigHierarchy(new ConfigFile[] { new ConfigFile(BundleFileReference) });
            int             PriorityCounter = 0;

            foreach (string SectionName in BundleConfig.SectionNames)
            {
                BundleSettings Bundle = new BundleSettings();
                Bundle.Name     = SectionName;
                Bundle.Priority = PriorityCounter;
                ++PriorityCounter;
                {
                    string ExecFileName;
                    BundleConfig.GetString(SectionName, "ExecFileName", out ExecFileName);
                    Bundle.ExecFileName = ExecFileName;
                }
                {
                    List <string> Tags;
                    BundleConfig.GetArray(SectionName, "Tags", out Tags);
                    Bundle.Tags = Tags;
                }
                {
                    List <string> FileRegex;
                    BundleConfig.GetArray(SectionName, "FileRegex", out FileRegex);
                    Bundle.FileRegex = FileRegex;
                }
                {
                    bool bContainsShaderLibrary;
                    BundleConfig.GetBool(SectionName, "ContainsShaderLibrary", out bContainsShaderLibrary);
                    Bundle.bContainsShaderLibrary = bContainsShaderLibrary;
                }
                if (Bundle.Tags == null)
                {
                    Bundle.Tags = new List <string>();
                }

                Bundles.Add(SectionName, Bundle);
            }

            return(true);
        }
Ejemplo n.º 2
0
    int CompareBundle(int otherId)
    {
        BundleSettings otherWs = BundleSettingsManager.Instance.Get((E_BundleID)(otherId));
        BundleSettings myWs    = BundleSettingsManager.Instance.Get((E_BundleID)(Id));

        //1. gold
        int res = myWs.GoldCost.CompareTo(otherWs.GoldCost);

        if (res != 0)
        {
            return(res);
        }

        //2. money
        res = myWs.MoneyCost.CompareTo(otherWs.MoneyCost);
        if (res != 0)
        {
            return(res);
        }

        //otherwise use regular order
        return(Id.CompareTo(otherId));
    }
Ejemplo n.º 3
0
 /// <summary>
 /// check setting is valid
 /// </summary>
 public bool IsValid()
 {
     return(!BundleSettings.GroupBy(setting => setting.BundleName).Any(group => group.Count() > 1 ||
                                                                       string.IsNullOrEmpty(group.Key)));
 }
Ejemplo n.º 4
0
        public static bool LoadBundleConfig(string BundleIniFile, ref Dictionary <string, BundleSettings> Bundles)
        {
            if (System.IO.File.Exists(BundleIniFile) == false)
            {
                CommandUtils.LogWarning("Unable to find bundle config ini file  {0}", BundleIniFile);
                return(false);
            }

            FileReference BundleFileReference = new FileReference(BundleIniFile);

            ConfigHierarchy BundleConfig    = new ConfigHierarchy(new ConfigFile[] { new ConfigFile(BundleFileReference) });
            int             PriorityCounter = 0;

            foreach (string SectionName in BundleConfig.SectionNames)
            {
                BundleSettings Bundle = new BundleSettings();
                Bundle.Name     = SectionName;
                Bundle.Priority = PriorityCounter;
                ++PriorityCounter;
                {
                    string OverrideName;
                    if (BundleConfig.GetString(SectionName, "OverrideName", out OverrideName))
                    {
                        Bundle.OverrideName = OverrideName;
                    }
                    else
                    {
                        Bundle.OverrideName = Bundle.Name;
                    }
                }
                {
                    string ParentName;
                    BundleConfig.GetString(SectionName, "Parent", out ParentName);
                    Bundle.ParentName = ParentName;
                }
                {
                    List <string> Tags;
                    BundleConfig.GetArray(SectionName, "Tags", out Tags);
                    Bundle.Tags = Tags;
                }
                {
                    List <string> FileRegex;
                    BundleConfig.GetArray(SectionName, "FileRegex", out FileRegex);
                    Bundle.FileRegex = FileRegex;
                }
                {
                    bool bContainsShaderLibrary;
                    BundleConfig.GetBool(SectionName, "ContainsShaderLibrary", out bContainsShaderLibrary);
                    Bundle.bContainsShaderLibrary = bContainsShaderLibrary;
                }
                if (Bundle.Tags == null)
                {
                    Bundle.Tags = new List <string>();
                }

                Bundles.Add(SectionName, Bundle);
                //BundleConfig.GetArray(SectionName, "OptionalTags", out Bundle.OptionalTags);
            }



            foreach (var BundleIt in Bundles)
            {
                BundleSettings Bundle = BundleIt.Value;
                if (Bundles.ContainsKey(Bundle.ParentName))
                {
                    BundleSettings ParentBundle = Bundles[Bundle.ParentName];
                    ParentBundle.Children.Add(Bundle);
                    Bundle.bFoundParent = true;
                }
            }
            return(true);
        }