コード例 #1
0
 private static void RebuildItemsList()
 {
     if (SteamManager.Initialized)
     {
         WorkshopItems.subbedItems.Clear();
         foreach (PublishedFileId_t pfid in Workshop.AllSubscribedItems())
         {
             WorkshopItems.subbedItems.Add(WorkshopItem.MakeFrom(pfid));
         }
         ModLister.RebuildModList();
         ScenarioLister.MarkDirty();
     }
 }
コード例 #2
0
ファイル: WorkshopItem.cs プロジェクト: KraigXu/GameProject
        public static WorkshopItem MakeFrom(PublishedFileId_t pfid)
        {
            ulong        punSizeOnDisk;
            string       pchFolder;
            uint         punTimeStamp;
            bool         itemInstallInfo = SteamUGC.GetItemInstallInfo(pfid, out punSizeOnDisk, out pchFolder, 257u, out punTimeStamp);
            WorkshopItem workshopItem    = null;

            if (!itemInstallInfo)
            {
                workshopItem = new WorkshopItem_NotInstalled();
            }
            else
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(pchFolder);
                if (!directoryInfo.Exists)
                {
                    Log.Error("Created WorkshopItem for " + pfid + " but there is no folder for it.");
                    return(new WorkshopItem_NotInstalled());
                }
                FileInfo[] files = directoryInfo.GetFiles();
                for (int i = 0; i < files.Length; i++)
                {
                    if (files[i].Extension == ".rsc")
                    {
                        workshopItem = new WorkshopItem_Scenario();
                        break;
                    }
                }
                if (workshopItem == null)
                {
                    workshopItem = new WorkshopItem_Mod();
                }
                workshopItem.directoryInt = directoryInfo;
            }
            workshopItem.PublishedFileId = pfid;
            return(workshopItem);
        }
コード例 #3
0
        public static WorkshopItem MakeFrom(PublishedFileId_t pfid)
        {
            ulong        num;
            string       path;
            uint         num2;
            bool         itemInstallInfo = SteamUGC.GetItemInstallInfo(pfid, out num, out path, 257u, out num2);
            WorkshopItem workshopItem    = null;

            if (!itemInstallInfo)
            {
                workshopItem = new WorkshopItem_NotInstalled();
            }
            else
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(path);
                if (!directoryInfo.Exists)
                {
                    Log.Error("Created WorkshopItem for " + pfid + " but there is no folder for it.", false);
                }
                FileInfo[] files = directoryInfo.GetFiles();
                for (int i = 0; i < files.Length; i++)
                {
                    FileInfo fileInfo = files[i];
                    if (fileInfo.Extension == ".rsc")
                    {
                        workshopItem = new WorkshopItem_Scenario();
                        break;
                    }
                }
                if (workshopItem == null)
                {
                    workshopItem = new WorkshopItem_Mod();
                }
                workshopItem.directoryInt = directoryInfo;
            }
            workshopItem.PublishedFileId = pfid;
            return(workshopItem);
        }