/[EmuXPortal]/branches/mono/EmuXPortal/GameControl.cs
ViewVC logotype

Diff of /branches/mono/EmuXPortal/GameControl.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- branches/mono/EmuXPortal/GameControl.cs	2017/12/19 02:44:37	333
+++ branches/mono/EmuXPortal/GameControl.cs	2017/12/19 03:35:02	334
@@ -6,16 +6,49 @@
 using System.Linq;
 using System.Text;
 using System.Windows.Forms;
+using System.IO;
 
 namespace EmuXPortal
 {
     public partial class GameControl : UserControl
     {
+    	private FileStream fs = null;
         private object image_lock = new object();
+		private int m_ControlID = new Random().Next();
+		public int ControlID { get { return m_ControlID; } }
+
         public GameControl() { InitializeComponent();
         gameImage.SizeMode = PictureBoxSizeMode.StretchImage;
         }
-        public Image GameImage { get { lock (image_lock) { return gameImage.Image; } } set { lock (image_lock) { gameImage.Image = value; } } }
+		public void ReleaseGameStream ()
+		{
+			if (fs != null) {
+				fs.Close();
+				fs.Dispose();
+				fs = null;
+			}
+		}
+        public void UpdateGameImage(Image img) {
+			this.GameImage = img;
+        }
+		public void UpdateGameImage (string filename)
+		{
+			ReleaseGameStream();
+			fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None);
+			this.GameImage = Image.FromStream(fs);
+        }
+        private Image GameImage {
+			get {
+				lock (image_lock) {
+					return gameImage.Image;
+				}
+			}
+			set {
+				lock (image_lock) {
+					gameImage.Image = value;
+				} 
+			}
+		}
         public string GameName { get { return gameName.Text; } set { gameName.Text = value; } }
         private void GameControl_Load(object sender, EventArgs e)
         {           

 

  ViewVC Help
Powered by ViewVC 1.1.22