Ejemplo n.º 1
0
        private static bool AlreadyEditingFile()
        {
            var fileName = Environment.GetCommandLineArgs().Skip(1).FirstOrDefault()
                           ?? (UserSettings.EditorOpenLastFile ? Settings.Default.LastOpenFile : null);

            if (string.IsNullOrWhiteSpace(fileName))
            {
                return(false);
            }
            var currentProcess = Process.GetCurrentProcess();

            foreach (var process in Process.GetProcessesByName(currentProcess.ProcessName)
                     .Where(p => p.Id != currentProcess.Id)
                     .Where(p => OldSchool.IsEditingFile(p, fileName)))
            {
                if (IsIconic(process.MainWindowHandle))
                {
                    ShowWindowAsync(process.MainWindowHandle, 9 /* SW_RESTORE */);
                }
                SetForegroundWindow(process.MainWindowHandle);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
 void Start()
 {
     control = transform.parent.GetComponent <OldSchool>();
     pickup  = (GameObject)GameObject.Instantiate(control.pickups[(int)weapon],
                                                  transform.position + new Vector3(0, 1, 0),
                                                  new Quaternion(-0.7f, 0, 0, 0.7f));
     pickup.transform.parent = gameObject.transform;
     StartCoroutine(Respawn());
 }
Ejemplo n.º 3
0
 private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
 {
     if (msg == 0x4A /* WM_COPYDATA */)
     {
         handled = true;
         var filename = OldSchool.CopyDataStructToString(lParam);
         return(Editor.FileName.Equals(filename, StringComparison.OrdinalIgnoreCase) ? new IntPtr(1) : IntPtr.Zero);
     }
     return(IntPtr.Zero);
 }