//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 { } }
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); }
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); } } }
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)); }
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(); }
private static void TryUpdateConfig(Settings settings, IPersistence persistence, ConnectionManager connectionManager) { var updateConfig = new UpdateConfig(settings, persistence, connectionManager); updateConfig.CheckConfigVersionUpdate(); }
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()); }
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); }
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>(); } }
public AutoUpdateServiceManager() { InitializeComponent(); this.updateSystem = ServiceManager.ServiceManagerInstance.GetRemotingService <IUpdateSystem>("updateSystem"); this.serverConfig = this.updateSystem.GetVersionConfig(); }
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 UpdateFileToServer(UpdateConfig config, List <UploadFileInfo> files) { InitializeComponent(); this.config = config; this.filesList = files; this.updateSystem = ServiceManager.ServiceManagerInstance.GetRemotingService <IUpdateSystem>("updateSystem"); }
public void CreateReferenceWithProperties_Passing(string model, bool skipBeforeUpdate, bool skipUpdate, bool skipAfterUpdate) { UpdateConfig config = new UpdateConfig() { Model = model, SkipBeforeUpdate = skipBeforeUpdate, SkipUpdate = skipUpdate, SkipAfterUpdate = skipAfterUpdate }; }
private void buttUpdateOptions_Click(object sender, EventArgs e) { if (updateConfig == null || updateConfig.IsDisposed) { updateConfig = new UpdateConfig(); updateConfig.CurrentVersion = CurrentVersion; updateConfig.DefaultUpdateURL = DefaultUpdateURL; updateConfig.Show(); } }
/// <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); }
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()); }
/// <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(); }
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")); }
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; }
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(); }
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; }
private void ExecuteSuite() { try { UpdateConfig.LoadConfig(); UpdateConfig.SetEnivromnet(_environment); SWATTestManager TestManager = new SWATTestManager(); TestManager.TestCaseStatusChanged += OnTestCaseCompletion; TestManager.StartRun(_settings); } catch { } }
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); }
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); }
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 }; }
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()); }
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()); }
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; }