zoukankan      html  css  js  c++  java
  • 软件手动更新代码(vs2003) 转载cnblogs

    启动更新程序执行文件

    private void button2_Click(object sender, System.EventArgs e)
            
    {
                
    string updateAppPath = Common.AppStartPath + @"\AutoUpdate.exe";
                
    if(!File.Exists(updateAppPath))
                
    {
                    MessageBox.Show(
    "无法找到AutoUpdate应用程序!");
                    
    return;
                }

                
    string argments = Process.GetCurrentProcess().Id.ToString();
                ProcessStartInfo startInfo 
    = new ProcessStartInfo(updateAppPath, argments);
                Process updateApp 
    = new Process();
                updateApp.StartInfo 
    = startInfo;
                updateApp.Start();
            }


    得到启动程序的所在的文件夹路径

    private static string strAppPath = String.Empty;

            
    /// <summary>
            
    /// 系统启动路径
            
    /// </summary>

            public static string AppStartPath
            
    {
                
    get
                
    {
                    
    if (strAppPath == String.Empty)
                    
    {
                        strAppPath 
    =
                            System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                        System.Uri uriPath 
    = new Uri(strAppPath);
                        strAppPath 
    = uriPath.LocalPath.Replace('/''\\');

                    }

                    
    return strAppPath;
                }

            }


        项目Domo下载:https://files.cnblogs.com/xiaobaigang/test.rar




  • 相关阅读:
    C#之泛型
    etcd 使用: golang 例子
    九卷读书:《高效能人士的7个习惯》脑图
    Go package(2) strings 用法
    技术管理:技术管理者的多维度能力及成长路径
    gin框架教程:代码系列demo地址
    五大常见的MySQL高可用方案
    gin框架教程三:JWT的使用
    九卷读书:商业模式画布
    Go package(1) time 用法
  • 原文地址:https://www.cnblogs.com/xiaobaigang/p/967590.html
Copyright © 2011-2022 走看看