示例#1
0
        /// <summary>
        /// Initializes the category.
        /// </summary>
        /// <param name="prefab">The prefab.</param>
        private bool InitializeCategory(PrefabInfo prefab)
        {
            string category = null;

            try
            {
                ItemClass.SubService subService = prefab.GetSubService();
                if (subService != ItemClass.SubService.None && subService != ItemClass.SubService.Unused2)
                {
                    category = subService.ToString();
                    if (category.Length < 6 || category.Substring(0, 6).ToLowerInvariant() != "unused")
                    {
                        this.RawCategory = "SubService:" + category;
                        this.Category    = InfoHelper.CleanCategory(category);

                        return(true);
                    }
                }
            }
            catch
            { }

            try
            {
                ItemClass.Service service = prefab.GetService();
                if (service != ItemClass.Service.None && service != ItemClass.Service.Unused2)
                {
                    category = service.ToString();
                    if (category.Length < 6 || category.Substring(0, 6).ToLowerInvariant() != "unused")
                    {
                        this.RawCategory = "Service:" + category;
                        this.Category    = InfoHelper.CleanCategory(category);

                        return(true);
                    }
                }
            }
            catch
            { }

            try
            {
                category = prefab.category;
                if (!String.IsNullOrEmpty(category))
                {
                    this.RawCategory = "Category:" + prefab.category;
                    this.Category    = InfoHelper.CleanCategory(prefab.category);

                    return(true);
                }
            }
            catch
            { }

            this.RawCategory = null;
            this.Category    = "Unknown";

            return(true);
        }
示例#2
0
 private static void Main(string[] args)
 {
     foreach (string category in serviceCategories.Split(' '))
     {
         Console.WriteLine("{0}:\t{1}", category, InfoHelper.CleanCategory(category));
     }
     Console.ReadKey();
 }