public Form1() { InitializeComponent(); emptyBitmap = new Bitmap("empty.png"); pic_preview.InitialImage = emptyBitmap; pic_preview.ErrorImage = emptyBitmap; sheet = new Spritesheet(); Text = "TexEdit - ..."; updatePreview(); modified = false; }
private void automatedToolStripMenuItem_Click(object sender, System.EventArgs e) { AskSave(); FolderBrowserDialog browser = new FolderBrowserDialog(); browser.Description = "Navigate to spritesheet folder"; browser.SelectedPath = Directory.GetCurrentDirectory(); var result = browser.ShowDialog(); if (result != DialogResult.OK) { return; } string dir = browser.SelectedPath; modified = false; sheet = new Spritesheet(); sheet.MoveDir(dir); sheet.Rename(Path.GetFileName(dir)); Text = "TexEdit - " + sheet.ProjectName; var files_png = Directory.GetFiles(dir, "*.png", SearchOption.TopDirectoryOnly); foreach (var file in files_png) { sheet.Sprites.Add(new Sprite { Name = Path.GetFileName(file), Path = file, Offset = new Point(0, 0), Scale = new PointF(1.0f, 1.0f) }); } var files_jpeg = Directory.GetFiles(dir, "*.jpeg", SearchOption.TopDirectoryOnly); foreach (var file in files_jpeg) { sheet.Sprites.Add(new Sprite { Name = Path.GetFileName(file), Path = file, Offset = new Point(0, 0), Scale = new PointF(1.0f, 1.0f) }); } updateList(); updateProperties(); updatePreview(); }