예제 #1
0
        private void CheckForUpdates()
        {
            if (!ApplicationDeployment.IsNetworkDeployed)
            {
                MessageBox.Show("This application is not running in ClickOnce infra. \nNo update is available.");
                return;
            }

            ApplicationDeployment currentDeploy = ApplicationDeployment.CurrentDeployment;

            if (currentDeploy.CheckForUpdate())
            {
                //TODO: ensure all the data is syncronized before update
                //TODO: use different thread for update
                //currentDeploy.Update();

                currentDeploy.CheckForUpdateCompleted       += currentDeploy_CheckForUpdateCompleted;
                currentDeploy.CheckForUpdateProgressChanged += currentDeploy_CheckForUpdateProgressChanged;
                currentDeploy.UpdateCompleted += currentDeploy_UpdateCompleted;

                DialogResult dr = MessageBox.Show("Update downloaded, restart application?", "Application Update", MessageBoxButtons.YesNo);
                if (dr == DialogResult.Yes)
                {
                    Application.Restart();
                }
            }
        }
예제 #2
0
        private void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment current = ApplicationDeployment.CurrentDeployment;

                try
                {
                    if (current.CheckForUpdate())
                    {
                        Trace.WriteLine("VScan: Check for update");

                        current.Update();

                        DialogResult result = MessageBox.Show("Update downloaded, restart application?",
                                                              Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        if (result == DialogResult.Yes)
                        {
                            Application.Restart();
                        }
                    }
                }
                catch
                {
                    ms_updateTimer.Stop();
                    MessageBox.Show("ClickOnce connection failed.", Application.ProductName,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #3
0
 private void InstallUpdateSyncWithInfo2()
 {
     if (ApplicationDeployment.IsNetworkDeployed == true)
     {
         ApplicationDeployment thisDeployment = ApplicationDeployment.CurrentDeployment;
         //this.Text = "正在检测更新...";
         if (thisDeployment.CheckForUpdate() == true)
         {
             if (MessageBox.Show("检测到有新的版本可以进行更新,现在需要更新吗?", "选择是否要进行更新", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
             {
                 // this.Text = "正在更新中";
                 thisDeployment.Update();
                 MessageBox.Show("更新完毕,将要重启程序!");
                 Application.Restart();
             }
             else
             {
                 //  this.Text = Application.ProductName + " " + Application.ProductVersion;
             }
         }
         else
         {
             MessageBox.Show("并没有新的版本进行更新!");
         }
     }
     else
     {
         MessageBox.Show("这不是网络发布的程序");
     }
 }
예제 #4
0
        private void UpdateApp()
        {
            ApplicationDeployment updater = ApplicationDeployment.CurrentDeployment;
            bool verDepServer             = updater.CheckForUpdate();

            if (verDepServer) // Update disponible
            {
                DialogResult res = MessageBox.Show(
                    String.Format("Une nouvelle version est disponible{0}Mettre à jour maintenant ?",
                                  Environment.NewLine),
                    "Mise à jour",
                    MessageBoxButtons.YesNo);

                if (res == DialogResult.Yes)
                {
                    updater.Update();

                    MessageBox.Show("Attention, l'application va redémarrer", "Redémarrage",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                    Application.Restart();
                }
            }
            else
            {
                MessageBox.Show("Pas de nouvelle version disponible");
            }
        }
예제 #5
0
 private void ToolStripMenuItem2Click(object sender, EventArgs e)
 {
     try
     {
         ApplicationDeployment updater = ApplicationDeployment.CurrentDeployment;
         bool verDepServer             = updater.CheckForUpdate();
         if (verDepServer) // Update available
         {
             DialogResult res = MessageBox.Show(
                 Resources.NewVersionYes,
                 Resources.Updater, MessageBoxButtons.YesNo);
             if (res == DialogResult.Yes)
             {
                 updater.Update();
                 MessageBox.Show(Resources.RestartMsg);
             }
         }
         else
         {
             MessageBox.Show(Resources.NewVersionNo, Resources.Updater);
         }
     } catch
     {
         MessageBox.Show(Resources.NewVersionNo, Resources.Updater);
     }
 }
예제 #6
0
파일: Form1.cs 프로젝트: winxxp/samples
        private void CheckForUpdateAsyncMin()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                adCheckForUpdateAsyncMin = ApplicationDeployment.CurrentDeployment;
                adCheckForUpdateAsyncMin.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(adCheckForUpdateAsyncMin_CheckForUpdateCompleted);

                adCheckForUpdateAsyncMin.CheckForUpdate();
            }
        }
예제 #7
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     // 取得版本号
     if (appd.CheckForUpdate())
     {
         Update.Visibility = Visibility.Visible;
     }
     else
     {
         Update.Visibility = Visibility.Hidden;
     }
     version.Text = appd.CurrentVersion.ToString();
 }
예제 #8
0
        public static Boolean CheckForUpdates()
        {
            Boolean returnValue = default(Boolean);

            try
            {
                // First check to see if we are running in a ClickOnce context
                if (ApplicationDeployment.IsNetworkDeployed)
                {
                    // Get an instance of the deployment
                    ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment;

                    // Check to see if updates are available
                    if (deployment.CheckForUpdate())
                    {
                        DialogResult res = MessageBox.Show("A new version of the application is available, do you want to update?", "Application Updater", MessageBoxButtons.YesNo);
                        if (res == DialogResult.Yes)
                        {
                            // Do the update
                            deployment.Update();
                            DialogResult res2 = MessageBox.Show("Update complete, do you want to restart the application to apply the update?", "Application Updater", MessageBoxButtons.YesNo);
                            if (res2 == DialogResult.Yes)
                            {
                                // Restart the application to apply the update
                                System.Windows.Forms.Application.Restart();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("No updates available.", "Application Updater");
                    }
                }
                else
                {
                    MessageBox.Show("Updates not allowed unless you are launched through ClickOnce.");
                }

                returnValue = true;
            }
            catch (Exception ex)
            {
                Log.Write(
                    ex,
                    MethodBase.GetCurrentMethod(),
                    EventLogEntryType.Error);
            }
            return(returnValue);
        }
예제 #9
0
파일: Form1.cs 프로젝트: winxxp/samples
        //</SNIPPET4>

        //<SNIPPET5>
        private void InstallUpdateSync()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                Boolean updateAvailable  = false;
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

                try
                {
                    updateAvailable = ad.CheckForUpdate();
                }
                catch (DeploymentDownloadException dde)
                {
                    // This exception occurs if a network error or disk error occurs
                    // when downloading the deployment.
                    MessageBox.Show("The application cannt check for the existence of a new version at this time. \n\nPlease check your network connection, or try again later. Error: " + dde);
                    return;
                }
                catch (InvalidDeploymentException ide)
                {
                    MessageBox.Show("The application cannot check for an update. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message);
                    return;
                }
                catch (InvalidOperationException ioe)
                {
                    MessageBox.Show("This application cannot check for an update. This most often happens if the application is already in the process of updating. Error: " + ioe.Message);
                    return;
                }

                if (updateAvailable)
                {
                    try
                    {
                        ad.Update();
                        MessageBox.Show("The application has been upgraded, and will now restart.");
                        Application.Restart();
                    }
                    catch (DeploymentDownloadException dde)
                    {
                        MessageBox.Show("Cannot install the latest version of the application. Either the deployment server is unavailable, or your network connection is down. \n\nPlease check your network connection, or try again later. Error: " + dde.Message);
                    }
                    catch (TrustNotGrantedException tnge)
                    {
                        MessageBox.Show("The application cannot be updated. The system did not grant the application the appropriate level of trust. Please contact your system administrator or help desk for further troubleshooting. Error: " + tnge.Message);
                    }
                }
            }
        }
예제 #10
0
		/**
		 * Checks for any pending updates for this application, and if it finds
		 * any, updates the application as part of a restart
		 */
        static bool CheckForUpdates()
		{
#if !__MonoCS__
			try
			{
				if( ApplicationDeployment.IsNetworkDeployed )
				{
					ApplicationDeployment Current = ApplicationDeployment.CurrentDeployment;
					return Current.CheckForUpdate();
				}
			}
			catch( Exception )
			{
			}
#endif
			return false;
		}
예제 #11
0
 // Verifica actualizaciones.
 public static void update()
 {
     try
     {
         ApplicationDeployment deploy = ApplicationDeployment.CurrentDeployment;
         UpdateCheckInfo       update = deploy.CheckForDetailedUpdate();
         if (deploy.CheckForUpdate())
         {
             MessageBox.Show("Se detecto la version " + update.AvailableVersion.ToString() + ", se actualizara la aplicacion.");
             deploy.Update();
             Application.Restart();
         }
     }
     catch (Exception ex)
     {
         // Nada.... MessageBox.Show(ex.Message.ToString());
     }
 }
예제 #12
0
        public void CheckForUpdate(object sender, EventArgs eventargs)
        {
            if (_ClickOnce)
            {
                if (processing)
                {
                    return;
                }
                processing = true;
                try
                {
                    // bool: Persist update to disk?
                    // false: Apply update silently
                    // true: Show prompt and allow user to skip update (not desired)
                    if (Deployment.CheckForUpdate(false))
                    {
                        Deployment.UpdateAsync();
                    }
                    else
                    {
                        processing = false;
                    }
                }
                catch (Exception ex)
                {
                    log.Warn("Check for update failed. " + ex.Message);
                    processing = false;
                }
            }
            else
            {
                if (UpdateManager.Instance.IsWorking)
                {
                    return;
                }

                UpdateManager.Instance.CheckForUpdates();
                if (UpdateManager.Instance.UpdatesAvailable > 0)
                {
                    UpdateManager.Instance.PrepareUpdates();
                }
            }
        }
예제 #13
0
        /**
         * Checks for any pending updates for this application, and if it finds
         * any, updates the application as part of a restart
         */
        static void CheckForUpdate()
        {
            try
            {
#if !__MonoCS__
                if (ApplicationDeployment.IsNetworkDeployed)
                {
                    ApplicationDeployment Current = ApplicationDeployment.CurrentDeployment;
                    if (Current.CheckForUpdate())
                    {
                        Current.Update();
                    }
                }
#endif
            }
            catch (Exception)
            {
            }
        }
예제 #14
0
        private async void button6_Click(object sender, EventArgs e)
        {
            button6.Enabled = false;
            button7.Enabled = false;
            DateTime dNow = System.DateTime.Now;

            textBox1.Text      = dNow.ToString("[HH:mm:ss]") + " 更新プログラムを確認しています";
            progressBar1.Style = ProgressBarStyle.Marquee;
            await Task.Delay(1000);

            try
            {
                //if (!ApplicationDeployment.IsNetworkDeployed) return;
                ApplicationDeployment currentDeploy = ApplicationDeployment.CurrentDeployment;
                if (currentDeploy.CheckForUpdate())
                {
                    button7.Enabled = true;
                    dNow            = System.DateTime.Now;
                    textBox1.Text  += "\r\n" + dNow.ToString("[HH:mm:ss]") + " 更新プログラムがあります";
                    dNow            = System.DateTime.Now;
                    textBox1.Text  += "\r\n" + dNow.ToString("[HH:mm:ss]") + " 現在のバージョン: " + currentDeploy.CurrentVersion;
                    dNow            = System.DateTime.Now;
                    textBox1.Text  += "\r\n" + dNow.ToString("[HH:mm:ss]") + " ダウンロードURL: " + currentDeploy.UpdateLocation;
                }
                else
                {
                    dNow           = System.DateTime.Now;
                    textBox1.Text += "\r\n" + dNow.ToString("[HH:mm:ss]") + " このプログラムは最新です。 バージョン: " + currentDeploy.CurrentVersion;
                }
            }
            catch (DeploymentException exp)
            {
                dNow           = System.DateTime.Now;
                textBox1.Text += "\r\n" + dNow.ToString("\n" + "[HH:mm:ss]") + " エラーが発生しました。\n" + exp.Message;
            }
            finally
            {
                progressBar1.Style = ProgressBarStyle.Blocks;
                button6.Enabled    = true;
            }
        }
예제 #15
0
 public static void CheckForUpdate()
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment;
         if (deployment.CheckForUpdate())
         {
             if (MessageBox.Show("A new version of the application is available, do you want to update? You can continue to work while the update is installed.", "Application Updater", MessageBoxButtons.YesNo) != DialogResult.Yes)
             {
                 return;
             }
             BackgroundWorker backgroundWorker = new BackgroundWorker();
             backgroundWorker.DoWork             += (DoWorkEventHandler)((s, e) => e.Result = deployment.Update());
             backgroundWorker.RunWorkerCompleted += (RunWorkerCompletedEventHandler)((s, e) =>
             {
                 if ((bool)e.Result)
                 {
                     if (MessageBox.Show("Update complete, do you want to restart the application to apply the update?", "Application Updater", MessageBoxButtons.YesNo) != DialogResult.Yes)
                     {
                         return;
                     }
                     Application.Restart();
                 }
                 else
                 {
                     int num1 = (int)MessageBox.Show("Update failed. Please retry at another time.");
                 }
             });
             backgroundWorker.RunWorkerAsync();
         }
         else
         {
             int num1 = (int)MessageBox.Show("No updates available.", "Application Updater");
         }
     }
     else
     {
         int num3 = (int)MessageBox.Show("Updates not allowed unless you are launched through ClickOnce.");
     }
 }
예제 #16
0
		static bool InstallAllUpdates()
		{
#if !__MonoCS__
			try
			{
				if( ApplicationDeployment.IsNetworkDeployed )
				{
					ApplicationDeployment Current = ApplicationDeployment.CurrentDeployment;

					// If there are any updates available, install them now
					if( Current.CheckForUpdate() )
					{
						return Current.Update();
					}
				}
			}
			catch( Exception )
			{
			}
#endif
			return false;
		}
예제 #17
0
        private static void CheckForUpdates()
        {
            while (true)
            {
                // Wait a minute.
                Thread.Sleep(60000);

                if (ApplicationDeployment.IsNetworkDeployed)
                {
                    Boolean updateAvailable  = false;
                    ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

                    try
                    {
                        updateAvailable = ad.CheckForUpdate();
                    }
                    catch
                    {
                        // Can't check; ignore.
                        continue;
                    }

                    if (updateAvailable)
                    {
                        try
                        {
                            ad.Update();
                            Application.Restart();
                        }
                        catch
                        {
                            // Can't auto-update.
                        }
                    }
                }
            }
        }
예제 #18
0
        public static NormalResult InstallUpdateSync()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                Boolean updateAvailable  = false;
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

                try
                {
                    updateAvailable = ad.CheckForUpdate();
                }
                catch (DeploymentDownloadException dde)
                {
                    // This exception occurs if a network error or disk error occurs
                    // when downloading the deployment.
                    return(new NormalResult
                    {
                        Value = -1,
                        ErrorInfo = "The application cannt check for the existence of a new version at this time. \n\nPlease check your network connection, or try again later. Error: " + dde
                    });
                }
                catch (InvalidDeploymentException ide)
                {
                    return(new NormalResult
                    {
                        Value = -1,
                        ErrorInfo = "The application cannot check for an update. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message
                    });
                }
                catch (InvalidOperationException ioe)
                {
                    return(new NormalResult
                    {
                        Value = -1,
                        ErrorInfo = "This application cannot check for an update. This most often happens if the application is already in the process of updating. Error: " + ioe.Message
                    });
                }
                catch (Exception ex)
                {
                    return(new NormalResult
                    {
                        Value = -1,
                        ErrorInfo = "检查更新出现异常: " + ExceptionUtil.GetDebugText(ex)
                    });
                }

                if (updateAvailable == false)
                {
                    return new NormalResult
                           {
                               Value     = 0,
                               ErrorInfo = "没有发现更新"
                           }
                }
                ;
                try
                {
                    ad.Update();

                    return(new NormalResult
                    {
                        Value = 1,
                        ErrorInfo = "自动更新完成。重启可使用新版本"
                    });
                    // Application.Restart();
                }
                catch (DeploymentDownloadException dde)
                {
                    return(new NormalResult
                    {
                        Value = -1,
                        ErrorInfo = "Cannot install the latest version of the application. Either the deployment server is unavailable, or your network connection is down. \n\nPlease check your network connection, or try again later. Error: " + dde.Message
                    });
                }
                catch (TrustNotGrantedException tnge)
                {
                    return(new NormalResult
                    {
                        Value = -1,
                        ErrorInfo = "The application cannot be updated. The system did not grant the application the appropriate level of trust. Please contact your system administrator or help desk for further troubleshooting. Error: " + tnge.Message
                    });
                }
                catch (Exception ex)
                {
                    return(new NormalResult
                    {
                        Value = -1,
                        ErrorInfo = "自动更新出现异常: " + ExceptionUtil.GetDebugText(ex)
                    });
                }
            }

            return(new NormalResult());
        }
