private void MineSweeper95_Load(object sender, EventArgs e) { configMine = new ConfigHelper(com.toSystemPath(@"C:\WINDOWS\winmine.ini")); w = configMine.GetConfigAsInt32("Minesweeper", "Width"); h = configMine.GetConfigAsInt32("Minesweeper", "Height"); pfc.AddFontFile(com.toSystemPath(@"C:\WINDOWS\FONTS\LeMS LCD.ttf")); lblBomb.Font = new Font(pfc.Families[0], 20); lblTimer.Font = new Font(pfc.Families[0], 20); int dif = configMine.GetConfigAsInt32("Minesweeper", "Difficulty"); BeginnerToolStripMenuItem.Checked = (dif == 0); IntermediateToolStripMenuItem.Checked = (dif == 1); ExpertToolStripMenuItem.Checked = (dif == 2); CustomToolStripMenuItem.Checked = (dif == 3); createGame(); }
private void UpdateResources(String ext) { foreach (String exe in Directory.GetFiles(com.toSystemPath(@"C:\"), ext, SearchOption.AllDirectories)) { foreach (String search in Directory.GetFiles(new FileInfo(Application.ExecutablePath).Directory.Parent.Parent.Parent.FullName, Path.GetFileName(exe), SearchOption.AllDirectories)) { if ((new FileInfo(exe)).LastWriteTime.ToFileTime() < (new FileInfo(search)).LastWriteTime.ToFileTime() && !search.Contains("dev") && !search.Contains(@"\obj\")) { Debug.WriteLine(Path.GetFileName(exe) + " has been updated"); File.Copy(search, exe, true); } } } }
public CustomMineSweeperDialog() { // This call is required by the designer. InitializeComponent(); configMine = new ConfigHelper(com.toSystemPath(@"C:\WINDOWS\winmine.ini")); }
public AppHolder(String exePath, String arguments) : base() { if (!IsDotNetProcess(exePath)) { Console.WriteLine(exePath + " is not a compatable program"); Dispose(); return; } ProcessStartInfo info = new ProcessStartInfo(exePath, arguments); try { info.UseShellExecute = false; info.CreateNoWindow = true; info.RedirectStandardInput = false; info.RedirectStandardOutput = true; info.RedirectStandardError = false; info.WindowStyle = ProcessWindowStyle.Hidden; pro = Process.Start(info); pro.WaitForInputIdle(); pro.Exited += Exited; while (pro.MainWindowHandle == null || pro.MainWindowHandle == IntPtr.Zero) { ; } SetParent(pro.MainWindowHandle, GuestArea.Handle); do { GetClientRect(pro.MainWindowHandle, ref siz); } while (siz.Width == 0 && siz.Height == 0); // WS_POPUP style and add WS_CHILD style const UInt32 WS_POPUP = 0x80000000, WS_CHILD = 0x40000000; uint style = (UInt32)GetWindowLong(pro.MainWindowHandle, -16); //style = (style & ~(WS_POPUP)) | WS_CHILD; SetWindowLong(pro.MainWindowHandle, -16, style); //int GWL_STYLE = (-16); //uint WS_VISIBLE = 0x10000000; //SetWindowLong(pro.MainWindowHandle, GWL_STYLE, WS_VISIBLE); MoveWindow(pro.MainWindowHandle, 0, 0, siz.Width, siz.Height, true); Size = new Size(siz.Width + lefts.Width + rights.Width, siz.Height + programtopbar.Height + bottoms.Height + 0); this.Maximise += Max; this.DoubleBuffered = true; base.Resize += resizing; this.Closing += Exited; //info.WindowStyle = ProcessWindowStyle.Hidden // do { // //ProjectChicagoObjects.modCommunication.Nap(400, false) // SetParent(pro.MainWindowHandle, GuestArea.Handle); // GetClientRect(pro.MainWindowHandle, ref siz); // // MessageBox.Show(siz.ToString) // // Console.WriteLine(siz) // }while ( siz.Width == 0 && siz.Height == 0); // // Console.WriteLine("c") // pro.BeginOutputReadLine(); //MessageBox.Show(Graphics.FromHwnd(pro.MainWindowHandle).DpiX & "," & Graphics.FromHwnd(pro.MainWindowHandle).DpiY) //Size = new Size(siz.Width + lefts.Width + rights.Width, siz.Height + programtopbar.Height + bottoms.Height + 0); //Graphics.FromHwnd(pro.MainWindowHandle).DpiX, Graphics.FromHwnd(pro.MainWindowHandle).DpiY) REMOVE EXTRAS AND SEE IF IT WORKS // SetWindowPos(pro.MainWindowHandle, 0, panGuestMod.PointToScreen(panGuestMod.Location).X, panGuestMod.PointToScreen(panGuestMod.Location).Y, panGuestMod.Width, panGuestMod.Height, 64) //MoveWindow(pro.MainWindowHandle, panGuestMod.PointToScreen(panGuestMod.Location).X, panGuestMod.PointToScreen(panGuestMod.Location).Y, panGuestMod.Width, panGuestMod.Height, true) // Console.WriteLine("Title") Text = pro.MainWindowTitle; TsudaKageyu.IconExtractor i = new TsudaKageyu.IconExtractor(pro.StartInfo.FileName); // in if (i.Count > 0) { programIcon.Image = new Bitmap(i.GetIcon(i.Count - 1).ToBitmap(), 16, 16); } else { programIcon.Image = new Bitmap(com.prepareImage(com.toSystemPath(com.Config.GetConfig("windows", "GenericAppIco").Setting)), 16, 16); // New TsudaKageyu.IconUtil //pro.StartInfo.FileName).ToBitmap } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
public Desktop() { try { InitializeComponent(); CheckForIllegalCrossThreadCalls = false; this.com.Config.ConfigUpdated += DesktopLoad; this.Load += DesktopLoad; elvDesktop.Click += appLaunchHide; elvDesktop.OSIconLocationPath = com.toSystemPath(com.Config.GetConfig("windows", "ICO").Setting); elvDesktop.Directory = com.toSystemPath(@"C:\Windows\Desktop"); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }