Example #1
0
        private void FrmVersionInfo_Load(object sender, System.EventArgs e)
        {
            try
            {
                g_TimeServer  = SYS_VersionInfo.Inst.GetTimeServer().Value;
                LastDate      = g_TimeServer;
                ListVer       = SYS_VersionInfo.GetList();
                DienThoai     = AutoUpdate.GetVersionNew(EnumModule.G5_DienThoai);
                TongDai       = AutoUpdate.GetVersionNew(EnumModule.G5_TongDai);
                DieuHanhChinh = AutoUpdate.GetVersionNew(EnumModule.DieuHanhChinh);
            }
            catch (Exception ex)
            { }
            #region Fill dữ liệu
            grdData.DataSource = ListVer;

            txt_DienThoai_PhienBan.Text        = DienThoai.Version;
            txt_DienThoai_HanCapNhat.EditValue = DienThoai.UpdateDate;
            txt_DienThoai_MoTa.Text            = DienThoai.Description;

            txt_TongDai_PhienBan.Text        = TongDai.Version;
            txt_TongDai_HanCapNhat.EditValue = TongDai.UpdateDate;
            txt_TongDai_MoTa.Text            = TongDai.Description;

            txt_DieuHanhChinh_PhienBan.Text        = DieuHanhChinh.Version;
            txt_DieuHanhChinh_HanCapNhat.EditValue = DieuHanhChinh.UpdateDate;
            txt_DieuHanhChinh_MoTa.Text            = DieuHanhChinh.Description;
            #endregion
        }
Example #2
0
        public ProgressDialog(AutoUpdate autoUpdate, PendingUpdate update)
        {
            InitializeComponent();

            _autoUpdate = autoUpdate;
            _update     = update;

            Loaded += delegate
            {
                Action <double> downloadProgress = (value) =>
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        DownloadProgressBar.Value = value;
                    }));
                };

                Action installerStarted = () =>
                {
                    App.Current.Shutdown();
                };

                _autoUpdate.InstallPendingUpdate(_update as PendingUpdate, downloadProgress, installerStarted);
            };
        }
Example #3
0
        static void Main(string[] args)
        {
            SystemParametersInfo(SPI_SETKEYBOARDCUES, 0, 1, 0);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);
            Global.Module = EnumModule.Staxi_TongDai;
            while (count <= 5)
            {
                count++;
                if (Taxi.Business.DieuHanhTaxi.GetTimeServer() > DateTime.MinValue)
                {
                    AutoUpdate objAutoUpdate = new AutoUpdate().GetUpdateByDateTime(Utils.Module.TongDaiVien, Taxi.Utils.license.Version());
                    if (objAutoUpdate != null)
                    {
                        System.Diagnostics.Process.Start("AutoUpdate.exe", objAutoUpdate.ModuleName);
                    }
                    else
                    {
                        Application.Run(new frmDieuHanhBoDamNEW_V3());
                    }
                    break;
                }
                else
                {
                    if (count >= 5)
                    {
                        Application.Run(new frmSettings());
                    }
                }
                System.Threading.Thread.Sleep(1000);
            }
        }
Example #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                AutoUpdate.RemotePath     = "http://www.angelsuite.net/updates/";
                AutoUpdate.UpdateFileName = "AutoUpdate.txt";

                switch (AutoUpdate.UpdateFiles(AutoUpdate.RemotePath, true))
                {
                case AutoUpdate.UpdateStatus.NothingToUpdate:
                case AutoUpdate.UpdateStatus.ErrorInAutoUpdate:
                case AutoUpdate.UpdateStatus.ErrorAtServer:
                case AutoUpdate.UpdateStatus.UpdateMismatch:
                default:
                    StartAngelSuite();
                    break;

                case AutoUpdate.UpdateStatus.NoConnectionToServer:
                    MessageBox.Show("AutoUpdate could not connect to the remote server to\r\nmake sure you are running the latest version.\r\n\r\nPlease check that your internet connection is working.", "AutoUpdate Problem", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    StartAngelSuite();
                    break;

                case AutoUpdate.UpdateStatus.UpdatedSuccessfully:
                    Utils.DoGarbageCollection();
                    Application.Restart();
                    return;
                }
            }
            catch
            {
                StartAngelSuite();
            }
        }
