private void OnSerializing(StreamingContext context) { // if IsTempFile but no ResourceFile, create resource file so it can be serialized if (IsTempFile && ResourceIdentifier == null) { var resFile = new EngineResourceFile(string.Format("mediafile_{0}.zip", FileName), null, false); resFile.Add(ResourceFileType, Alias, InputStream); ResourceIdentifier = new EngineResourceFileIdentifier(resFile, ResourceFileType, Alias); } }
/// <summary> /// Clear all EngineState collection properties associated with the Engine class /// </summary> public void Clear() { ValueBag.Clear(); EngineResourceFile.ClearAll(); Tilesheet.ClearAllTilesheets(); Cycle.ClearAllAnimationCycles(); GridPointMatrixes.ClearAllGridPointMatrixes(); GridPointMatrix.ClearAllGridPointMatrix(); Gondwana.Common.Drawing.Sprites.Sprites.Clear(); MediaFile.DisposeAll(); }
private void OnSerializing(StreamingContext context) { // if Bitmap is not a physical file and there is no ResourceFile, create resource file so it can be serialized if (string.IsNullOrWhiteSpace(_imgFile) && ResourceIdentifier == null) { var resFile = new EngineResourceFile(string.Format("tilesheet_{0}.zip", this.Name), null, false); var converter = new ImageConverter(); resFile.Add(EngineResourceFileTypes.Bitmap, this.Name, (Stream)converter.ConvertTo(_bmp, typeof(Stream))); ResourceIdentifier = new EngineResourceFileIdentifier(resFile, EngineResourceFileTypes.Bitmap, this.Name); } }
/// <summary> /// Captures the current values for the Gondwana.Common classes referenced by <see cref="EngineState"/> /// </summary> /// <returns></returns> public static EngineState GetEngineState() { var allTilesheets = Tilesheet.AllTilesheets; allTilesheets.Sort((x, y) => string.Compare(x.MaskName, y.MaskName)); return(new EngineState() { ResourceFiles = EngineResourceFile.GetAll(), Tilesheets = Tilesheet._tilesheets, Cycles = Cycle._cycles, GridsDisplay = GridPointMatrixes._allGridPointMatrixes, Grids = GridPointMatrix._allGridPointMatrix, Sprites = Gondwana.Common.Drawing.Sprites.Sprites._spriteList, MediaFiles = MediaFile._mediaFiles }); }
public ResourceFile(EngineResourceFile engineResourceFile) { InitializeComponent(); _engineResourceFile = engineResourceFile; UpdateLabels(); }
public Tilesheet(EngineResourceFile resFile, string entryName, string tilesheetName) { ResourceIdentifier = new EngineResourceFileIdentifier(resFile, EngineResourceFileTypes.Bitmap, entryName); InitVals(tilesheetName, null, null, ResourceIdentifier); ValueBag = new Dictionary <string, string>(); }