Esempio n. 1
0
        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);
        }
Esempio n. 2
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);
        }