Example #5
0
        static void Main()
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName))
                        {
                            process.WaitForExit(2000);
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 Xindeco智能供应链系统(大通道机) 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }

            AppConfig.Load();

            if (AutoUpdate.Update(SoftwareType.BigChannelPM))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
        }
Example #6
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         if (InterfaceUri != null)
         {
             result = (result * 397) ^ InterfaceUri.GetHashCode();
         }
         if (Name != null)
         {
             result = (result * 397) ^ Name.GetHashCode();
         }
         result = (result * 397) ^ AutoUpdate.GetHashCode();
         if (Requirements != null)
         {
             result = (result * 397) ^ Requirements.GetHashCode();
         }
         result = (result * 397) ^ CapabilityLists.GetSequencedHashCode();
         if (AccessPoints != null)
         {
             result = (result * 397) ^ AccessPoints.GetHashCode();
         }
         return(result);
     }
 }
Example #7
0
        /// <summary>
        /// Find corresponding file and open it
        ///
        /// First, get the list of possible file endings
        /// Then, look in same folder
        /// Then, look in project folder and use the first match
        /// </summary>
        public static void SwitchToRelated(EnvDTE.Document document)
        {
            AutoUpdate.OnFeatureUsed();

            // This should never occur, but let's make sure it doesn't crash
            if (document == null)
            {
                return;
            }

            string path     = document.Path;
            string name     = document.Name;
            string ext      = GetExtensionExt(name);
            string name_new = null;

            List <string> list;

            // If the following fails, we don't know what we're looking for
            // There is (surprisingly!) no entry in the dictionary for that ending
            if (!Dict.TryGetValue(ext, out list))
            {
                return;
            }

            // First, look in the same folder and try all the endings we have
            foreach (string ext_new in list)
            {
                name_new = ChangeExtensionExt(name, ext_new);

                if (File.Exists(path + name_new))
                {
                    document.DTE.ItemOperations.OpenFile(path + name_new, Constants.vsViewKindAny);
                    return;
                }
            }

            Project prj = document.ProjectItem.ContainingProject;

            // If the file does not belong to a project, we don't know where to look
            if (prj == null)
            {
                return;
            }

            // Then, look in project folder and use the first match
            foreach (string ext_new in list)
            {
                name_new = Path.ChangeExtension(name, ext_new);

                foreach (ProjectItem projectItem in prj.ProjectItems)
                {
                    ProjectItem found = FindProjectItemByName(projectItem, name_new);
                    if (found != null)
                    {
                        found.Open(Constants.vsViewKindCode);
                        return;
                    }
                }
            }
        }
Example #8
0
        public void UpdateOptionAsync_InstallerDownloadTimeGreaterZero()
        {
            Mock <IGitHubWrapper> githubMock = BuildGitHubWrapper(configInfo: CurrentUpgradeDataForDefaultOptionalUpgradeForInsider);

            githubMock.Setup(x => x.TryGetSpecificAsset(It.IsAny <Uri>(), It.IsAny <Stream>()))
            .Callback <Uri, Stream>((Uri, stream) =>
            {
                Thread.Sleep(1);
            })
            .Returns(true);

            AutoUpdate update = new AutoUpdate(githubMock.Object, () => TestInstalledVersion);

            // ensure that the timespans are 0 before calling UpdateAsync
            TimeSpan?installerDownloadTime = update.GetInstallerDownloadTime();

            Assert.IsTrue(installerDownloadTime.HasValue);
            Assert.AreEqual(TimeSpan.Zero, installerDownloadTime.Value);
            TimeSpan?installerVerificationTime = update.GetInstallerVerificationTime();

            Assert.IsTrue(installerVerificationTime.HasValue);
            Assert.AreEqual(TimeSpan.Zero, installerVerificationTime.Value);

            update.UpdateAsync().Wait();

            // Ensure the timespans are > 0 after calling UpdateAsync
            installerDownloadTime = update.GetInstallerDownloadTime();
            Assert.IsTrue(installerDownloadTime.HasValue);
            Assert.AreNotEqual(TimeSpan.Zero, installerDownloadTime.Value);
            installerVerificationTime = update.GetInstallerVerificationTime();
            Assert.IsTrue(installerVerificationTime.HasValue);
            Assert.AreNotEqual(TimeSpan.Zero, installerVerificationTime.Value);
            githubMock.VerifyAll();
        }
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Global.Module = EnumModule.G5_DienThoai;
     while (count <= 5)
     {
         count++;
         if (Taxi.Business.DieuHanhTaxi.GetTimeServer() > DateTime.MinValue)
         {
             AutoUpdate objAutoUpdate = new AutoUpdate().GetUpdateByDateTime(Utils.Module.DienThoaiVien, Taxi.Utils.license.Version());
             if (objAutoUpdate != null && !Debugger.IsAttached)
             {
                 System.Diagnostics.Process.Start("AutoUpdate.exe", objAutoUpdate.ModuleName);
             }
             else
             {
                 license.CheckLicense();
                 Application.Run(new frmDieuHanhDienThoaiNEWCP_V3());
             }
             break;
         }
         else
         {
             if (count >= 5)
             {
                 Application.Run(new frmSettings());
             }
         }
         System.Threading.Thread.Sleep(1000);
     }
 }
