Ejemplo n.º 1
0
        //Excuting the tests
        private void Execute()
        {
            var tokenSource = new CancellationTokenSource();
            var token       = tokenSource.Token;

            UpdateConfig.SetEnivromnet(comboBox4.SelectedItem.ToString());
            try
            {
                Task t1 = Task.Factory.StartNew(() =>
                {
                    TestSuiteManager TestManager = new TestSuiteManager();
                    TestManager.StartRun(_settings);
                    //EnableButton(true);
                    //TCResult TCResult = new TCResult(TestManager.TestStartInfo);
                    //TCResult.PublicResult();
                });
                Task t2 = Task.Factory.StartNew(() =>
                {
                    MyLogger.LogAdded += SetText;
                });
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        public bool Update <T>(UpdateConfig config, T updateObject)
        {
            Type type = typeof(T);

            PropertyInfo[]     properties = type.GetProperties();
            CommandParameter[] parameters = BuildCommandParameters(updateObject, properties);
            DbCommand          dbCommand  = BuildCommand(config, parameters);
            bool pass = true;

            if (dbTransaction == null)
            {
                try
                {
                    db.ExecuteNonQuery(dbCommand);
                }
                catch (Exception ex)
                {
                    LogHelper.Warn("BlueFramework.Blood.DataAccess.Command.Update<T> :", ex);
                    pass = false;
                }
            }
            else
            {
                db.ExecuteNonQuery(dbCommand, dbTransaction);
            }
            return(pass);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            // Used later
            string _copy = Path.Combine(Updater.AppImageDir, "Updated.AppImage");

            File.Copy(Updater.AppImagePath, _copy, true);

            // Remote server example
            UpdateConfig _config = new UpdateConfig("https://github.com/ppy/osu/releases/latest/download/osu.AppImage");

            _config.DownloadedFilePath = "test";
            Updater.Download(_config);
            Updater.Update();

            // Local file example
            Updater.Download("Updated.AppImage");
            Updater.Update();

            // Remove the copy
            if (File.Exists(_copy))
            {
                File.Delete(_copy);
            }

            foreach (var log in Updater.Logs)
            {
                Console.WriteLine(log.Message);
                if (log.Exception != null)
                {
                    Console.WriteLine(log.Exception);
                }
            }
        }
Ejemplo n.º 4
0
        protected override object DoUpdate(UpdateContext context, UpdateConfig config, IEnumerable <object> datas, object complexData)
        {
            var          sql         = config.Sql;
            var          cols        = GetCols(config);
            var          key         = GetKeyName(config, cols);
            IValueSetter valueSetter = ValueSetterCreater.Create(datas.First());

            //1.自定义SQl一条条插入
            if (!string.IsNullOrEmpty(sql) || !string.IsNullOrEmpty(config.Filter))
            {
                if (string.IsNullOrEmpty(sql))
                {
                    config.Sql = DBHelper.BuildUpdateSql(cols, config, key, SqlKeyWorld.ComplexDataObjectStart);
                }

                config.ReturnId = true;
                var keys = valueSetter.GetFields(datas.First());
                foreach (var data in datas)
                {
                    context.ContentParams.ReplaceOrInsert(SqlKeyWorld.ComplexData, data);
                    UpdateTrigger.TriggeValuesChecked(context, data, config, cols, ActionType.Update, valueSetter, keys);
                    SqlExcuter.ExcuteTrann(context);
                    ExcuteSubUpdate(context, config, data);
                }

                return(datas.Count());
            }

            return(UpdateOnOneTime(context, config, cols, datas, valueSetter, key));
        }
Ejemplo n.º 5
0
        public async Task UpdateConfigTest(string uniqueId)
        {
            const string name        = "Kurt test updated";
            const string description = "Kurt's test config updated from test proj";

            UpdateConfig newConfig = new UpdateConfig
            {
                Name        = name,
                Description = description,
                Settings    = new List <Setting>
                {
                    new Setting
                    {
                        Key   = "Bye bye",
                        Value = "Hello 👋"
                    }
                }
            };

            ConfigWithSettingsList config = await _remoteConfigsRepo.UpdateConfigAsync(uniqueId, newConfig);

            Assert.NotNull(config);
            Assert.AreEqual(config.Name, name);
            Assert.AreEqual(config.Description, description);
            Assert.NotNull(config.Settings);
            Assert.NotZero(config.Settings.Count);
            Assert.AreEqual(config.Settings.Count, 1);
            Assert.Pass();
        }
Ejemplo n.º 6
0
        private static void TryUpdateConfig(Settings settings, IPersistence persistence,
                                            ConnectionManager connectionManager)
        {
            var updateConfig = new UpdateConfig(settings, persistence, connectionManager);

            updateConfig.CheckConfigVersionUpdate();
        }
Ejemplo n.º 7
0
        protected static string GetKeyName(UpdateConfig config, IDictionary <string, string> cols)
        {
            var key = config.Key;

            if (!string.IsNullOrEmpty(key))
            {
                return(key);
            }

            if (cols.ContainsKey(SqlKeyWorld.Id))
            {
                return(SqlKeyWorld.Id);
            }

            if (cols.ContainsKey(LowerId))
            {
                return(LowerId);
            }

            var keyColumn = TableColumnQueryHandler.QueryColumns(config).FirstOrDefault(c => c.IsKey);

            if (keyColumn != null)
            {
                return(keyColumn.ColName);
            }

            return(string.Empty);
        }
        protected static void ExcuteSubUpdate(UpdateContext context, UpdateConfig updateConfig, object parent)
        {
            var config = updateConfig.Config;
            if (config == null)
            {
                return;
            }

            var subConfigs = config[RelatedUpdates];
            if (subConfigs == null)
            {
                return;
            }

            var relatedConfigs = subConfigs.ToObject<IEnumerable<UpdateConfig>>();
            if (relatedConfigs.Any() == false)
            {
                return;
            }

            foreach (var relatedConfig in relatedConfigs)
            {
                relatedConfig.InTran = true;
                IUpdateHandler queryHandler = UpdateHandlerFactory.GetUpdateHandler(relatedConfig.QueryType);
                var subContext = new UpdateContext(context)
                {
                    ComplexData = parent,
                    Configs = new UpdateConfig[] { relatedConfig }
                };

                queryHandler.Update(subContext);
            }
        }
        public override string BuilderSql(UpdateContext updateContext, UpdateConfig config, IDictionary <string, string> cols)
        {
            var key = GetKeyName(config, cols);
            var sql = DBHelper.BuildUpdateSql(cols, config, key, SqlKeyWorld.ParamStart);

            return(sql.ToString());
        }
Ejemplo n.º 10
0
        public DownloadFileResult DownloadUpdateSystemFile(DownloadFileInfo downFileInfo)
        {
            UpdateConfig config = SerializeHelper.LoadXmlSerializeFile <UpdateConfig>(this.updateConfigPath);

            downFileInfo.PhysicalPath = Path.Combine(this.versionPath, config.ConfigInfo.CurrentVersion) + "\\" + downFileInfo.FileName;
            return(this.operateFile.DownloadFile(downFileInfo));
        }
        protected override void ApplyRules(UpdateContext updateContext, UpdateConfig config, IDictionary <string, string> cols)
        {
            var          uParams     = updateContext.Params;
            IValueSetter valueSetter = ValueSetterCreater.Create(uParams);

            UpdateTrigger.TriggeValuesChecked(updateContext, uParams, config, cols, ActionType.Update, valueSetter, uParams.Keys);
        }
Ejemplo n.º 12
0
        public void Update(bool urlSet)
        {
            UpdateBuilder updateBuilder        = new UpdateBuilder(new UpdateConfig());
            UpdateBuilder actionBuilder        = null;
            UpdateConfig  config               = null;
            Exception     exception            = null;
            TableBuilder <TableEntity> builder = null;

            _builderFactory.UpdateBuilder(Arg.Do <UpdateConfig>(c => { config = c; c.Url = urlSet ? "" : null; }))
            .Returns(updateBuilder);

            try
            {
                builder = _builder.Update(b => actionBuilder = b);
                this.RenderAndVerify();
            }
            catch (Exception e)
            {
                exception = e;
            }

            _builderFactory.Received(1).UpdateBuilder(Arg.Any <UpdateConfig>());
            actionBuilder.Should().BeSameAs(updateBuilder);
            if (urlSet)
            {
                exception.Should().BeNull();
                config.Should().BeSameAs(_config.Update);
                builder.Should().BeSameAs(_builder);
            }
            else
            {
                exception.Should().BeOfType <ArgumentNullException>();
            }
        }
Ejemplo n.º 13
0
        public AutoUpdateServiceManager()
        {
            InitializeComponent();

            this.updateSystem = ServiceManager.ServiceManagerInstance.GetRemotingService <IUpdateSystem>("updateSystem");
            this.serverConfig = this.updateSystem.GetVersionConfig();
        }
Ejemplo n.º 14
0
 public void LoadConfig()
 {
     try
     {
         string folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
         folder = folder + Path.DirectorySeparatorChar + "firebwall";
         if (!Directory.Exists(folder))
         {
             Directory.CreateDirectory(folder);
         }
         string file = folder + Path.DirectorySeparatorChar + "updating.cfg";
         if (File.Exists(file))
         {
             FileStream      stream     = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
             BinaryFormatter bFormatter = new BinaryFormatter();
             bFormatter.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple;
             bFormatter.Binder         = new VersionConfigToNamespaceAssemblyObjectBinder();
             Config = (UpdateConfig)bFormatter.Deserialize(stream);
             stream.Close();
         }
         else
         {
             Config = new UpdateConfig();
         }
     }
     catch
     {
         Config = new UpdateConfig();
     }
 }
Ejemplo n.º 15
0
        public UpdateFileToServer(UpdateConfig config, List <UploadFileInfo> files)
        {
            InitializeComponent();

            this.config    = config;
            this.filesList = files;

            this.updateSystem = ServiceManager.ServiceManagerInstance.GetRemotingService <IUpdateSystem>("updateSystem");
        }
Ejemplo n.º 16
0
 public void CreateReferenceWithProperties_Passing(string model, bool skipBeforeUpdate, bool skipUpdate, bool skipAfterUpdate)
 {
     UpdateConfig config = new UpdateConfig()
     {
         Model            = model,
         SkipBeforeUpdate = skipBeforeUpdate,
         SkipUpdate       = skipUpdate,
         SkipAfterUpdate  = skipAfterUpdate
     };
 }
Ejemplo n.º 17
0
 private void buttUpdateOptions_Click(object sender, EventArgs e)
 {
     if (updateConfig == null || updateConfig.IsDisposed)
     {
         updateConfig = new UpdateConfig();
         updateConfig.CurrentVersion   = CurrentVersion;
         updateConfig.DefaultUpdateURL = DefaultUpdateURL;
         updateConfig.Show();
     }
 }
Ejemplo n.º 18
0
    /// <summary>
    /// Checks if an update is available.
    /// </summary>
    /// <returns>Whether or not an update is available</returns>
    public async Task <bool> CheckForUpdatesAsync()
    {
        _updateConfig = await UpdateConfig.LoadFromWebAsync(_appInfo, _httpClient, _linkToConfig);

        if (_updateConfig != null && LatestVersion > _appInfo.Version)
        {
            _updateAvailable = true;
        }
        return(UpdateAvailable);
    }
Ejemplo n.º 19
0
        public void OnLoad()
        {
            UpdateConfig.LoadConfig();
            ListDirectory(treeView1, ConfigManager.TestSuiteFolder);

            comboBox4.DataSource   = ConfigManager.ListOfEnvironments;
            comboBox4.SelectedItem = ConfigManager.ListOfEnvironments[0];
            comboBox2.SelectedItem = "";
            comboBox2.SelectedItem = "CHROME";
            //UpdateConfig.SetEnivromnet(comboBox4.SelectedItem.ToString());
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 创建一个默认的配置文件
        /// </summary>
        /// <param name="configPath"></param>
        public static void CreatConfigFile(string configPath)
        {
            UpdateConfig defaultConfig = new UpdateConfig();
            var          sw            = File.CreateText(configPath);
            JsonWriter   jw            = new JsonWriter(sw)
            {
                PrettyPrint = true
            };

            JsonMapper.ToJson(defaultConfig, jw);
            sw.Close();
        }
Ejemplo n.º 21
0
        public ActionResult Connect(ConnectionString model)
        {
            ////ilk açılış cache'i tetikledik
            //CreateCache.Create();
            ////we are updating connection string on web.config
            var updatedResult = UpdateConfig.update(model.connectionString);

            CreateDB.create();
            CreateCache.Create();
            //return RedirectToAction("Product", "Index");
            return(RedirectToAction("List", "Home"));
        }
Ejemplo n.º 22
0
        public IEnumerator <ITask> UpdateConfigHandler(UpdateConfig update)
        {
            _bumperConfigState.BumperConfigList = update.Body;

            if (_bumperConfigState.BumperConfigList == null)
            {
                _bumperConfigState.BumperConfigList = new List <LegoNxtBumperConfig>();
            }

            update.ResponsePort.Post(DefaultUpdateResponseType.Instance);
            yield break;
        }
Ejemplo n.º 23
0
        private void btnSysUpdate_Click(object sender, EventArgs e)
        {
            UpdateConfig config = new UpdateConfig();
            List <AutoUpdate.Core.Data.FileInfo> fileList = new List <AutoUpdate.Core.Data.FileInfo>();
            List <UploadFileInfo> list = this.dgvUpdateFileInfo.DataSource as List <UploadFileInfo>;
            string versionStr          = this.txtVersion.Text.Trim();
            string desStr     = this.txtDes.Text.Trim();
            string folderPath = this.txtUpdateFilePath.Text.Trim();

            bool isForceUpdate = this.chkForceUpdate.Checked;
            bool isServerBak   = this.chkServerBak.Checked;
            bool isRollBack    = this.chkRollBack.Checked;

            if (list == null)
            {
                MessageBox.Show("更新文件获取失败,请重新确认!");
                return;
            }

            if (string.IsNullOrEmpty(versionStr))
            {
                MessageBox.Show("请输入系统更新版本编号!");
                return;
            }

            config.ConfigInfo = new ConfigInfo
            {
                ForceUpdate     = isForceUpdate,
                ServerBak       = isServerBak,
                RollBack        = isRollBack,
                CurrentVersion  = versionStr,
                PreviousVersion = (this.serverConfig.ConfigInfo == null || this.serverConfig.ConfigInfo.CurrentVersion == null) ? versionStr : this.serverConfig.ConfigInfo.CurrentVersion,
                Description     = desStr
            };

            foreach (var l in list)
            {
                fileList.Add(new AutoUpdate.Core.Data.FileInfo
                {
                    Name         = l.FileName,
                    FileSize     = l.FileSize,
                    RelativePath = l.RelativePath
                });
            }
            config.FileInfo = fileList;

            UpdateFileToServer ufs = new UpdateFileToServer(config, list);

            ufs.ShowDialog();
        }
Ejemplo n.º 24
0
        public virtual IEnumerator <ITask> UpdateConfigHandler(UpdateConfig update)
        {
            LogInfo("TrackRoamerBrickPowerService:UpdateConfigHandler()");

            if (update.Body.CommPort >= 0)
            {
                _state.PowerControllerConfig.CommPort = update.Body.CommPort;
                LogInfo("    SerialPort=" + _state.PowerControllerConfig.CommPort);
                _state.Connected = ReConnect();
            }

            update.ResponsePort.Post(DefaultUpdateResponseType.Instance);
            yield break;
        }
Ejemplo n.º 25
0
 private void ExecuteSuite()
 {
     try
     {
         UpdateConfig.LoadConfig();
         UpdateConfig.SetEnivromnet(_environment);
         SWATTestManager TestManager = new SWATTestManager();
         TestManager.TestCaseStatusChanged += OnTestCaseCompletion;
         TestManager.StartRun(_settings);
     }
     catch
     {
     }
 }
Ejemplo n.º 26
0
        public void CreateReferenceWithProperties_Failing(string model)
        {
            UpdateConfig config = null;

            Exception ex = Assert.Throws <ArgumentNullException>(() => config = new UpdateConfig()
            {
                Model            = model,
                SkipBeforeUpdate = false,
                SkipUpdate       = false,
                SkipAfterUpdate  = false
            });

            Assert.Null(config);
            Assert.Equal($"Value cannot be null. (Parameter '{UpdateResource.ExceptionEmptyModel}')", ex.Message);
        }
Ejemplo n.º 27
0
        public UpdateConfig GetVersionConfig()
        {
            try
            {
                UpdateConfig config = SerializeHelper.LoadXmlSerializeFile <UpdateConfig>(this.updateConfigPath);

                return(config);
            }
            catch (Exception ex)
            {
                AutoUpdate.Tools.Log.Log4NetHelper.ErrorLog("AutoUpdate.Core.Service.UpdateSystem.GetVersionConfig", ex);
            }

            return(null);
        }
Ejemplo n.º 28
0
        public DownloadUpdateFile()
        {
            InitializeComponent();

            this.updateSystem = ServiceManager.ServiceManagerInstance.GetRemotingService <IUpdateSystem>("updateSystem");
            this.serverConfig = this.updateSystem.GetVersionConfig();
            this.clientConfig = new ClientUpdateConfig();

            this.clientConfig.ClientUpdateInfo = new ClientUpdateInfo
            {
                PreviousVersion = this.clientConfig.ClientUpdateInfo == null ? this.serverConfig.ConfigInfo.CurrentVersion : this.clientConfig.ClientUpdateInfo.CurrentVersion,
                CurrentVersion  = this.serverConfig.ConfigInfo.CurrentVersion,
                UpdateDate      = DateTime.Now
            };
        }
Ejemplo n.º 29
0
        public static string BuildDeleteSql(IDictionary <string, string> cols, UpdateConfig config, string key, string preix)
        {
            var sql = new StringBuilder();

            sql.Append($"DELETE FROM {config.Table}{Where}");

            if (!string.IsNullOrEmpty(config.Filter))
            {
                sql.Append(config.Filter);
                return(sql.ToString());
            }

            sql.Append(string.Concat(key, Equlas, string.Concat(preix, cols[key])));
            return(sql.ToString());
        }
Ejemplo n.º 30
0
        public static string BuildUpdateSql(IDictionary <string, string> cols, UpdateConfig config, string key, string preix)
        {
            var sql = new StringBuilder();

            sql.AppendFormat(UpdateFormatter, config.Table);
            var cCount = cols.Count();

            for (var i = 0; i < cCount; i++)
            {
                var col = cols.ElementAt(i);
                if (col.Key.Equals(key, StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                if (col.Value.StartsWith(SqlKeyWorld.ParamStart))
                {
                    sql.Append($" `{col.Key}`{Equlas}{col.Value}");
                }
                else
                {
                    sql.Append($" `{col.Key}`{Equlas}{string.Concat(preix, col.Value)}");
                }

                if (i != cCount - 1)
                {
                    sql.Append(SqlKeyWorld.Split3);
                }
            }

            if (!string.IsNullOrEmpty(config.Filter))
            {
                sql.Append(string.Concat(Where, config.Filter));
                return(sql.ToString());
            }

            if (cols.ContainsKey(key))
            {
                sql.Append(string.Concat(Where, key, Equlas, SqlKeyWorld.ParamStart, cols[key]));
            }
            else
            {
                sql.Append(string.Concat(Where, key, Equlas, SqlKeyWorld.ParamStart, key));
            }

            return(sql.ToString());
        }
Ejemplo n.º 31
0
 public void LoadConfig()
 {
     try
     {
         string folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
         folder = folder + Path.DirectorySeparatorChar + "firebwall";
         if (!Directory.Exists(folder))
             Directory.CreateDirectory(folder);
         string file = folder + Path.DirectorySeparatorChar + "updating.cfg";
         if (File.Exists(file))
         {
             FileStream stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
             BinaryFormatter bFormatter = new BinaryFormatter();
             bFormatter.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple;
             bFormatter.Binder = new VersionConfigToNamespaceAssemblyObjectBinder();
             Config = (UpdateConfig)bFormatter.Deserialize(stream);
             stream.Close();
         }
         else
         {
             Config = new UpdateConfig();
         }
     }
     catch
     {
         Config = new UpdateConfig();
     }
 }
		public virtual IEnumerator<ITask> UpdateConfigHandler(UpdateConfig update)
		{
            LogInfo("TrackRoamerBrickPowerService:UpdateConfigHandler()");

			if (update.Body.CommPort >= 0)
			{
                _state.PowerControllerConfig.CommPort = update.Body.CommPort;
                LogInfo("    SerialPort=" + _state.PowerControllerConfig.CommPort);
				_state.Connected = ReConnect();
			}

			update.ResponsePort.Post(DefaultUpdateResponseType.Instance);
			yield break;
		}