예제 #19
0
 private void button1_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     set(label1, ad.CheckForUpdate());
     Cursor.Current = Cursors.Default;
 }
예제 #20
0
        public void UpdateApplicationAsync(bool _onBackground)
        {
            if (!ApplicationDeployment.IsNetworkDeployed)
            {
                // not ClickOnce deployed
                labelLoading.Visible = false;
                return;
            }

            if (!CheckForInternetConnection())
            {
                labelLoading.Visible = false;
                //MetroFramework.MetroMessageBox.Show(ownerForm, "No internet connection found!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!_onBackground)
            {
                labelLoading.Visible = true;
            }
            else
            {
                labelLoading.Visible = false;
            }


            // Why use the ThreadPool instead of CheckForUpdateAsync?
            // Some network condition, e.g. Hotel or Guest Wi-Fi, can
            // make ClickOnce throw internally in such a way the exception
            // is tricky to catch. Instead, use CheckForUpdates (sync)
            // and handle the exception directly.
            if (!CheckForUpdateAvailable())
            {
                labelLoading.Visible = false;
                return;
            }


            ThreadPool.QueueUserWorkItem(delegate
            {
                try
                {
                    if (deployment != null)
                    {
                        if (deployment.CheckForUpdate() && pendingUpdate != true)
                        {
                            pendingUpdate = true;
                            deployment.UpdateCompleted +=
                                new AsyncCompletedEventHandler(
                                    deployment_UpdateCompleted);
                            deployment.UpdateAsync();
                        }
                        else
                        {
                            updateOnStart        = false;
                            labelLoading.Visible = false;
                        }
                    }
                }
                catch (Exception ex)
                {
                    labelLoading.Visible = false;
                    MessageBox.Show(ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message);
                }
            });
        }
예제 #21
0
파일: AboutBox.cs 프로젝트: CSSAdmin/TScan
        /// <summary>
        /// Gets the deploy info.
        /// </summary>
        internal void GetDeployInfo()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
                if (ad != null)
                {
                    try
                    {
                        //this.descriptionTexbox.Text += "Local Data Directory: " + ad.DataDirectory + "\n" + "Version: " + ad.CurrentVersion.ToString() + "\n" + "Sketch DLL Version: " + this.sketchVersion + "\n" + "First time running this version: " + ad.IsFirstRun.ToString() + "\n" + "Last Checked for Updates: " + ad.TimeOfLastUpdateCheck.ToString() + "\n" + "Location of Updates: " + ad.UpdateLocation.AbsoluteUri + "\n" + "Updates Available: " + ad.CheckForUpdate().ToString();
                        this.descriptionTexbox.Text += "Local Data Directory: " + ad.DataDirectory + "\n" + "Version: " + ad.CurrentVersion.ToString() + "\n" + "First time running this version: " + ad.IsFirstRun.ToString() + "\n" + "Last Checked for Updates: " + ad.TimeOfLastUpdateCheck.ToString() + "\n" + "Location of Updates: " + ad.UpdateLocation.AbsoluteUri + "\n" + "Updates Available: " + ad.CheckForUpdate().ToString();
                        //descriptionTextBox.Text += "\nVersion: " + ad.CurrentVersion.ToString();
                        //descriptionTextBox.Text += "\nSketch DLL Version: " + this.sketchVersion;
                        //descriptionTextBox.Text += "\nFirst time running this version: " + ad.IsFirstRun.ToString();
                        //descriptionTextBox.Text += "\nLast Checked for Updates: " + ad.TimeOfLastUpdateCheck.ToString();
                        //descriptionTextBox.Text += "\nLocation of Updates: " + ad.UpdateLocation.AbsoluteUri;
                        //descriptionTextBox.Text += "\nUpdates Available: " + ad.CheckForUpdate().ToString();
                        //descriptionTextBox.Text += "\n";
                    }
                    catch (Exception ex)
                    {
                        this.descriptionTexbox.Text += ex.Message;
                    }
                }
            }
            else
            {
                this.descriptionTexbox.Text += "\n" + "Cannot contact update server...";
            }

            this.descriptionTexbox.Text = this.descriptionTexbox.Text;
        }