Example #10
0
        static void Main()
        {
            SystemParametersInfo(SPI_SETKEYBOARDCUES, 0, 1, 0);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);
            Global.Module            = EnumModule.G5_TongDai;
            QuanTriCauHinh.IpAddress = QuanTriCauHinh.GetLocalIPAddress();
            ServiceVersion.CheckVersionStart();
            while (count <= 5)
            {
                count++;
                if (Business.DieuHanhTaxi.GetTimeServer() > DateTime.MinValue)
                {
                    AutoUpdate objAutoUpdate = new AutoUpdate().GetUpdateByDateTime(Module.TongDaiVien, license.Version());
                    if ((objAutoUpdate != null || ServiceVersion.IsRequired) && !Debugger.IsAttached)
                    {
                        Process.Start("AutoUpdate.exe", objAutoUpdate.ModuleName);
                    }
                    else
                    {
                        Application.Run(new frmDieuHanhBoDamNEW_V3());
                    }
                    break;
                }

                if (count >= 5)
                {
                    Application.Run(new frmSettings());
                }
                System.Threading.Thread.Sleep(1000);
            }
        }
        public void TestUpdateAll(string userKey, string currentModel, bool isExpectedDownload)
        {
            AutoUpdate updater = new AutoUpdate();

            if (userKey != null)
            {
                updater.UserKey = userKey;
            }
            updater.CurrentVersion = testVersion;
            bool retVal = updater.UpdateAll();

            Assert.AreEqual(isExpectedDownload, retVal, "did download");
            Assert.AreEqual("", updater.Message);
            if (!isExpectedDownload)
            {
                return;
            }
            string dllFile = dllFolder + "TickZoomEngine-" + updater.CurrentVersion + ".dll";

            Assert.IsTrue(File.Exists(dllFile));
            var assemblyName = AssemblyName.GetAssemblyName(dllFile);

            Assert.AreEqual(assemblyName.Version, new Version(testVersion));
            dllFile = dllFolder + "ProviderCommon-" + updater.CurrentVersion + ".dll";
            Assert.IsTrue(File.Exists(dllFile));
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    //合并升级信息
                    MergeUpgradeInfo();
                    //获取官方升级版本列表,并存放到本地upgrade/versionlist.config中
                    AutoUpdate   autoUpdate  = new AutoUpdate();
                    string       fileContnet = autoUpdate.GetVersionList();
                    StreamWriter writer      = new StreamWriter(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/upgradeini.config"));
                    writer.Write(fileContnet.Replace("\n", "\r\n"));
                    writer.Close();
                    //取本地更新版本号与官方的最新版本号比较,如果官方有更新,则提示有升级
                    XmlDocument lastupdate = new XmlDocument();
                    lastupdate.Load(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"));
                    //DateTime build = StrToDateTime(lastupdate.SelectSingleNode("/localupgrade/optionalupgrade/item").InnerText);
                    XmlNodeList local         = lastupdate.SelectNodes("/localupgrade/optionalupgrade/dnt" + Utils.GetAssemblyVersion() + "/item");
                    XmlDocument currentupdate = new XmlDocument();
                    currentupdate.LoadXml(fileContnet);
                    XmlNodeList service = currentupdate.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/optionalupgrade/dnt" + Utils.GetAssemblyVersion() + "/item");
                    int         i       = 0;

                    string script = "";
                    foreach (XmlNode serviceitem in service)
                    {
                        bool exist = false;
                        foreach (XmlNode localitem in local)
                        {
                            if (serviceitem.FirstChild.InnerText == localitem.InnerText)
                            {
                                exist = true;
                                break;
                            }
                        }
                        if (!exist)
                        {
                            isNew      = true;
                            info.Text += "<input type='checkbox' value='" + serviceitem["version"].InnerText + "' id='checkbox" + i + "' checked='checked'><label for='checkbox" + i + "'>" + serviceitem["versiondescription"].InnerText + "</label>";
                            info.Text += "<p style='border: 1px dotted rgb(219, 221, 211); background: rgb(255, 255, 204);font-size:12px;padding:0px 0px 0px 15px;'>" + serviceitem["description"].InnerText + "</p>";
                            script    += "{\"version\":\"" + serviceitem["version"].InnerText + "\",\"versiondescription\":\"" + serviceitem["versiondescription"].InnerText + "\",\"link\":\"" + serviceitem["link"].InnerText + "\"},";
                            i++;
                        }
                    }
                    if (!isNew)
                    {
                        info.Text = "暂无更新";
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>var versionList = [" + script.TrimEnd(',') + "]</script>");
                    }
                }
                catch
                {
                    info.Text = "升级发生异常,请稍后再试……";
                }
            }
        }
