diff --git a/FlashpointCC/Curation.cs b/FlashpointCC/Curation.cs index 0ee0551..c1aa365 100644 --- a/FlashpointCC/Curation.cs +++ b/FlashpointCC/Curation.cs @@ -10,16 +10,41 @@ namespace FlashpointCurator { public class Curation { - public static string[] Modes { get { return new string[] { "Single Player", "Multiplayer" }; } } + public static string[] Modes { get + { + return new string[] + { + "Single Player", + "Multiplayer", + "Cooperative" + }; + } } - public static string[] Statuses { get { - return new string[] { - "Playable", "Playable (Hacked)", "Playable (Web Browser)", "Playable (Web Browser) (Hacked)", "Playable (Partial)" }; } } + public static string[] Statuses { get + { + return new string[] + { + "Playable", + "Playable (Partial)", + "Playable (Hacked)", + "Playable (Web Browser)", + "Playable (Web Browser) (Hacked)", + "Not Working" + }; + } } public static string[] Genres { get; set; } public string Title { get; set; } + public string Series { get; set; } + + public string Platform { get; set; } + + public string Developer { get; set; } + + public string Publisher { get; set; } + [MetaIgnore] public DateTime? ReleaseDate { get; set; } @@ -45,21 +70,15 @@ public string ReleaseDateString public string Genre { get; set; } - public string Developer { get; set; } - - public string Series { get; set; } - [MetaElement(ElementName = "Play Mode")] public string PlayMode { get; set; } + public string Extreme { get; set; } + public string Status { get; set; } public string Source { get; set; } - public string Platform { get; set; } - - public string Publisher { get; set; } - [MetaElement(ElementName = "Launch Command")] public string LaunchCommand { get; set; } diff --git a/FlashpointCC/CurationForm.Designer.cs b/FlashpointCC/CurationForm.Designer.cs index bb06771..a0172da 100644 --- a/FlashpointCC/CurationForm.Designer.cs +++ b/FlashpointCC/CurationForm.Designer.cs @@ -76,12 +76,12 @@ private void InitializeComponent() this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.importCurationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addToFlashpointToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.selectFlashpointPathToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openCurationFileDialog = new System.Windows.Forms.OpenFileDialog(); this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); - this.selectFlashpointPathToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip.SuspendLayout(); this.groupBox1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); @@ -208,7 +208,9 @@ private void InitializeComponent() // this.genreComboBox.Dock = System.Windows.Forms.DockStyle.Fill; this.genreComboBox.FormattingEnabled = true; + this.genreComboBox.IntegralHeight = false; this.genreComboBox.Location = new System.Drawing.Point(3, 3); + this.genreComboBox.MaxDropDownItems = 17; this.genreComboBox.Name = "genreComboBox"; this.genreComboBox.Size = new System.Drawing.Size(189, 21); this.genreComboBox.TabIndex = 19; @@ -581,7 +583,7 @@ private void InitializeComponent() // this.newToolStripMenuItem.Name = "newToolStripMenuItem"; this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); - this.newToolStripMenuItem.Size = new System.Drawing.Size(196, 22); + this.newToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.newToolStripMenuItem.Text = "&New"; this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); // @@ -589,28 +591,35 @@ private void InitializeComponent() // this.importCurationToolStripMenuItem.Name = "importCurationToolStripMenuItem"; this.importCurationToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); - this.importCurationToolStripMenuItem.Size = new System.Drawing.Size(196, 22); + this.importCurationToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.importCurationToolStripMenuItem.Text = "&Import Curation"; this.importCurationToolStripMenuItem.Click += new System.EventHandler(this.importCurationToolStripMenuItem_Click); // // addToFlashpointToolStripMenuItem // this.addToFlashpointToolStripMenuItem.Name = "addToFlashpointToolStripMenuItem"; - this.addToFlashpointToolStripMenuItem.Size = new System.Drawing.Size(196, 22); + this.addToFlashpointToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.addToFlashpointToolStripMenuItem.Text = "&Add to Flashpoint"; this.addToFlashpointToolStripMenuItem.Visible = false; this.addToFlashpointToolStripMenuItem.Click += new System.EventHandler(this.addToFlashpointToolStripMenuItem_Click); // + // selectFlashpointPathToolStripMenuItem + // + this.selectFlashpointPathToolStripMenuItem.Name = "selectFlashpointPathToolStripMenuItem"; + this.selectFlashpointPathToolStripMenuItem.Size = new System.Drawing.Size(199, 22); + this.selectFlashpointPathToolStripMenuItem.Text = "Select Flashpoint Path..."; + this.selectFlashpointPathToolStripMenuItem.Click += new System.EventHandler(this.selectFlashpointPathToolStripMenuItem_Click); + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(193, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(196, 6); // // preferencesToolStripMenuItem // this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem"; this.preferencesToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); - this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(196, 22); + this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.preferencesToolStripMenuItem.Text = "&Preferences"; this.preferencesToolStripMenuItem.Click += new System.EventHandler(this.preferencesToolStripMenuItem_Click); // @@ -618,7 +627,7 @@ private void InitializeComponent() // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); - this.exitToolStripMenuItem.Size = new System.Drawing.Size(196, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -627,13 +636,6 @@ private void InitializeComponent() this.openCurationFileDialog.DefaultExt = "zip"; this.openCurationFileDialog.Filter = "ZIP Archives (*.zip)|*.zip"; // - // selectFlashpointPathToolStripMenuItem - // - this.selectFlashpointPathToolStripMenuItem.Name = "selectFlashpointPathToolStripMenuItem"; - this.selectFlashpointPathToolStripMenuItem.Size = new System.Drawing.Size(199, 22); - this.selectFlashpointPathToolStripMenuItem.Text = "Select Flashpoint Path..."; - this.selectFlashpointPathToolStripMenuItem.Click += new System.EventHandler(this.selectFlashpointPathToolStripMenuItem_Click); - // // CurationForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -647,6 +649,7 @@ private void InitializeComponent() this.MaximizeBox = false; this.Name = "CurationForm"; this.Text = "FlashpointCC"; + this.Move += new System.EventHandler(this.CurationForm_Move); this.contextMenuStrip.ResumeLayout(false); this.groupBox1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); @@ -690,7 +693,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox titleTextBox; private System.Windows.Forms.DateTimePicker dateTimePicker; private System.Windows.Forms.TextBox developerTextBox; - private System.Windows.Forms.ComboBox genreComboBox; private System.Windows.Forms.TextBox seriesTextBox; private System.Windows.Forms.ComboBox playModeComboBox; private System.Windows.Forms.CheckBox extremeCheckBox; @@ -724,5 +726,6 @@ private void InitializeComponent() private System.Windows.Forms.OpenFileDialog openCurationFileDialog; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog; private System.Windows.Forms.ToolStripMenuItem selectFlashpointPathToolStripMenuItem; + private System.Windows.Forms.ComboBox genreComboBox; } } \ No newline at end of file diff --git a/FlashpointCC/CurationForm.cs b/FlashpointCC/CurationForm.cs index c4451ee..c2ebf9b 100644 --- a/FlashpointCC/CurationForm.cs +++ b/FlashpointCC/CurationForm.cs @@ -5,12 +5,14 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -26,6 +28,17 @@ public partial class CurationForm : Form private Curation curation; private TreeNode executable; private string flashpointPath; + + public delegate void SetImage(Image image); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern int GetClientRect(System.IntPtr hWnd, ref Rectangle lpRECT); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] + private static extern bool IsIconic(IntPtr hwnd); + + [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern int SetForegroundWindow(int hwnd); public CurationForm() { @@ -44,15 +57,96 @@ public CurationForm() screenshotPictureBox.DragDrop += ScreenshotPictureBox_DragDrop; profileComboBox.Items.AddRange(ProfileEditorForm.LoadProfiles()); genreComboBox.Items.AddRange(Curation.Genres); - genreComboBox.SelectedIndex = 0; playModeComboBox.Items.AddRange(Curation.Modes); - playModeComboBox.SelectedIndex = 0; statusComboBox.Items.AddRange(Curation.Statuses); - statusComboBox.SelectedIndex = 0; treeView.MouseDown += TreeView_MouseDown; treeView.AfterExpand += TreeView_AfterExpand; treeView.AfterCollapse += TreeView_AfterCollapse; Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); + + SetImage SetL = SetLogo; + SetImage SetSS = SetScreenshot; + + //Create instructions and Browse/Capture/Remove/Crop buttons for logo PictureBox + Label logoinstructions = new Label(); + logoinstructions.TextAlign = ContentAlignment.MiddleCenter; + logoinstructions.AutoSize = true; + logoinstructions.Text = "Drag and drop an image here, or..."; + logoPictureBox.Controls.Add(logoinstructions); + logoinstructions.Location = new Point((logoPictureBox.Width / 2) - (logoinstructions.Width / 2), (logoPictureBox.Height / 2) - (logoinstructions.Height / 2) - 15); + + Button logocapturebutton = new Button(); + logocapturebutton.Text = "Capture"; + logoPictureBox.Controls.Add(logocapturebutton); + logocapturebutton.Click += (sender, e) => { CaptureWindow(SetL); }; + logocapturebutton.Location = new Point((logoPictureBox.Width / 2) - logocapturebutton.Width - 5, (logoPictureBox.Height / 2) - (logocapturebutton.Height / 2) + 10); + + Button logobrowsebutton = new Button(); + logobrowsebutton.Text = "Browse..."; + logoPictureBox.Controls.Add(logobrowsebutton); + logobrowsebutton.Click += (sender, e) => { BrowseForImage(SetL); }; + logobrowsebutton.Location = new Point((logoPictureBox.Width / 2) + 5, (logoPictureBox.Height / 2) - (logobrowsebutton.Height / 2) + 10); + + Button logoremovebutton = new Button(); + logoremovebutton.Text = "X"; + logoremovebutton.Name = "logoremovebutton"; + logoremovebutton.Visible = false; + logoremovebutton.Width = 26; + logoremovebutton.BackColor = Color.PaleVioletRed; + logoremovebutton.ForeColor = Color.White; + logoremovebutton.Font = new Font(logoremovebutton.Font, FontStyle.Bold); + logoPictureBox.Controls.Add(logoremovebutton); + logoremovebutton.Click += (sender, e) => { SetLogo(null); }; + logoremovebutton.Location = new Point(logoPictureBox.Width - logoremovebutton.Width - 5, 5); + + //Button logocropbutton = new Button(); + //logocropbutton.Text = "Crop"; + //logocropbutton.Name = "logocropbutton"; + //logocropbutton.Visible = false; + //logoPictureBox.Controls.Add(logocropbutton); + //logocropbutton.Location = new Point((logoPictureBox.Width / 2) - (logocropbutton.Width / 2), logoPictureBox.Height - logocropbutton.Height - 8); + + //Create instructions and Browse/Capture/Remove buttons for screenshot PictureBox + Label screenshotinstructions = new Label(); + screenshotinstructions.TextAlign = ContentAlignment.MiddleCenter; + screenshotinstructions.AutoSize = true; + screenshotinstructions.Text = "Drag and drop an image here, or..."; + screenshotPictureBox.Controls.Add(screenshotinstructions); + screenshotinstructions.Location = new Point((screenshotPictureBox.Width / 2) - (screenshotinstructions.Width / 2), (screenshotPictureBox.Height / 2) - (screenshotinstructions.Height / 2) - 15); + + Button screenshotcapturebutton = new Button(); + screenshotcapturebutton.Text = "Capture"; + screenshotPictureBox.Controls.Add(screenshotcapturebutton); + screenshotcapturebutton.Click += (sender, e) => { CaptureWindow(SetSS); }; + screenshotcapturebutton.Location = new Point((screenshotPictureBox.Width / 2) - screenshotcapturebutton.Width - 5, (screenshotPictureBox.Height / 2) - (screenshotcapturebutton.Height / 2) + 10); + + Button screenshotbrowsebutton = new Button(); + screenshotbrowsebutton.Text = "Browse..."; + screenshotPictureBox.Controls.Add(screenshotbrowsebutton); + screenshotbrowsebutton.Click += (sender, e) => { BrowseForImage(SetSS); }; + screenshotbrowsebutton.Location = new Point((screenshotPictureBox.Width / 2) + 5, (screenshotPictureBox.Height / 2) - (screenshotbrowsebutton.Height / 2) + 10); + + Button screenshotremovebutton = new Button(); + screenshotremovebutton.Text = "X"; + screenshotremovebutton.Name = "screenshotremovebutton"; + screenshotremovebutton.Visible = false; + screenshotremovebutton.Width = 26; + screenshotremovebutton.BackColor = Color.PaleVioletRed; + screenshotremovebutton.ForeColor = Color.White; + screenshotremovebutton.Font = new Font(screenshotremovebutton.Font, FontStyle.Bold); + screenshotPictureBox.Controls.Add(screenshotremovebutton); + screenshotremovebutton.Click += (sender, e) => { SetScreenshot(null); }; + screenshotremovebutton.Location = new Point(screenshotPictureBox.Width - screenshotremovebutton.Width - 5, 5); + + //Create swap button + Button swapbutton = new Button(); + swapbutton.Text = "<- Swap ->"; + swapbutton.Visible = false; + swapbutton.Name = "swapbutton"; + this.Controls.Add(swapbutton); + swapbutton.Click += (sender, e) => { SwapPictures(); }; + swapbutton.Location = new Point(tableLayoutPanel2.Location.X + (tableLayoutPanel2.Width/2) - (swapbutton.Width/2), tableLayoutPanel2.Location.Y + tableLayoutPanel2.Height - 10); + swapbutton.BringToFront(); } private void ProfileEditor_ProfileChange(Profile profile) @@ -124,22 +218,120 @@ private void TreeView_DragDrop(object sender, DragEventArgs e) private void ScreenshotPictureBox_Paint(object sender, PaintEventArgs e) { - ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, Color.Gray, ButtonBorderStyle.Solid); + Pen pen = new Pen(Color.FromArgb(255, 170, 170, 170), 2.0F); + pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + e.Graphics.DrawRectangle(pen, e.ClipRectangle.X + 1, e.ClipRectangle.Y + 1, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2); + pen.Dispose(); } private void LogoPictureBox_Paint(object sender, PaintEventArgs e) { - ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, Color.Gray, ButtonBorderStyle.Solid); + Pen pen = new Pen(Color.FromArgb(255, 170, 170, 170), 2.0F); + pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + e.Graphics.DrawRectangle(pen, e.ClipRectangle.X + 1, e.ClipRectangle.Y + 1, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2); + pen.Dispose(); } public void SetLogo(Image image) { logoPictureBox.Image = image; + this.Controls.Find("swapbutton", false)[0].Visible = (logoPictureBox.Image == null && screenshotPictureBox.Image == null) ? false : true; + + foreach (Control child in logoPictureBox.Controls) + { + child.Visible = (image == null) ? true : false; + if (child.Name == "logocropbutton" | child.Name == "logoremovebutton") + { + child.Visible = (image == null) ? false : true; + } + } + + this.Refresh(); } public void SetScreenshot(Image image) { screenshotPictureBox.Image = image; + this.Controls.Find("swapbutton", false)[0].Visible = (logoPictureBox.Image == null && screenshotPictureBox.Image == null) ? false : true; + + foreach (Control child in screenshotPictureBox.Controls) + { + child.Visible = (image == null) ? true : false; + if (child.Name == "screenshotremovebutton") + { + child.Visible = (image == null) ? false : true; + } + } + + this.Refresh(); + } + + public void CaptureWindow(SetImage pass) + { + Profile profile = (Profile)profileComboBox.SelectedItem; + + if(profile == null) + { + MessageBox.Show("Please select a Profile", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + Process[] players = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(profile.ApplicationPath)); + + if(players.Length == 0) + { + MessageBox.Show("No game window detected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + IntPtr player = players[0].MainWindowHandle; + + Rectangle pic = new Rectangle(); + GetClientRect(player, ref pic); + + ScreenShot.ScreenCapture screenshot = new ScreenShot.ScreenCapture(); + Bitmap image = (Bitmap)screenshot.CaptureWindow(player); + + int border = (image.Width - pic.Width) / 2; + int top = image.Height - pic.Height - border; + + Rectangle crop = new Rectangle(border, top, pic.Width, pic.Height); + + if(IsIconic(player) | crop.IsEmpty | crop.Width == 0 | crop.Height == 0) + { + MessageBox.Show("Please make sure the game is not minimized", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + SetForegroundWindow((int)player); + SendKeys.SendWait("~"); + return; + } + + else + { + Bitmap cropped = image.Clone(crop, image.PixelFormat); + pass(cropped); + } + } + + public void BrowseForImage(SetImage pass) + { + OpenFileDialog browse = new OpenFileDialog(); + browse.FilterIndex = 2; + browse.Filter = "BMP Image (*.bmp)|*.bmp|PNG Image (*.png)|*.png|JPEG Image (*.jpg, *.jpeg)|*.jpg; *.jpeg|GIF Image (*.gif)|*.gif"; + browse.CheckFileExists = true; + browse.CheckPathExists = true; + browse.ValidateNames = true; + DialogResult result = browse.ShowDialog(); + if(result == DialogResult.OK) + { + pass(LoadImage(browse.FileName)); + } + } + + public void SwapPictures() + { + Image temp = logoPictureBox.Image; + SetLogo(screenshotPictureBox.Image); + SetScreenshot(temp); } public void SetContent(IContentSource content) @@ -166,6 +358,7 @@ public void LoadCuration(Curation curation) genreComboBox.SelectedIndex = Math.Max(0, genreComboBox.FindString(curation.Genre)); developerTextBox.Text = curation.Developer; seriesTextBox.Text = curation.Series; + extremeCheckBox.Checked = (curation.Extreme == "Yes"); playModeComboBox.SelectedIndex = Math.Max(0, playModeComboBox.FindString(curation.PlayMode)); statusComboBox.SelectedIndex = Math.Max(0, statusComboBox.FindString(curation.Status)); sourceTextBox.Text = curation.Source; @@ -193,12 +386,18 @@ private void LogoPictureBox_DragEnter(object sender, DragEventArgs e) e.Effect = DragDropEffects.Copy; } + public Image LoadImage(string path) + { + return Image.FromFile(path); + } + private void ScreenshotPictureBox_DragDrop(object sender, DragEventArgs e) { foreach (string pic in ((string[])e.Data.GetData(DataFormats.FileDrop))) { - Image img = Image.FromFile(pic); + Image img = LoadImage(pic); screenshotPictureBox.Image = img; + SetScreenshot(img); } } @@ -206,8 +405,8 @@ private void LogoPictureBox_DragDrop(object sender, DragEventArgs e) { foreach (string pic in ((string[])e.Data.GetData(DataFormats.FileDrop))) { - Image img = Image.FromFile(pic); - logoPictureBox.Image = img; + Image img = LoadImage(pic); + SetLogo(img); } } @@ -250,6 +449,7 @@ private void saveFileDialog_FileOk(object sender, CancelEventArgs e) PlayMode = playModeComboBox.SelectedItem.ToString(), Status = statusComboBox.SelectedItem.ToString(), Source = sourceTextBox.Text, + Extreme = extremeCheckBox.Checked ? "Yes" : "No", Platform = profile.Platform, Publisher = publisherTextBox.Text, LaunchCommand = commandLine, @@ -274,12 +474,12 @@ private void saveFileDialog_FileOk(object sender, CancelEventArgs e) var logoEntry = zip.CreateEntry(name + "/logo.png"); using (var entryStream = logoEntry.Open()) { - logoPictureBox.Image.Save(entryStream, logoPictureBox.Image.RawFormat); + logoPictureBox.Image.Save(entryStream, ImageFormat.Png); } var ssEntry = zip.CreateEntry(name + "/ss.png"); using (var entryStream = ssEntry.Open()) { - screenshotPictureBox.Image.Save(entryStream, screenshotPictureBox.Image.RawFormat); + screenshotPictureBox.Image.Save(entryStream, ImageFormat.Png); } source.CopyToZip(zip, name); } @@ -312,8 +512,26 @@ private void flagAsExecutableToolStripMenuItem_Click(object sender, EventArgs e) private void newToolStripMenuItem_Click(object sender, EventArgs e) { - new CurationForm().Show(); - Dispose(false); + if(MessageBox.Show("Are you sure you wish to reset all fields?", "New", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) + { + SetLogo(null); + SetScreenshot(null); + titleTextBox.Text = ""; + seriesTextBox.Text = ""; + profileComboBox.Text = ""; + developerTextBox.Text = ""; + publisherTextBox.Text = ""; + sourceTextBox.Text = ""; + dateTimePicker.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); + dateTimePicker.Checked = false; + genreComboBox.Text = "Genre"; + playModeComboBox.Text = "Playmode"; + statusComboBox.Text = "Status"; + extremeCheckBox.Checked = false; + notesTextBox.Text = ""; + authorNotesTextBox.Text = ""; + treeView.Nodes.Clear(); + } } private void importCurationToolStripMenuItem_Click(object sender, EventArgs e) @@ -441,5 +659,10 @@ private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } + + private void CurationForm_Move(object sender, EventArgs e) + { + this.Refresh(); + } } } diff --git a/FlashpointCC/CurationForm.resx b/FlashpointCC/CurationForm.resx index 5899b23..51e757c 100644 --- a/FlashpointCC/CurationForm.resx +++ b/FlashpointCC/CurationForm.resx @@ -124,50 +124,50 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAE - CgAAAk1TRnQBSQFMAgEBBAEAAegBAAHoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo - AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA - AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 - AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA - AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAA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QABAQEAAQECAAHAAQMBAAEB + AQABAQIAAcABAwEAAQECAAHAAR8BwAEDAQABAQIAAfwBPwHAAQMBAAEBAgAB/gF/AcABAwEAAQECAAH+ + AX8BwAEDAQABAQIAAfwBPwHAAQMBAAEBAQABAQH4AR8BwAEDAQABAQEAAQEB+AEfAcABAwEAAQEBAAEB + AfgBHwHAAQcBAAEfAQABAwH4AR8BwAEPAQABHwEAAT8B+AEfBP8BgAE/AfwBPws= diff --git a/FlashpointCC/FlashpointCC.csproj b/FlashpointCC/FlashpointCC.csproj index efd06e5..8216392 100644 --- a/FlashpointCC/FlashpointCC.csproj +++ b/FlashpointCC/FlashpointCC.csproj @@ -68,6 +68,7 @@ ProfileEditorForm.cs + diff --git a/FlashpointCC/ScreenCapture.cs b/FlashpointCC/ScreenCapture.cs new file mode 100644 index 0000000..1ed0c09 --- /dev/null +++ b/FlashpointCC/ScreenCapture.cs @@ -0,0 +1,99 @@ +using Microsoft.VisualBasic; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using System.Drawing.Imaging; + + +namespace ScreenShot +{ + /// Provides functions to capture the entire screen, or a particular window, and save it to a file. + public class ScreenCapture + { + /// Creates an Image object containing a screen shot of a specific window + public Image CaptureWindow(IntPtr handle) + { + int SRCCOPY = 0xcc0020; + // get te hDC of the target window + IntPtr hdcSrc = User32.GetWindowDC(handle); + // get the size + User32.RECT windowRect = new User32.RECT(); + User32.GetWindowRect(handle, ref windowRect); + int width = windowRect.right - windowRect.left; + int height = windowRect.bottom - windowRect.top; + // create a device context we can copy to + IntPtr hdcDest = GDI32.CreateCompatibleDC(hdcSrc); + // create a bitmap we can copy it to, + // using GetDeviceCaps to get the width/height + IntPtr hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc, width, height); + // select the bitmap object + IntPtr hOld = GDI32.SelectObject(hdcDest, hBitmap); + // bitblt over + GDI32.BitBlt(hdcDest, 0, 0, width, height, hdcSrc, 0, 0, SRCCOPY); + // restore selection + GDI32.SelectObject(hdcDest, hOld); + // clean up + GDI32.DeleteDC(hdcDest); + User32.ReleaseDC(handle, hdcSrc); + + // get a .NET image object for it + Image img = Image.FromHbitmap(hBitmap); + // free up the Bitmap object + GDI32.DeleteObject(hBitmap); + + return img; + } + //CaptureWindow + + /// Helper class containing Gdi32 API functions + private class GDI32 + { + public int SRCCOPY = 0xcc0020; + [DllImport("gdi32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern Int32 BitBlt(IntPtr hDestDC, Int32 x, Int32 y, Int32 nWidth, Int32 nHeight, IntPtr hSrcDC, Int32 xSrc, Int32 ySrc, Int32 dwRop); + [DllImport("gdi32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, Int32 nWidth, Int32 nHeight); + [DllImport("gdi32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern IntPtr CreateCompatibleDC(IntPtr hdc); + [DllImport("gdi32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern Int32 DeleteDC(IntPtr hdc); + [DllImport("gdi32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern Int32 DeleteObject(IntPtr hObject); + [DllImport("gdi32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hObject); + // BitBlt dwRop parameter + + } + //GDI32 + /// Helper class containing User32 API functions + public class User32 + { + [StructLayout(LayoutKind.Sequential)] + public struct RECT + { + public int left; + public int top; + public int right; + public int bottom; + } + [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern IntPtr GetDesktopWindow(); + [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern IntPtr GetWindowDC(IntPtr hwnd); + [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern Int32 ReleaseDC(IntPtr hwnd, IntPtr hdc); + [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] + public static extern Int32 GetWindowRect(IntPtr hwnd, ref RECT lpRect); + //RECT + + + } + //User32 + } + //ScreenCapture +} +//ScreenShot