/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="contentCore">SMAPI's core content logic.</param> /// <param name="contentManager">The content manager for this mod.</param> /// <param name="modFolderPath">The absolute path to the mod folder.</param> /// <param name="modID">The unique ID of the relevant mod.</param> /// <param name="modName">The friendly mod name for use in errors.</param> /// <param name="monitor">Encapsulates monitoring and logging.</param> public ContentHelper(ContentCore contentCore, ContentManagerShim contentManager, string modFolderPath, string modID, string modName, IMonitor monitor) : base(modID) { this.ContentCore = contentCore; this.ContentManager = contentManager; this.ModFolderPath = modFolderPath; this.ModName = modName; this.Monitor = monitor; }
public static TextureEntry Read(Stream input) { string textureName = input.ReadString(); int size = input.ReadInt32BE(); if (size < 0) { throw new EntryReadException(string.Format(ERR_TEXTURE_SIZE, textureName, size)); } if (input.Length - input.Position < size) { throw new EntryReadException(string.Format(ERR_TEXTURE_DATA, textureName, size)); } var originalPosition = input.Position; var crs = ContentManagerShim.GetContentReaderFromXnb(textureName, input, new BinaryReader(input)); var entry = new TextureEntry() { Name = textureName, Texture = (Texture)crs.ReadAsset <Texture>() }; input.Position = originalPosition + size; return(entry); }