Example #13
0
        static void Main()
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 通道机检货系统 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }
            //载入默认配置
            AppConfig.Load();

            if (AutoUpdate.Update(SoftwareType.自动下载_HLA))
            {
                SAPDataService.Init();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new DownloadForm());
            }
        }
        public static void InitializeWithAutoupdateProtectedFileList()
        {
            var pendingUpdates = AutoUpdate.GetPendingUpdateQueues(ServiceHandler.Service);

            var protectedList = new List <string>();

            foreach (var filesInLobbyUpdatePackage in pendingUpdates.AllFilesInUpdatePackage)
            {
                foreach (var item in filesInLobbyUpdatePackage.Value)
                {
                    string basePath = String.Empty;

                    if (item.LobbyId != null)
                    {
                        basePath = ((LobbyType)item.LobbyId).ToString();
                    }

                    if (item.IsProtected)
                    {
                        var filename = item.Filename.ToLower();

                        if (filename.StartsWith(@"\"))                         //Remove preceding '\'
                        {
                            filename = filename.Remove(0, 1);
                        }

                        protectedList.Add(Path.Combine(basePath, filename).ToLower());
                    }
                }
            }

            SystemWatcher.Initialize(protectedList);
        }
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Uuid != null)
                {
                    hashCode = hashCode * 59 + Uuid.GetHashCode();
                }
                if (AgreementName != null)
                {
                    hashCode = hashCode * 59 + AgreementName.GetHashCode();
                }
                if (AgreementFileData != null)
                {
                    hashCode = hashCode * 59 + AgreementFileData.GetHashCode();
                }

                hashCode = hashCode * 59 + AutoUpdate.GetHashCode();
                if (SubRealmId != null)
                {
                    hashCode = hashCode * 59 + SubRealmId.GetHashCode();
                }
                return(hashCode);
            }
        }
Example #16
0
            public General()
            {
                // set default values
                RecentFilesCount = 4;
                Language         = LanguageType.English;

                PropertiesSortType = PropertySort.NoSort;
                PropertiesShowHelp = false;

                EditorModifiedAddedColor = Color.FromArgb(255, 255, 164);
                EditorModifiedColor      = Color.FromArgb(255, 227, 164);
                EditorModifiedSavedColor = Color.FromArgb(192, 255, 192);
                EditorHiddenColor        = Color.FromArgb(128, 128, 128);

                FormattingSpaces    = true;
                FormattingEmptyLine = true;
                FormattingComments  = true;

                AutoUpdate = new AutoUpdate
                {
                    Enabled = true,
                    Proxy   = new Proxy(),
                };
                SetDefaultAutoUpdate();
            }
