示例#1
0
 public ProgrammUpdater()
 {
     m_instanse = this;
     onMessagereceive = (_text) => { };
     m_client = new WebClient();
     m_proxySettings = new ProxySettings();
 }
示例#2
0
        public Form1()
        {
            m_proxySettings = new ProxySettings(true, "10.10.10.100", 3128, "spirit", "54475");
            InitializeComponent();
            Text += " " + Assembly.GetExecutingAssembly().GetName().Version.ToString();

            if(Environment.GetCommandLineArgs().Count() != 3)
            {
                MessageBox.Show("Неправильно количествое параметров командной строки");
                Environment.Exit(0);
            }
            else
            {
                appName = Environment.GetCommandLineArgs().ToList()[2];
                remoteDownloadPath = Environment.GetCommandLineArgs().ToList()[1];
            }

            assemblyList = new List<UpdateAssemblyInfo>();

            if (!UpdateAssemblyInfo.loadFromXml("update.dat", ref assemblyList, m_proxySettings))
            {
                ui_updateButton.Enabled = false;
                ThreadSafe.WriteLog(ui_textLog, "Файл update.dat не найден!");
            }

            if (assemblyList.Count == 0)
            {
                ui_updateButton.Enabled = false;
                ThreadSafe.WriteLog(ui_textLog, "Нет обновлений");
            }
            else
            {
                ThreadSafe.WriteLog(ui_textLog, "Доступны для обновления новые файлы:");
                for(int i = 0 ; i < assemblyList.Count; i++)
                {
                    ThreadSafe.WriteLog(ui_textLog, assemblyList[i].name);
                }
                ThreadSafe.WriteLog(ui_textLog, String.Format("Всего файлов: {0} ", assemblyList.Count.ToString()));
            }

            m_updater = new UpdaterLib.ProgrammUpdater();
            m_updater.onMessagereceive += (_text => ThreadSafe.WriteLog(ui_textLog, _text));
            m_updater.m_proxySettings = new ProxySettings(true, "10.10.10.100", 3128, "spirit", "54475");
        }
示例#3
0
 public static ProgrammUpdater getInstance()
 {
     if (m_instanse == null) m_instanse = new ProgrammUpdater();
     return m_instanse;
 }
示例#4
0
 public static void DeleteInstance()
 {
     m_instanse = null;
 }