Sprite[] LoadCursors(string filename) { try { var shp = new Dune2ShpReader(FileSystem.OpenWithExts(filename, exts)); return shp.Select(a => modData.SheetBuilder.Add(a.Image, a.Size)).ToArray(); } catch (IndexOutOfRangeException) // This will occur when loading a custom (RA-format) .shp { var shp = new ShpReader(FileSystem.OpenWithExts(filename, exts)); return shp.Select(a => modData.SheetBuilder.Add(a.Image, shp.Size)).ToArray(); } }
public static void ConvertFormat2ToFormat80(string[] args) { var src = args[1]; var dest = args[2]; Dune2ShpReader srcImage = null; using( var s = File.OpenRead( src ) ) srcImage = new Dune2ShpReader(s); var size = srcImage.First().Size; if (!srcImage.All( im => im.Size == size )) throw new InvalidOperationException("All the frames must be the same size to convert from Dune2 to RA"); using( var destStream = File.Create(dest) ) ShpWriter.Write(destStream, size.Width, size.Height, srcImage.Select( im => im.Image )); }
public static void ConvertFormat2ToFormat80(string[] args) { var src = args[1]; var dest = args[2]; Dune2ShpReader srcImage = null; using (var s = File.OpenRead(src)) srcImage = new Dune2ShpReader(s); var size = srcImage.First().Size; if (!srcImage.All(im => im.Size == size)) { throw new InvalidOperationException("All the frames must be the same size to convert from Dune2 to RA"); } using (var destStream = File.Create(dest)) ShpWriter.Write(destStream, size.Width, size.Height, srcImage.Select(im => im.Image)); }