Example #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         try
         {
             this.MergeUpgradeInfo();
             AutoUpdate   autoUpdate   = new AutoUpdate();
             string       versionList  = autoUpdate.GetVersionList();
             StreamWriter streamWriter = new StreamWriter(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/upgradeini.config"));
             streamWriter.Write(versionList.Replace("\n", "\r\n"));
             streamWriter.Close();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"));
             XmlNodeList xmlNodeList  = xmlDocument.SelectNodes("/localupgrade/optionalupgrade/dnt" + Utils.Version + "/item");
             XmlDocument xmlDocument2 = new XmlDocument();
             xmlDocument2.LoadXml(versionList);
             XmlNodeList xmlNodeList2 = xmlDocument2.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/optionalupgrade/dnt" + Utils.Version + "/item");
             int         num          = 0;
             string      text         = "";
             foreach (XmlNode xmlNode in xmlNodeList2)
             {
                 bool flag = false;
                 foreach (XmlNode xmlNode2 in xmlNodeList)
                 {
                     if (xmlNode.FirstChild.InnerText == xmlNode2.InnerText)
                     {
                         flag = true;
                         break;
                     }
                 }
                 if (!flag)
                 {
                     this.isNew = true;
                     Label  expr_188 = this.info;
                     object text2    = expr_188.Text;
                     expr_188.Text = text2 + "<input type='checkbox' value='" + xmlNode["version"].InnerText + "' id='checkbox" + num + "' checked='checked'><label for='checkbox" + num + "'>" + xmlNode["versiondescription"].InnerText + "</label>";
                     Label expr_21F = this.info;
                     expr_21F.Text = expr_21F.Text + "<p style='border: 1px dotted rgb(219, 221, 211); background: rgb(255, 255, 204);font-size:12px;padding:0px 0px 0px 15px;'>" + xmlNode["description"].InnerText + "</p>";
                     string text3 = text;
                     text = text3 + "{\"version\":\"" + xmlNode["version"].InnerText + "\",\"versiondescription\":\"" + xmlNode["versiondescription"].InnerText + "\",\"link\":\"" + xmlNode["link"].InnerText + "\"},";
                     num++;
                 }
             }
             if (!this.isNew)
             {
                 this.info.Text = "暂无更新";
             }
             else
             {
                 base.RegisterStartupScript("", "<script>var versionList = [" + text.TrimEnd(',') + "]</script>");
             }
         }
         catch
         {
             this.info.Text = "升级发生异常,请稍后再试……";
         }
     }
 }
Example #18
0
 private void LoadUpgradeInfo()
 {
     if (!base.IsPostBack)
     {
         try
         {
             this.MergeUpgradeInfo();
             AutoUpdate   autoUpdate   = new AutoUpdate();
             string       versionList  = autoUpdate.GetVersionList();
             StreamWriter streamWriter = new StreamWriter(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/upgradeini.config"));
             streamWriter.Write(versionList.Replace("\n", "\r\n"));
             streamWriter.Close();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"));
             DateTime    t            = this.StrToDateTime(xmlDocument.SelectSingleNode("/localupgrade/requiredupgrade").InnerText);
             XmlDocument xmlDocument2 = new XmlDocument();
             xmlDocument2.LoadXml(versionList);
             XmlNodeList xmlNodeList = xmlDocument2.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/requiredupgrade/item");
             XmlNode     xmlNode     = xmlNodeList.Item(xmlNodeList.Count - 1);
             DateTime    t2          = this.StrToDateTime(xmlNode["version"].InnerText);
             this.isNew = (t2 > t);
             if (this.isNew)
             {
                 this.upgradeInfo = "<span style='font-size:16px;'>检测到最新版本:" + xmlNode["versiondescription"].InnerText + "</span><br /><span style='padding:3px 0px 3px 10px;display:block;'>" + xmlNode["description"].InnerText + "</span>";
             }
             XmlNodeList xmlNodeList2 = xmlDocument.SelectNodes("/localupgrade/optionalupgrade/dnt" + Utils.Version + "/item");
             XmlNodeList xmlNodeList3 = xmlDocument2.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/optionalupgrade/dnt" + Utils.Version + "/item");
             string      text         = "";
             foreach (XmlNode xmlNode2 in xmlNodeList3)
             {
                 bool flag = false;
                 foreach (XmlNode xmlNode3 in xmlNodeList2)
                 {
                     if (xmlNode2.FirstChild.InnerText == xmlNode3.InnerText)
                     {
                         flag = true;
                         break;
                     }
                 }
                 if (!flag)
                 {
                     this.isHotFix = true;
                     text          = text + xmlNode2["versiondescription"].InnerText + "<br />";
                 }
             }
             if (text != "")
             {
                 this.upgradeInfo = this.upgradeInfo + "<span style='font-size:16px;'>检测到最新补丁:</span><br /><span style='padding:3px 0px 3px 10px;display:block;'>" + text + "</span>";
             }
             if (this.isNew || this.isHotFix)
             {
                 base.RegisterStartupScript("", "<script type='text/javascript'>\r\nshowInfo();\r\n</script>\r\n");
             }
         }
         catch
         {
         }
     }
 }
Example #19
0
        static void Main(string[] arg)
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 退货复核 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }

            AppConfig.Load();

