Removing Input tab as we don't need to specific features anymore.
authorStephaneLenclud
Fri, 19 Aug 2016 19:28:03 +0200
changeset 245448e6a616c22
parent 244 2e4d2558bb21
child 246 30a221eecc06
Removing Input tab as we don't need to specific features anymore.
Server/App.config
Server/FormMain.Designer.cs
Server/FormMain.Hid.cs
Server/FormMain.cs
Server/FormMain.resx
Server/Properties/Settings.Designer.cs
Server/Properties/Settings.settings
     1.1 --- a/Server/App.config	Fri Aug 19 19:18:54 2016 +0200
     1.2 +++ b/Server/App.config	Fri Aug 19 19:28:03 2016 +0200
     1.3 @@ -25,12 +25,6 @@
     1.4              <setting name="StartMinimized" serializeAs="String">
     1.5                  <value>False</value>
     1.6              </setting>
     1.7 -            <setting name="StartFileName" serializeAs="String">
     1.8 -                <value>None</value>
     1.9 -            </setting>
    1.10 -            <setting name="OpticalDriveToEject" serializeAs="String">
    1.11 -                <value>None</value>
    1.12 -            </setting>
    1.13              <setting name="CecEnabled" serializeAs="String">
    1.14                  <value>False</value>
    1.15              </setting>
     2.1 --- a/Server/FormMain.Designer.cs	Fri Aug 19 19:18:54 2016 +0200
     2.2 +++ b/Server/FormMain.Designer.cs	Fri Aug 19 19:28:03 2016 +0200
     2.3 @@ -92,12 +92,6 @@
     2.4              this.checkBoxShowVolumeLabel = new System.Windows.Forms.CheckBox();
     2.5              this.checkBoxMute = new System.Windows.Forms.CheckBox();
     2.6              this.trackBarMasterVolume = new System.Windows.Forms.TrackBar();
     2.7 -            this.tabPageInput = new System.Windows.Forms.TabPage();
     2.8 -            this.comboBoxOpticalDrives = new System.Windows.Forms.ComboBox();
     2.9 -            this.labelOpticalDriveEject = new System.Windows.Forms.Label();
    2.10 -            this.pictureBoxGreenStart = new System.Windows.Forms.PictureBox();
    2.11 -            this.labelStartFileName = new System.Windows.Forms.Label();
    2.12 -            this.buttonSelectFile = new System.Windows.Forms.Button();
    2.13              this.tabPageCec = new System.Windows.Forms.TabPage();
    2.14              this.groupBoxCecLogOptions = new System.Windows.Forms.GroupBox();
    2.15              this.checkBoxCecLogNoPoll = new System.Windows.Forms.CheckBox();
    2.16 @@ -153,8 +147,6 @@
    2.17              this.tabPageDesign.SuspendLayout();
    2.18              this.tabPageAudio.SuspendLayout();
    2.19              ((System.ComponentModel.ISupportInitialize)(this.trackBarMasterVolume)).BeginInit();
    2.20 -            this.tabPageInput.SuspendLayout();
    2.21 -            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGreenStart)).BeginInit();
    2.22              this.tabPageCec.SuspendLayout();
    2.23              this.groupBoxCecLogOptions.SuspendLayout();
    2.24              this.tabPageHarmony.SuspendLayout();
    2.25 @@ -588,7 +580,6 @@
    2.26              this.tabControl.Controls.Add(this.tabPageClients);
    2.27              this.tabControl.Controls.Add(this.tabPageDesign);
    2.28              this.tabControl.Controls.Add(this.tabPageAudio);
    2.29 -            this.tabControl.Controls.Add(this.tabPageInput);
    2.30              this.tabControl.Controls.Add(this.tabPageCec);
    2.31              this.tabControl.Controls.Add(this.tabPageHarmony);
    2.32              this.tabControl.Controls.Add(this.tabPageEvent);
    2.33 @@ -783,69 +774,6 @@
    2.34              this.toolTip.SetToolTip(this.trackBarMasterVolume, "Master Volume");
    2.35              this.trackBarMasterVolume.Scroll += new System.EventHandler(this.trackBarMasterVolume_Scroll);
    2.36              // 
    2.37 -            // tabPageInput
    2.38 -            // 
    2.39 -            this.tabPageInput.Controls.Add(this.comboBoxOpticalDrives);
    2.40 -            this.tabPageInput.Controls.Add(this.labelOpticalDriveEject);
    2.41 -            this.tabPageInput.Controls.Add(this.pictureBoxGreenStart);
    2.42 -            this.tabPageInput.Controls.Add(this.labelStartFileName);
    2.43 -            this.tabPageInput.Controls.Add(this.buttonSelectFile);
    2.44 -            this.tabPageInput.Location = new System.Drawing.Point(4, 22);
    2.45 -            this.tabPageInput.Name = "tabPageInput";
    2.46 -            this.tabPageInput.Padding = new System.Windows.Forms.Padding(3);
    2.47 -            this.tabPageInput.Size = new System.Drawing.Size(752, 385);
    2.48 -            this.tabPageInput.TabIndex = 6;
    2.49 -            this.tabPageInput.Text = "Input";
    2.50 -            this.tabPageInput.UseVisualStyleBackColor = true;
    2.51 -            // 
    2.52 -            // comboBoxOpticalDrives
    2.53 -            // 
    2.54 -            this.comboBoxOpticalDrives.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    2.55 -            this.comboBoxOpticalDrives.FormattingEnabled = true;
    2.56 -            this.comboBoxOpticalDrives.Location = new System.Drawing.Point(113, 53);
    2.57 -            this.comboBoxOpticalDrives.Name = "comboBoxOpticalDrives";
    2.58 -            this.comboBoxOpticalDrives.Size = new System.Drawing.Size(55, 21);
    2.59 -            this.comboBoxOpticalDrives.TabIndex = 18;
    2.60 -            this.comboBoxOpticalDrives.SelectedIndexChanged += new System.EventHandler(this.comboBoxOpticalDrives_SelectedIndexChanged);
    2.61 -            // 
    2.62 -            // labelOpticalDriveEject
    2.63 -            // 
    2.64 -            this.labelOpticalDriveEject.AutoSize = true;
    2.65 -            this.labelOpticalDriveEject.Location = new System.Drawing.Point(0, 56);
    2.66 -            this.labelOpticalDriveEject.Name = "labelOpticalDriveEject";
    2.67 -            this.labelOpticalDriveEject.Size = new System.Drawing.Size(107, 13);
    2.68 -            this.labelOpticalDriveEject.TabIndex = 3;
    2.69 -            this.labelOpticalDriveEject.Text = "Optical drive to eject:";
    2.70 -            // 
    2.71 -            // pictureBoxGreenStart
    2.72 -            // 
    2.73 -            this.pictureBoxGreenStart.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxGreenStart.Image")));
    2.74 -            this.pictureBoxGreenStart.Location = new System.Drawing.Point(3, 6);
    2.75 -            this.pictureBoxGreenStart.Name = "pictureBoxGreenStart";
    2.76 -            this.pictureBoxGreenStart.Size = new System.Drawing.Size(32, 32);
    2.77 -            this.pictureBoxGreenStart.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
    2.78 -            this.pictureBoxGreenStart.TabIndex = 2;
    2.79 -            this.pictureBoxGreenStart.TabStop = false;
    2.80 -            // 
    2.81 -            // labelStartFileName
    2.82 -            // 
    2.83 -            this.labelStartFileName.AutoSize = true;
    2.84 -            this.labelStartFileName.Location = new System.Drawing.Point(72, 16);
    2.85 -            this.labelStartFileName.Name = "labelStartFileName";
    2.86 -            this.labelStartFileName.Size = new System.Drawing.Size(33, 13);
    2.87 -            this.labelStartFileName.TabIndex = 1;
    2.88 -            this.labelStartFileName.Text = "None";
    2.89 -            // 
    2.90 -            // buttonSelectFile
    2.91 -            // 
    2.92 -            this.buttonSelectFile.Location = new System.Drawing.Point(41, 11);
    2.93 -            this.buttonSelectFile.Name = "buttonSelectFile";
    2.94 -            this.buttonSelectFile.Size = new System.Drawing.Size(25, 23);
    2.95 -            this.buttonSelectFile.TabIndex = 0;
    2.96 -            this.buttonSelectFile.Text = "...";
    2.97 -            this.buttonSelectFile.UseVisualStyleBackColor = true;
    2.98 -            this.buttonSelectFile.Click += new System.EventHandler(this.buttonSelectFile_Click);
    2.99 -            // 
   2.100              // tabPageCec
   2.101              // 
   2.102              this.tabPageCec.Controls.Add(this.groupBoxCecLogOptions);
   2.103 @@ -1401,9 +1329,6 @@
   2.104              this.tabPageAudio.ResumeLayout(false);
   2.105              this.tabPageAudio.PerformLayout();
   2.106              ((System.ComponentModel.ISupportInitialize)(this.trackBarMasterVolume)).EndInit();
   2.107 -            this.tabPageInput.ResumeLayout(false);
   2.108 -            this.tabPageInput.PerformLayout();
   2.109 -            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGreenStart)).EndInit();
   2.110              this.tabPageCec.ResumeLayout(false);
   2.111              this.tabPageCec.PerformLayout();
   2.112              this.groupBoxCecLogOptions.ResumeLayout(false);
   2.113 @@ -1480,13 +1405,7 @@
   2.114  		private System.Windows.Forms.CheckBox checkBoxMute;
   2.115  		private System.Windows.Forms.CheckBox checkBoxShowVolumeLabel;
   2.116  		private System.Windows.Forms.Label labelDefaultAudioDevice;
   2.117 -		private System.Windows.Forms.TabPage tabPageInput;
   2.118 -		private System.Windows.Forms.Button buttonSelectFile;
   2.119  		private System.Windows.Forms.OpenFileDialog openFileDialog;
   2.120 -		private System.Windows.Forms.Label labelStartFileName;
   2.121 -		private System.Windows.Forms.PictureBox pictureBoxGreenStart;
   2.122 -        private System.Windows.Forms.ComboBox comboBoxOpticalDrives;
   2.123 -        private System.Windows.Forms.Label labelOpticalDriveEject;
   2.124          private System.Windows.Forms.TabPage tabPageCec;
   2.125          private System.Windows.Forms.CheckBox checkBoxCecEnabled;
   2.126          private System.Windows.Forms.Label labelHdmiPort;
     3.1 --- a/Server/FormMain.Hid.cs	Fri Aug 19 19:18:54 2016 +0200
     3.2 +++ b/Server/FormMain.Hid.cs	Fri Aug 19 19:28:03 2016 +0200
     3.3 @@ -21,8 +21,6 @@
     3.4      [System.ComponentModel.DesignerCategory("Code")]
     3.5      public class FormMainHid : Form
     3.6      {
     3.7 -        [System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint = "SwitchToThisWindow")]
     3.8 -        public static extern void SwitchToThisWindow([System.Runtime.InteropServices.InAttribute()] System.IntPtr hwnd, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] bool fUnknown);
     3.9          //
    3.10          public delegate void OnHidEventDelegate(object aSender, Hid.Event aHidEvent);
    3.11  
    3.12 @@ -141,19 +139,6 @@
    3.13                              Usage = (Hid.Usage.WindowsMediaCenterRemoteControl) aHidEvent.Usages[0]
    3.14                          };
    3.15                          Properties.Settings.Default.EarManager.TriggerEvent(e);
    3.16 -
    3.17 -                        //Old legacy hard coded stuff
    3.18 -                        //TODO: remove it
    3.19 -                        switch (aHidEvent.Usages[0])
    3.20 -                        {
    3.21 -                            case (ushort) Hid.Usage.WindowsMediaCenterRemoteControl.GreenStart:
    3.22 -                                HandleGreenStart();
    3.23 -                                break;
    3.24 -                            case (ushort) Hid.Usage.WindowsMediaCenterRemoteControl.Eject:
    3.25 -                            case (ushort) Hid.Usage.WindowsMediaCenterRemoteControl.Ext2:
    3.26 -                                HandleEject();
    3.27 -                                break;
    3.28 -                        }
    3.29                      }
    3.30                      else if (aHidEvent.UsagePage == (ushort) Hid.UsagePage.Consumer)
    3.31                      {
    3.32 @@ -163,12 +148,6 @@
    3.33                              Usage = (Hid.Usage.ConsumerControl) aHidEvent.Usages[0]
    3.34                          };
    3.35                          Properties.Settings.Default.EarManager.TriggerEvent(e);
    3.36 -
    3.37 -                        //Keep this for debug when only ThinkPad keyboard is available
    3.38 -                        //if (aHidEvent.Usages[0] == (ushort)Hid.Usage.ConsumerControl.ThinkPadFullscreenMagnifier)
    3.39 -                        //{
    3.40 -                        //    HandleEject();
    3.41 -                        //}
    3.42                      }
    3.43                  }
    3.44                  else if (aHidEvent.IsKeyboard)
    3.45 @@ -189,259 +168,9 @@
    3.46              }
    3.47          }
    3.48  
    3.49 -        /// <summary>
    3.50 -        /// 
    3.51 -        /// </summary>
    3.52 -        /// <param name="aPrefix"></param>
    3.53 -        private void CheckLastError(string aPrefix)
    3.54 -        {
    3.55 -            string errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message;
    3.56 -            Debug.WriteLine(aPrefix + Marshal.GetLastWin32Error().ToString() + ": " + errorMessage);
    3.57 -        }
    3.58 +    
    3.59  
    3.60 -        /// <summary>
    3.61 -        /// 
    3.62 -        /// </summary>
    3.63 -        /// <param name="data"></param>
    3.64 -        /// <returns></returns>
    3.65 -        private IntPtr MarshalToPointer(object data)
    3.66 -        {
    3.67 -            IntPtr buf = Marshal.AllocHGlobal(
    3.68 -                Marshal.SizeOf(data));
    3.69 -            Marshal.StructureToPtr(data,
    3.70 -                buf, false);
    3.71 -            return buf;
    3.72 -        }
    3.73 -
    3.74 -        /// <summary>
    3.75 -        /// 
    3.76 -        /// </summary>
    3.77 -        /// <returns></returns>
    3.78 -        private SafeFileHandle OpenVolume(string aDriveName)
    3.79 -        {
    3.80 -            return Function.CreateFile("\\\\.\\" + aDriveName,
    3.81 -                               SharpLib.Win32.FileAccess.GENERIC_READ,
    3.82 -                               SharpLib.Win32.FileShare.FILE_SHARE_READ | SharpLib.Win32.FileShare.FILE_SHARE_WRITE,
    3.83 -                               IntPtr.Zero,
    3.84 -                               CreationDisposition.OPEN_EXISTING,
    3.85 -                               0,
    3.86 -                               IntPtr.Zero);
    3.87 -        }
    3.88 -
    3.89 -        /// <summary>
    3.90 -        /// 
    3.91 -        /// </summary>
    3.92 -        /// <param name="aVolume"></param>
    3.93 -        /// <returns></returns>
    3.94 -        private bool LockVolume(SafeFileHandle aVolume)
    3.95 -        {
    3.96 -            //Hope that's doing what I think it does
    3.97 -            IntPtr dwBytesReturned=new IntPtr();
    3.98 -            //Should not be needed but I'm not sure how to pass NULL in there.
    3.99 -            OVERLAPPED overlapped=new OVERLAPPED();
   3.100 -
   3.101 -            int tries = 0;
   3.102 -            const int KMaxTries = 100;
   3.103 -            const int KSleepTime = 10;
   3.104 -            bool success = false;
   3.105 -
   3.106 -            while (!success && tries < KMaxTries)
   3.107 -            {
   3.108 -                success = Function.DeviceIoControl(aVolume, Const.FSCTL_LOCK_VOLUME, IntPtr.Zero, 0, IntPtr.Zero, 0, dwBytesReturned, ref overlapped);
   3.109 -                System.Threading.Thread.Sleep(KSleepTime);
   3.110 -                tries++;
   3.111 -            }
   3.112 -
   3.113 -            CheckLastError("Lock volume: ");
   3.114 -
   3.115 -            return success;
   3.116 -        }
   3.117 -
   3.118 -        /// <summary>
   3.119 -        /// 
   3.120 -        /// </summary>
   3.121 -        /// <param name="aVolume"></param>
   3.122 -        /// <returns></returns>
   3.123 -        private bool DismountVolume(SafeFileHandle aVolume)
   3.124 -        {
   3.125 -            //Hope that's doing what I think it does
   3.126 -            IntPtr dwBytesReturned = new IntPtr();
   3.127 -            //Should not be needed but I'm not sure how to pass NULL in there.
   3.128 -            OVERLAPPED overlapped=new OVERLAPPED();
   3.129 -
   3.130 -            bool res = Function.DeviceIoControl(aVolume, Const.FSCTL_DISMOUNT_VOLUME, IntPtr.Zero, 0, IntPtr.Zero, 0, dwBytesReturned, ref overlapped);
   3.131 -            CheckLastError("Dismount volume: ");
   3.132 -            return res;
   3.133 -        }
   3.134 -
   3.135 -
   3.136 -
   3.137 -        /// <summary>
   3.138 -        /// 
   3.139 -        /// </summary>
   3.140 -        /// <param name="aVolume"></param>
   3.141 -        /// <param name="aPreventRemoval"></param>
   3.142 -        /// <returns></returns>
   3.143 -        private bool PreventRemovalOfVolume(SafeFileHandle aVolume, bool aPreventRemoval)
   3.144 -        {
   3.145 -            //Hope that's doing what I think it does
   3.146 -            IntPtr dwBytesReturned = new IntPtr();
   3.147 -            //Should not be needed but I'm not sure how to pass NULL in there.
   3.148 -            OVERLAPPED overlapped = new OVERLAPPED();
   3.149 -            //
   3.150 -            PREVENT_MEDIA_REMOVAL preventMediaRemoval = new PREVENT_MEDIA_REMOVAL();
   3.151 -            preventMediaRemoval.PreventMediaRemoval = Convert.ToByte(aPreventRemoval);
   3.152 -            IntPtr preventMediaRemovalParam = MarshalToPointer(preventMediaRemoval);
   3.153 -
   3.154 -            bool result = Function.DeviceIoControl(aVolume, Const.IOCTL_STORAGE_MEDIA_REMOVAL, preventMediaRemovalParam, Convert.ToUInt32(Marshal.SizeOf(preventMediaRemoval)), IntPtr.Zero, 0, dwBytesReturned, ref overlapped);
   3.155 -            CheckLastError("Media removal: ");
   3.156 -            Marshal.FreeHGlobal(preventMediaRemovalParam);
   3.157 -
   3.158 -            return result;
   3.159 -        }
   3.160 -
   3.161 -        /// <summary>
   3.162 -        /// Eject optical drive media opening the tray if any.
   3.163 -        /// </summary>
   3.164 -        /// <param name="aVolume"></param>
   3.165 -        /// <returns></returns>
   3.166 -        private bool MediaEject(SafeFileHandle aVolume)
   3.167 -        {
   3.168 -            //Hope that's doing what I think it does
   3.169 -            IntPtr dwBytesReturned = new IntPtr();
   3.170 -            //Should not be needed but I'm not sure how to pass NULL in there.
   3.171 -            OVERLAPPED overlapped=new OVERLAPPED();
   3.172 -
   3.173 -            bool res = Function.DeviceIoControl(aVolume, Const.IOCTL_STORAGE_EJECT_MEDIA, IntPtr.Zero, 0, IntPtr.Zero, 0, dwBytesReturned, ref overlapped);
   3.174 -            CheckLastError("Media eject: ");
   3.175 -            return res;
   3.176 -        }
   3.177 -
   3.178 -        /// <summary>
   3.179 -        /// Close an optical drive tray.
   3.180 -        /// </summary>
   3.181 -        /// <param name="aVolume"></param>
   3.182 -        /// <returns></returns>
   3.183 -        private bool MediaLoad(SafeFileHandle aVolume)
   3.184 -        {
   3.185 -            //Hope that's doing what I think it does
   3.186 -            IntPtr dwBytesReturned = new IntPtr();
   3.187 -            //Should not be needed but I'm not sure how to pass NULL in there.
   3.188 -            OVERLAPPED overlapped=new OVERLAPPED();
   3.189 -
   3.190 -            bool res = Function.DeviceIoControl(aVolume, Const.IOCTL_STORAGE_LOAD_MEDIA, IntPtr.Zero, 0, IntPtr.Zero, 0, dwBytesReturned, ref overlapped);
   3.191 -            CheckLastError("Media load: ");
   3.192 -            return res;
   3.193 -        }
   3.194 -
   3.195 -        /// <summary>
   3.196 -        /// 
   3.197 -        /// </summary>
   3.198 -        /// <param name="aVolume"></param>
   3.199 -        /// <returns></returns>
   3.200 -        private bool StorageCheckVerify(SafeFileHandle aVolume)
   3.201 -        {
   3.202 -            //Hope that's doing what I think it does
   3.203 -            IntPtr dwBytesReturned = new IntPtr();
   3.204 -            //Should not be needed but I'm not sure how to pass NULL in there.
   3.205 -            OVERLAPPED overlapped = new OVERLAPPED();
   3.206 -
   3.207 -            bool res = Function.DeviceIoControl(aVolume, Const.IOCTL_STORAGE_CHECK_VERIFY2, IntPtr.Zero, 0, IntPtr.Zero, 0, dwBytesReturned, ref overlapped);
   3.208 -
   3.209 -            CheckLastError("Check verify: ");
   3.210 -
   3.211 -            return res;
   3.212 -        }        
   3.213 -        
   3.214 -
   3.215 -
   3.216 -        /// <summary>
   3.217 -        /// Perform media ejection.
   3.218 -        /// </summary>
   3.219 -        private void HandleEject()
   3.220 -        {
   3.221 -            string drive = ((FormMain)this).OpticalDriveToEject();
   3.222 -            if (drive.Length!=2)
   3.223 -            {
   3.224 -                //Not a proper drive spec.
   3.225 -                //Probably 'None' selected.
   3.226 -                return;
   3.227 -            }
   3.228 -
   3.229 -            SafeFileHandle handle = OpenVolume(drive);
   3.230 -            if (handle.IsInvalid)
   3.231 -            {
   3.232 -                CheckLastError("ERROR: Failed to open volume: ");
   3.233 -                return;
   3.234 -            }
   3.235 -
   3.236 -            if (LockVolume(handle) && DismountVolume(handle))
   3.237 -            {
   3.238 -                Debug.WriteLine("Volume was dismounted.");
   3.239 -
   3.240 -                if (PreventRemovalOfVolume(handle,false))
   3.241 -                {
   3.242 -                    //StorageCheckVerify(handle);
   3.243 -
   3.244 -                    DateTime before;
   3.245 -                    before = DateTime.Now;
   3.246 -                    bool ejectSuccess = MediaEject(handle);
   3.247 -                    double ms = (DateTime.Now - before).TotalMilliseconds;
   3.248 -
   3.249 -                    //We assume that if it take more than a certain time to for eject to execute it means we actually ejected.
   3.250 -                    //If our eject completes too rapidly we assume the tray is already open and we will try to close it. 
   3.251 -                    if (ejectSuccess && ms > 100)
   3.252 -                    {
   3.253 -                        Debug.WriteLine("Media was ejected");
   3.254 -                    }
   3.255 -                    else if (MediaLoad(handle))
   3.256 -                    {
   3.257 -                        Debug.WriteLine("Media was loaded");
   3.258 -                    }                    
   3.259 -                }
   3.260 -            }
   3.261 -            else
   3.262 -            {
   3.263 -                Debug.WriteLine("Volume lock or dismount failed.");
   3.264 -            }
   3.265 -
   3.266 -            //This is needed to make sure we can open the volume next time around
   3.267 -            handle.Dispose();
   3.268 -        }
   3.269 -
   3.270 -        /// <summary>
   3.271 -        /// 
   3.272 -        /// </summary>
   3.273 -        private void HandleGreenStart()
   3.274 -        {
   3.275 -            //First check if the process we want to launch already exists
   3.276 -            string procName = Path.GetFileNameWithoutExtension(Properties.Settings.Default.StartFileName);
   3.277 -            Process[] existingProcesses = Process.GetProcessesByName(procName);
   3.278 -            if (existingProcesses == null || existingProcesses.Length == 0)
   3.279 -            {
   3.280 -                // Process do not exists just try to launch it
   3.281 -                ProcessStartInfo start = new ProcessStartInfo();
   3.282 -                // Enter in the command line arguments, everything you would enter after the executable name itself
   3.283 -                //start.Arguments = arguments; 
   3.284 -                // Enter the executable to run, including the complete path
   3.285 -                start.FileName = Properties.Settings.Default.StartFileName;
   3.286 -                start.WindowStyle = ProcessWindowStyle.Normal;
   3.287 -                start.CreateNoWindow = true;
   3.288 -                start.UseShellExecute = true;
   3.289 -                // Run the external process & wait for it to finish
   3.290 -                Process proc = Process.Start(start);
   3.291 -
   3.292 -                //SL: We could have used that too
   3.293 -                //Shell32.Shell shell = new Shell32.Shell();
   3.294 -                //shell.ShellExecute(Properties.Settings.Default.StartFileName);
   3.295 -            }
   3.296 -            else
   3.297 -            {
   3.298 -                //This won't work properly until we have a manifest that enables uiAccess.
   3.299 -                //However uiAccess just won't work with ClickOnce so we will have to use a different deployment system.
   3.300 -                SwitchToThisWindow(existingProcesses[0].MainWindowHandle, true);
   3.301 -            }            
   3.302 -        }
   3.303 +    
   3.304  
   3.305  
   3.306          /// <summary>
     4.1 --- a/Server/FormMain.cs	Fri Aug 19 19:18:54 2016 +0200
     4.2 +++ b/Server/FormMain.cs	Fri Aug 19 19:28:03 2016 +0200
     4.3 @@ -178,9 +178,6 @@
     4.4              //Populate device types
     4.5              PopulateDeviceTypes();
     4.6  
     4.7 -            //Populate optical drives
     4.8 -            PopulateOpticalDrives();
     4.9 -
    4.10              //Initial status update 
    4.11              UpdateStatus();
    4.12  
    4.13 @@ -647,41 +644,6 @@
    4.14          }
    4.15  
    4.16          /// <summary>
    4.17 -        /// 
    4.18 -        /// </summary>
    4.19 -        private void PopulateOpticalDrives()
    4.20 -        {
    4.21 -            //Reset our list of drives
    4.22 -            comboBoxOpticalDrives.Items.Clear();
    4.23 -            comboBoxOpticalDrives.Items.Add("None");
    4.24 -
    4.25 -            //Go through each drives on our system and collected the optical ones in our list
    4.26 -            DriveInfo[] allDrives = DriveInfo.GetDrives();
    4.27 -            foreach (DriveInfo d in allDrives)
    4.28 -            {
    4.29 -                Debug.WriteLine("Drive " + d.Name);
    4.30 -                Debug.WriteLine("  Drive type: {0}", d.DriveType);
    4.31 -
    4.32 -                if (d.DriveType == DriveType.CDRom)
    4.33 -                {
    4.34 -                    //This is an optical drive, add it now
    4.35 -                    comboBoxOpticalDrives.Items.Add(d.Name.Substring(0, 2));
    4.36 -                }
    4.37 -            }
    4.38 -        }
    4.39 -
    4.40 -        /// <summary>
    4.41 -        /// 
    4.42 -        /// </summary>
    4.43 -        /// <returns></returns>
    4.44 -        public string OpticalDriveToEject()
    4.45 -        {
    4.46 -            return comboBoxOpticalDrives.SelectedItem.ToString();
    4.47 -        }
    4.48 -
    4.49 -
    4.50 -
    4.51 -        /// <summary>
    4.52          ///
    4.53          /// </summary>
    4.54          private void SetupTrayIcon()
    4.55 @@ -1237,31 +1199,6 @@
    4.56              CheckFontHeight();
    4.57              //Check if "run on Windows startup" is enabled
    4.58              checkBoxAutoStart.Checked = iStartupManager.Startup;
    4.59 -            //            
    4.60 -            labelStartFileName.Text = Properties.Settings.Default.StartFileName;
    4.61 -
    4.62 -
    4.63 -            //Try find our drive in our drive list
    4.64 -            int opticalDriveItemIndex = 0;
    4.65 -            bool driveNotFound = true;
    4.66 -            string opticalDriveToEject = Properties.Settings.Default.OpticalDriveToEject;
    4.67 -            foreach (object item in comboBoxOpticalDrives.Items)
    4.68 -            {
    4.69 -                if (opticalDriveToEject == item.ToString())
    4.70 -                {
    4.71 -                    comboBoxOpticalDrives.SelectedIndex = opticalDriveItemIndex;
    4.72 -                    driveNotFound = false;
    4.73 -                    break;
    4.74 -                }
    4.75 -                opticalDriveItemIndex++;
    4.76 -            }
    4.77 -
    4.78 -            if (driveNotFound)
    4.79 -            {
    4.80 -                //We could not find the drive we had saved.
    4.81 -                //Select "None" then.
    4.82 -                comboBoxOpticalDrives.SelectedIndex = 0;
    4.83 -            }
    4.84  
    4.85              //Harmony settings
    4.86              iTextBoxHarmonyHubAddress.Text = Properties.Settings.Default.HarmonyHubAddress;
    4.87 @@ -2563,39 +2500,6 @@
    4.88          /// <summary>
    4.89          /// 
    4.90          /// </summary>
    4.91 -        /// <param name="sender"></param>
    4.92 -        /// <param name="e"></param>
    4.93 -        private void buttonSelectFile_Click(object sender, EventArgs e)
    4.94 -        {
    4.95 -            //openFileDialog1.InitialDirectory = "c:\\";
    4.96 -            //openFileDialog.Filter = "EXE files (*.exe)|*.exe|All files (*.*)|*.*";
    4.97 -            //openFileDialog.FilterIndex = 1;
    4.98 -            openFileDialog.RestoreDirectory = true;
    4.99 -
   4.100 -            if (DlgBox.ShowDialog(openFileDialog) == DialogResult.OK)
   4.101 -            {
   4.102 -                labelStartFileName.Text = openFileDialog.FileName;
   4.103 -                Properties.Settings.Default.StartFileName = openFileDialog.FileName;
   4.104 -                Properties.Settings.Default.Save();
   4.105 -            }
   4.106 -        }
   4.107 -
   4.108 -        /// <summary>
   4.109 -        /// 
   4.110 -        /// </summary>
   4.111 -        /// <param name="sender"></param>
   4.112 -        /// <param name="e"></param>
   4.113 -        private void comboBoxOpticalDrives_SelectedIndexChanged(object sender, EventArgs e)
   4.114 -        {
   4.115 -            //Save the optical drive the user selected for ejection
   4.116 -            Properties.Settings.Default.OpticalDriveToEject = comboBoxOpticalDrives.SelectedItem.ToString();
   4.117 -            Properties.Settings.Default.Save();
   4.118 -        }
   4.119 -
   4.120 -
   4.121 -        /// <summary>
   4.122 -        /// 
   4.123 -        /// </summary>
   4.124          private void LogsUpdate()
   4.125          {
   4.126              if (iWriter != null)
     5.1 --- a/Server/FormMain.resx	Fri Aug 19 19:18:54 2016 +0200
     5.2 +++ b/Server/FormMain.resx	Fri Aug 19 19:28:03 2016 +0200
     5.3 @@ -129,65 +129,10 @@
     5.4    <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     5.5      <value>315, 17</value>
     5.6    </metadata>
     5.7 -  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
     5.8 -  <data name="pictureBoxGreenStart.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     5.9 -    <value>
    5.10 -        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAC45JREFUWEd9
    5.11 -        lgdYVUcaho8l+Ohq1FWwETR2TSJIiRpsQEQEgiDVRkeqgoj0cvEiICASuYgKdhGJ2BAJKmKLLUaxoy4W
    5.12 -        0ICiWFcwbrLvzsGymrB7nue9d+7cmf/75p9yRuJ1yH+B/0kfG0ld4CEoFjQK6GunRl97NeSy4HfBfkGw
    5.13 -        QKulGO/5QPOjHy01FsGGCzK17NowYHpHBjh3QS+gP45KM2xijZpxEuVRcwczYHYXBszoJIx9IhtaJ/i6
    5.14 -        pZgfan70488NRYAkWXiIWxeMQ3RYmO1N7p4Mth/aRP6BXPL3v0WUC8s3sqZ4OcEqd3Tm9GGwaxf62Tcb
    5.15 -        WSro/FHsDzTfF/79238NiA5afayllUOcO2EUOoLU/Gi2la//WLQFtrz93vhjNnMzZqLvq8kwYV7E2vBh
    5.16 -        NvQ92n1sQBZvrnwj/pUsPsKrK25LvmPTjytYv1fFuuLMj9n7J/7yv4r1JarmGCO8uvGZbWvZiOU7A+9M
    5.17 -        NH/83rTgvYHeU6VVej7qeKVZs2pXKqptiW8oTHrD9iSydrSAqH/fRrTPfNsve2cKXqnW6PtpoDmtlTwl
    5.18 -        n39kQB79y2eBzRXC4XIdz66YhX5J6pYokjaEvWFTGMmbw1lZsIg9u1Qc2LOSwp1LUW2NIyU/gpQtb1iS
    5.19 -        F96M3DZpYxiJoq/Mkk2RmIfqoC8GJg/wnQFZW/pXU7B0v9ZXFrccNqsDhvN64p/uSES2TzORq3yIzvHj
    5.20 -        eGEWz0u287RwLc+25fCiaAMvDmzjzLZ00tfNI3adLzFrBWt8icr1IWq16L/Sh/AsGW98U20Z5aeOttun
    5.21 -        sgl/2cDrxmBJanweKFVccZVTXzpxfm8MvLrjl+qAT6q9MOLA3O8dUap8qE+P40GcD/cX2lEfacejODse
    5.22 -        p7jwSGlHTpojqqKFhOc6Mz/LiSDBvEwnApY54pvmIMQd8UmxQ9+jOyYhfd5NRZt/Pg2UpIZ6f6m3lWQ0
    5.23 -        wrUTE+f3Eo00cE6YgmviFNxTLfBMsyQrxYP6Rb48CDLnYagpj2NNeZZkypNlltRmOxGYZkV5pZIj1zJZ
    5.24 -        XRpO3EZ3woSZmHVzyNwRR95BFc7x5hi492BsgAajvLshNF3r6/wkqabaWx59oVmYJqN8uqLj2h372PHM
    5.25 -        UE5kdrIRLikmHFjixUPFbOqDxvEkxpAXKYY0qgx5st6MEzkWhOaasuuyFdsv2FB8MYD9lxdz4OJyyi6s
    5.26 -        ofhMNvOWz8Q2fLyIrY6+Z2csIvvK03Dy5k0vSd52alpii9gp+qPn8SnDZv6NqVEG2MaPwil5DI6JY6hS
    5.27 -        uvMwwpLHYiG9SNahMUuHpvW6PNrxLdmZE0jfa8y+Kkt+uKTDhjM6ZB/VI/OAMbnlXuSdzsBRMQWLBfoM
    5.28 -        FaektsvfsI7+nAGOn9D7O6mbnH5DPc9PsYnui657RwbOUMM0dChTFdrYJY3ESzmeu5H2VC6y4mrubKq2
    5.29 -        TKN2mxGPi8ZQV27CnAQ9dlc6cPCuDbtujGTLhcHknvqCnKMmbD4xj7S90UwJ1sN43hAGOrXjq9kdsAzX
    5.30 -        ZFyA2BFW0kxJuAgwXdBTuNJC16MTw1zbMzpIHcv4YVgnDUeRaEFCpCMhSgdcIybiHTOZmMTZFG7z4/Ax
    5.31 -        O9wzDDn+IJhDdY4U3/6GgqsD2XB2KJtOTWbruQg8ltljHDxEnIo9GDyrPV+4dBRbsg9WkVpyBlKlXpZS
    5.32 -        gnWUFrYxWuh7dxanVkcMgjpjquiLVdJA7JaYEZC7lNDtpcQdvk50aRmBG5VMjR6Jb/LXxOy259jzJRxu
    5.33 -        8KO0xojCa4PYXDGY/Ipp5F9OZFLEaMaFaKLj15nhYguOcO/Cd2GfMX3RANlAntTLQvreKb4/TvGfMzqg
    5.34 -        G7oBXTEME9tF2QOL5H54rz7JjLW3GL26Du28F0zb/5pll/7NussNzFg2AZulX+Jf7kzGg6Xk3I8kq9qZ
    5.35 -        lBtexF1ahMsOT4wiBjEmTJ2vF2ig7dMN+ZS1ie6Ha9IQxOB3Sj2nSIsd4/rhsWQ440N6MSqkJ0YKTcxS
    5.36 -        BPGm6Icfp3PQWdTi7qD2/VM0N7/CfP8fRPzSiEumPsfPf4+/aiJjg3tirBzCpOUjGa8YxDdBPXCKG4ZR
    5.37 -        nIin1MRQZFkvSFPUf8asxcNwSxYGLEQGek6W/KeKRRGUpceU2AGiQ3/MUwdildEfs5hoRgYforXXCaSw
    5.38 -        G0gpD+mQ08jIon9hs30/SfkTePF4DfW1q7helcnOQ3NZX+RM6ZFwqi6pUC0bheWyz7FYNhjjxUMZGzUE
    5.39 -        k8ihBGSOEefMEMTgl0saRpLJOP+/k5Bnwow0PSxStZm2YiR2WV8yIbCAvu4lSLPLkQIvIsXfQxJZ6Jn/
    5.40 -        CqPsCEqPWvD6YTivH3jSVOvCizuzefoPL17eWMijqwkEJw3GdtVwbFfrYp5hwKQkfaYlGaDYZI6VGHSP
    5.41 -        SZKHpNZN6vSZbStUu60I32zN9OyxzFg3jpmZDox03UZ7yy1IdnuRvE4ihV6ndVId7XKe4aAyorbSilf3
    5.42 -        nHhVbU7TTWOaro2j6YoVjZVBVJbNZ/rSoczabMCsvInYr5mEjepb5q61JqvYUZwJ7ej8ldRPEk8bkYrd
    5.43 -        MWsnsGKfD76bzfEqMMdCqWTQnB8YGLkHneSj9Es4Sff4C7RffBON9OOkF+jyonIyTZXf0HR1FI0X9Wg8
    5.44 -        a8Crs1N5eimcPbk2uGzQxb/oW7x3W+O61R63jbYsKwkgtcBCnv8zQltN+uPVAqnbGMnSOLAXO88sJKnU
    5.45 -        g7m77ES6YhmX4Mbk5MlYpY3FLM0ew4wEhqw4zVhVGvt2fkHjL2NpPDWMxpNDaTw6mMbD4oT8yYaGszGk
    5.46 -        pYwmsMiEsKOOzD/kztySOUQX+1BwOhrH2MGoT5T8hYFWb97JktRJZOFUdvEstp9ToChzI3iPHcG7LYgs
    5.47 -        MUNROgVliSmxO40J3WpGaKEDx8r0qDxiTPXBr2n4cRDPi/rytFiX2iMenD+ySLyOJxB7zIH4c77E/ryA
    5.48 -        2MPzyTujJO+wf/PtqG1HqXuzdvOtRJJadx8neY72VudkVQYF5xWkn/Yh84Ifa675knfDmx+q5lB43ZPt
    5.49 -        lZ78cNGN7HJrVpZZsvWEM3tP+PLjT+IgOhHJun0ixYU2KPZNI/2yPxnXoki9EM3GC4s5cTMb84X95dEr
    5.50 -        hGbb91eytyY69vhWKpip1OXCvTUUVcaT948QCmvC2FsXRnl9OMcbIvnlWTRnHkdz8M58CircWHnYjtQS
    5.51 -        C5Q7TVEIFhVbsPTYdFZdnsva29HkVCnIv5bIzzVrCFkxCQ0TabfQ6vL+SvaBgVYCDQ1jqTRWrNSrdesp
    5.52 -        uymuYLdCKBMn3MnHcZx/qaTyVSJVvyVxU3Dl+SJ+eRjFsV9DOSAMldwOouhOMLuE6cKaKLbeiqb4ZiIV
    5.53 -        tetZXewrix9p110aKHTa/MWAXCGeth36StoiRWVxa+2pbtjGz9UpHLodwnGRhYoncVx7mcCt35Kp+T2F
    5.54 -        u3+kUiO4LcqVTYmcf67k+KM4yn6NoORWGMfuLKHqYQGqHb7Ir/y/G0i2QuMTWatFA29NqLXvLWmLA+qA
    5.55 -        Q6weV6sLuFW/iYoaJafvBnOubiGXH0VS+TSG60/juP4sjitPYql4GMHp2lB+qg7m1B0FN+5v4Ob9IvzS
    5.56 -        TeU5PyT2vKWI3e6dzl8M/NmEQEsszPX97NuKFe3E3fpS6p+VcOtBDlfuJXJBpLmiJpBz1fOoqA7l0j0l
    5.57 -        VfdXU/ekmNqGMtLyfRk0vT3q46VCEat/S+J/MfAh4mkj6NqmvWQgjOyUUzgj/htWF4Xxc+UW7j44yD+b
    5.58 -        zjVzv+Eop0Xd5v0KXBZPELeddog+JR20JHMRQ13QvOJbosXKDxGPnA2N1p9IOl20pRj1CVJ5TzPpnrjN
    5.59 -        vBTXOfl2K99sXom6X8W0neiiIyW07SSNEX16CeR0tmop7jtarGwJ8bQVdBL0EQwSfCEYIdAWfPm2TlPQ
    5.60 -        WSC3/b/CbwiR/gNzbuWksIMBOAAAAABJRU5ErkJggg==
    5.61 -</value>
    5.62 -  </data>
    5.63    <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    5.64      <value>405, 17</value>
    5.65    </metadata>
    5.66 +  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    5.67    <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    5.68      <value>
    5.69          AAABAAEAgIAAAAEAIAADNAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAACAAAAAgAgGAAAAwz5hywAAIABJ
     6.1 --- a/Server/Properties/Settings.Designer.cs	Fri Aug 19 19:18:54 2016 +0200
     6.2 +++ b/Server/Properties/Settings.Designer.cs	Fri Aug 19 19:28:03 2016 +0200
     6.3 @@ -96,30 +96,6 @@
     6.4          
     6.5          [global::System.Configuration.UserScopedSettingAttribute()]
     6.6          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     6.7 -        [global::System.Configuration.DefaultSettingValueAttribute("None")]
     6.8 -        public string StartFileName {
     6.9 -            get {
    6.10 -                return ((string)(this["StartFileName"]));
    6.11 -            }
    6.12 -            set {
    6.13 -                this["StartFileName"] = value;
    6.14 -            }
    6.15 -        }
    6.16 -        
    6.17 -        [global::System.Configuration.UserScopedSettingAttribute()]
    6.18 -        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    6.19 -        [global::System.Configuration.DefaultSettingValueAttribute("None")]
    6.20 -        public string OpticalDriveToEject {
    6.21 -            get {
    6.22 -                return ((string)(this["OpticalDriveToEject"]));
    6.23 -            }
    6.24 -            set {
    6.25 -                this["OpticalDriveToEject"] = value;
    6.26 -            }
    6.27 -        }
    6.28 -        
    6.29 -        [global::System.Configuration.UserScopedSettingAttribute()]
    6.30 -        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    6.31          [global::System.Configuration.DefaultSettingValueAttribute("False")]
    6.32          public bool CecEnabled {
    6.33              get {
     7.1 --- a/Server/Properties/Settings.settings	Fri Aug 19 19:18:54 2016 +0200
     7.2 +++ b/Server/Properties/Settings.settings	Fri Aug 19 19:28:03 2016 +0200
     7.3 @@ -20,12 +20,6 @@
     7.4      <Setting Name="StartMinimized" Type="System.Boolean" Scope="User">
     7.5        <Value Profile="(Default)">False</Value>
     7.6      </Setting>
     7.7 -    <Setting Name="StartFileName" Type="System.String" Scope="User">
     7.8 -      <Value Profile="(Default)">None</Value>
     7.9 -    </Setting>
    7.10 -    <Setting Name="OpticalDriveToEject" Type="System.String" Scope="User">
    7.11 -      <Value Profile="(Default)">None</Value>
    7.12 -    </Setting>
    7.13      <Setting Name="CecEnabled" Type="System.Boolean" Scope="User">
    7.14        <Value Profile="(Default)">False</Value>
    7.15      </Setting>