private void Init() { meta = DirectXmlLoader.ItemFromXmlFile <ModMetaDataInternal>(RootDir.FullName + Path.DirectorySeparatorChar + "About" + Path.DirectorySeparatorChar + "About.xml"); loadFolders = DirectXmlLoader.ItemFromXmlFile <ModLoadFolders>(RootDir.FullName + Path.DirectorySeparatorChar + "LoadFolders.xml"); bool shouldLogIssues = ModLister.ShouldLogIssues; HadIncorrectlyFormattedVersionInMetadata = !meta.TryParseSupportedVersions(!OnSteamWorkshop && shouldLogIssues); if (meta.name.NullOrEmpty()) { if (OnSteamWorkshop) { meta.name = "Workshop mod " + FolderName; } else { meta.name = FolderName; } } HadIncorrectlyFormattedPackageId = !meta.TryParsePackageId(Official, !OnSteamWorkshop && shouldLogIssues); packageIdLowerCase = meta.packageId.ToLower(); meta.InitVersionedData(); meta.ValidateDependencies_NewTmp(shouldLogIssues); string publishedFileIdPath = PublishedFileIdPath; if (File.Exists(PublishedFileIdPath) && ulong.TryParse(File.ReadAllText(publishedFileIdPath), out var result)) { publishedFileIdInt = new PublishedFileId_t(result); } }
private void Init() { this.meta = DirectXmlLoader.ItemFromXmlFile <ModMetaDataInternal>(this.RootDir.FullName + Path.DirectorySeparatorChar + "About" + Path.DirectorySeparatorChar + "About.xml", true); if (this.meta.name.NullOrEmpty()) { if (this.OnSteamWorkshop) { this.meta.name = "Workshop mod " + this.Identifier; } else { this.meta.name = this.Identifier; } } if (!this.IsCoreMod && !this.OnSteamWorkshop && !VersionControl.IsWellFormattedVersionString(this.meta.targetVersion)) { Log.ErrorOnce("Mod " + this.meta.name + " has incorrectly formatted target version '" + this.meta.targetVersion + "'. For the current version, write: <targetVersion>" + VersionControl.CurrentVersionString + "</targetVersion>", this.Identifier.GetHashCode()); } LongEventHandler.ExecuteWhenFinished(delegate { string url = GenFilePaths.SafeURIForUnityWWWFromPath(this.PreviewImagePath); using (WWW wWW = new WWW(url)) { wWW.threadPriority = UnityEngine.ThreadPriority.High; while (!wWW.isDone) { Thread.Sleep(1); } if (wWW.error == null) { this.previewImage = wWW.textureNonReadable; } } }); string publishedFileIdPath = this.PublishedFileIdPath; if (File.Exists(this.PublishedFileIdPath)) { string s = File.ReadAllText(publishedFileIdPath); this.publishedFileIdInt = new PublishedFileId_t(ulong.Parse(s)); } }