#if DEBUG
            SysConfig.LGNUM    = "HL01";
            SysConfig.DeviceNO = "MYKKD-12";
            SysConfig.DBUrl    = @"Data Source=172.18.207.92;Initial Catalog=heilandb;User ID=sa;password=myk_123456";
#else
            if (arg.Length >= 3)
            {
                SysConfig.LGNUM    = arg[0];
                SysConfig.DeviceNO = arg[1];
                SysConfig.DBUrl    = arg[2];
            }
            else
            {
                SysConfig.DBUrl    = ConfigurationManager.ConnectionStrings["ConnStr"]?.ConnectionString;
                SysConfig.LGNUM    = ConfigurationManager.AppSettings["LGNUM"];
                SysConfig.DeviceNO = ConfigurationManager.AppSettings["DeviceNO"];

                if (string.IsNullOrEmpty(SysConfig.LGNUM) || string.IsNullOrEmpty(SysConfig.DeviceNO) || string.IsNullOrEmpty(SysConfig.DBUrl))
                {
                    MessageBox.Show("请从主界面运行程序", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
#endif

            if (AutoUpdate.Update(SoftwareType.发货复核_单检机))
            {
                SAPDataService.Init();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new LoginForm());
            }
        }
Example #20
0
        public void UpdateAsync_ConfigShowsNoUpgrade_ReturnsNoUpgradeAvailable()
        {
            Mock <IChannelInfoProvider> providerMock = BuildChannelInfoProvider(DefaultReleaseChannel, NoUpgradeChannelInfo);
            AutoUpdate update = BuildAutoUpdate(channelProvider: providerMock.Object);

            Assert.AreEqual(UpdateResult.NoUpdateAvailable, update.UpdateAsync().Result);
            providerMock.VerifyAll();
        }
        private void FrmRequired_Load(object sender, System.EventArgs e)
        {
            var info = AutoUpdate.GetVersionNew(Global.Module);

            txtDescription.Text = info.Description;
            lblVer.Text         = info.Version;
            lblHanCapNhat.Text  = info.UpdateDate.ToString("HH:mm dd/MM/yyyy");
        }
        /// <summary>
        /// Performs an update of the data file with any licence keys
        /// available from the root solution folder.
        /// </summary>
        /// <returns></returns>
        private AutoUpdate.AutoUpdateStatus Update()
        {
            var licenceKeys = GetLicenceKeys();

            return(AutoUpdate.Update(
                       licenceKeys,
                       TestDataFile));
        }
Example #23
0
        private Managers()
        {
            _mysqlManager      = MySQLManager.CreateManager();
            _printerManager    = new PrinterManager();
            _buttonListManager = ButtonListManager.CreateManager();
            _autoUpdate        = AutoUpdate.CreateAutoUpdate();

            //_userManager = new UserManager();
        }
Example #24
0
 /// <summary>
 /// Updates the manifest from the command and force AU
 /// </summary>
 /// <param name="cmd"></param>
 private void AutoUpdateCheckNow(GetCommandResponse cmd)
 {
     if (cmd.parameters.manifest != null)
     {
         AutoUpdate.ManifestUrl = cmd.parameters.manifest;
         AutoUpdate.Enabled     = true;
         AutoUpdate.CheckNow();
     }
 }
Example #25
0
        static void Main(string[] arg)
        {
            LogHelper.WriteLine("程序开始运行...");
            Process[] processes  = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
            Process   curProcess = Process.GetCurrentProcess();

            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 单检机发货 已运行!", "警告");
                                return;
                            }
                        }
                    }
                }
            }

            //载入默认配置
            AppConfig.Load();
            SysConfig.InitUomDic();

            if (arg.Length >= 3)
            {
                SysConfig.LGNUM    = arg[0];
                SysConfig.DeviceNO = arg[1];
                SysConfig.DBUrl    = arg[2];
            }
            else
            {
                MessageBox.Show("请从主界面运行程序", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //检测版本
            if (AutoUpdate.Update(SoftwareType.单检机发货))
            {
                SAPDataService.Init();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                try
                {
                    Application.Run(new LoginForm());
                }
                catch (Exception e)
                {
                    LogHelper.Error(e.Message, e.StackTrace);
                    MessageBox.Show("程序出现问题,请联系管理员!" + e.Message, "警告");
                }
            }
        }
Example #26
0
        public void TestFileListFailure()
        {
            AutoUpdate updater = new AutoUpdate();

            updater.UserKey        = "";
            updater.CurrentVersion = testVersion;
            string[] files = updater.GetFileList();
            Assert.IsNull(files);
        }
Example #27
0
        static void Main(String[] arg)
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 通道机主数据手工下载系统 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }

            AppConfig.Load();

            if (arg.Length >= 3)
            {
                SysConfig.LGNUM    = arg[0];
                SysConfig.DeviceNO = arg[1];
                SysConfig.DBUrl    = arg[2];
            }
            else
            {
                SysConfig.DBUrl = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
                SysConfig.LGNUM = ConfigurationManager.AppSettings["LGNUM"];
            }

            if (AutoUpdate.Update(SoftwareType.通道机主数据手工下载系统))
            {
                //载入默认配置
                try
                {
                    SAPDataService.Init();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "警告");
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
        }