예제 #22
0
        static void Main(string[] args)
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
                if (ad.CheckForUpdate())
                {
                    MessageBox.Show("程序有更新!");
                    ad.UpdateCompleted += new AsyncCompletedEventHandler(ad_UpdateCompleted);

                    ad.Update();
                    return;
                }
            }
            //var wi = WindowsIdentity.GetCurrent();
            //var wp = new WindowsPrincipal(wi);
            //bool runAsAdmin = wp.IsInRole(WindowsBuiltInRole.Administrator);
            //if (!runAsAdmin)
            //{
            //    MessageBox.Show("对不起程序需要一个管理员权限运行,而当前没有管理员权限");
            //    Application.Exit();
            //}


            //处理未捕获的异常
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            //处理UI线程异常
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Utilities.UnhandledThreadExceptonHandler);
            //处理非UI线程异常
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Utilities.UnhandledExceptonHandler);

            System.AppDomain.CurrentDomain.UnhandledException += new System.UnhandledExceptionEventHandler(Utilities.UnhandledExceptonHandler);

            Process instance = RunningInstance();
            bool    bExist   = true;

            Mutex MyMutex = new Mutex(true, "LOLReplay", out bExist);

            if (!bExist || instance != null)
            {
                //Make   sure   the   window   is   not   minimized   or   maximized
                //ShowWindowAsync(instance.MainWindowHandle, WS_SHOWMAXIMIZED);
                //Set   the   real   intance   to   foreground   window
                SetForegroundWindow(instance.MainWindowHandle);

                string[] cmds = Environment.GetCommandLineArgs();
                if (cmds.Length == 2)
                {
                    int WINDOW_HANDLER = FindWindow(null, @"LOL Replay - www.lolcn.cc");
                    if (WINDOW_HANDLER != 0)
                    {
                        COPYDATASTRUCT cds;
                        cds.dwData = (IntPtr)100;
                        cds.lpData = cmds[1];
                        cds.cbData = cmds[1].Length * 2;
                        SendMessage(WINDOW_HANDLER, 0x004A, 0, ref cds);
                    }
                }
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                string arg = "";
                if (args.Length > 0)
                {
                    arg = args[0].Replace("\\/", "/");
                }
                MainForm mainForm = new MainForm()
                {
                    cmd = arg
                };
                Application.Run(mainForm);
            }
        }