private void emptySpritesheetToolStripMenuItem_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; updateList(); updateProperties(); updatePreview(); }
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(); }