Example #28
0
        static void Main(string[] arg)
        {
            Process curProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(curProcess.ProcessName);
            if (processes.Length > 1)
            {
                foreach (Process process in processes)
                {
                    if (curProcess.Id != process.Id)
                    {
                        if ((curProcess.MainModule.FileName == process.MainModule.FileName)) //只检查进程在不同目录下的情况
                        {
                            process.WaitForExit(2000);                                       //等待上次的进程结束后再检查,否则重启终端时会有问题
                            if (!process.HasExited)
                            {
                                MessageBox.Show("检测到 箱复核 已运行!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }

            AppConfig.Load();

#if DEBUG
            SysConfig.LGNUM    = "HL01";
            SysConfig.DeviceNO = "GQ-4015";
            SysConfig.DBUrl    = @"Data Source=172.18.207.92;Initial Catalog=heilandb;User ID=sa;password=myk_123456";
#else
            if (arg.Length >= 3)
            {
                SysConfig.LGNUM    = arg[0];
                SysConfig.DeviceNO = arg[1];
                SysConfig.DBUrl    = arg[2];
            }
            else
            {
                MessageBox.Show("请从主界面运行程序", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
#endif

            SysConfig.loadReaderType();
            SysConfig.loadReaderTmPower();
            SysConfig.loadReaderTmIp();

            if (AutoUpdate.Update(SoftwareType.箱复核))
            {
                SAPDataService.Init();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new LoginForm());
            }
        }
Example #29
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            var isCanUpdate = await AutoUpdate.CheckUpdate();

            if (isCanUpdate)
            {
                var x = new UpdateDialog();
                await x.ShowAsync();
            }
        }
Example #30
0
        public void TestFreeEngineFailure()
        {
            AutoUpdate updater = new AutoUpdate();

            updater.UserKey        = "";
            updater.CurrentVersion = testVersion;
            bool retVal = updater.DownloadFile("TickZoomEngine-" + testVersion + ".dll");

            Assert.IsFalse(retVal, "did download");
        }
 public void Setup()
 {
     _webServer = new WebServer(new FileInfo(Path.Combine(Environment.CurrentDirectory, @"..\..\Source\DotNetAutoUpdate.Tests\Data")).FullName, 12345);
     _autoUpdate = new AutoUpdate();
     _autoUpdate.UpdateSettings.UpdateKeys = UpdateKeys.FromStrongNameKey("Data\\TestKeyPair.snk");
 }