private static bool checkValid()
        {
            if (MenuWorkshopSubmitUI.pathField.text.Length == 0 || !ReadWrite.folderExists(MenuWorkshopSubmitUI.pathField.text, false))
            {
                MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Path"));
                return(false);
            }
            ESteamUGCType state = (ESteamUGCType)MenuWorkshopSubmitUI.typeState.state;
            bool          flag  = MenuWorkshopSubmitUI.forState.state == 1;

            if (flag)
            {
                if (state != ESteamUGCType.ITEM && state != ESteamUGCType.SKIN)
                {
                    MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Curated"));
                    return(false);
                }
            }
            else if (state == ESteamUGCType.SKIN)
            {
                MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Curated"));
                return(false);
            }
            bool flag2 = false;

            if (state == ESteamUGCType.MAP)
            {
                flag2 = WorkshopTool.checkMapValid(MenuWorkshopSubmitUI.pathField.text, false);
                if (!flag2)
                {
                    MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Map"));
                }
            }
            else if (state == ESteamUGCType.LOCALIZATION)
            {
                flag2 = WorkshopTool.checkLocalizationValid(MenuWorkshopSubmitUI.pathField.text, false);
                if (!flag2)
                {
                    MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Localization"));
                }
            }
            else if (state == ESteamUGCType.OBJECT || state == ESteamUGCType.ITEM || state == ESteamUGCType.VEHICLE || state == ESteamUGCType.SKIN)
            {
                flag2 = WorkshopTool.checkBundleValid(MenuWorkshopSubmitUI.pathField.text, false);
                if (!flag2)
                {
                    MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Object"));
                }
            }
            return(flag2);
        }
示例#2
0
 private static void onItemDownloaded(DownloadItemResult_t callback)
 {
     if (DedicatedUGC.installing == null || DedicatedUGC.installing.Count == 0)
     {
         return;
     }
     if (!DedicatedUGC.installing.Remove(callback.m_nPublishedFileId.m_PublishedFileId))
     {
         return;
     }
     if (callback.m_eResult == 1)
     {
         CommandWindow.Log("Successfully downloaded workshop item: " + callback.m_nPublishedFileId.m_PublishedFileId);
         ulong  num;
         string text;
         uint   num2;
         if (SteamGameServerUGC.GetItemInstallInfo(callback.m_nPublishedFileId, ref num, ref text, 1024u, ref num2) && ReadWrite.folderExists(text, false))
         {
             if (WorkshopTool.checkMapMeta(text, false))
             {
                 DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.MAP));
                 if (ReadWrite.folderExists(text + "/Bundles", false))
                 {
                     Assets.load(text + "/Bundles", false, false, EAssetOrigin.WORKSHOP);
                 }
             }
             else if (WorkshopTool.checkLocalizationMeta(text, false))
             {
                 DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.LOCALIZATION));
             }
             else if (WorkshopTool.checkObjectMeta(text, false))
             {
                 DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.OBJECT));
                 Assets.load(text, false, false, EAssetOrigin.WORKSHOP);
             }
             else if (WorkshopTool.checkItemMeta(text, false))
             {
                 DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.ITEM));
                 Assets.load(text, false, false, EAssetOrigin.WORKSHOP);
             }
             else if (WorkshopTool.checkVehicleMeta(text, false))
             {
                 DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.VEHICLE));
                 Assets.load(text, false, false, EAssetOrigin.WORKSHOP);
             }
             if (Directory.Exists(text + "/Translations"))
             {
                 Translator.registerTranslationDirectory(text + "/Translations");
             }
             if (Directory.Exists(text + "/Content"))
             {
                 Assets.searchForAndLoadContent(text + "/Content");
             }
         }
     }
     else
     {
         CommandWindow.Log("Failed downloading workshop item: " + callback.m_nPublishedFileId.m_PublishedFileId);
     }
     DedicatedUGC.installNextItem();
 }