/// <summary> /// copy records to variable /// </summary> /// <param name="name">name of variable</param> public void CopyRecords(string name) { try { var data = RecordQueries.GetNewInstanceOfRecords().Select(item => new { Name = item.Key, Value = item.Value }); VariablesStorageQueries.AddNewVariable(name, data); } catch (Exception e) { CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER); } }
/// <summary> /// copy all headers of request in variables list /// </summary> /// <param name="variableName">The name of the variable that holds the config</param> /// <param name="targets">defined header</param> /// <param name="key">request key</param> protected void CopyRequestConfig(string variableName, string targets = null, string key = null) { try { var request = ProgramStorageQueries.GetCurrentRequest(); if (targets == null) { var properties = CopyConfig(request); VariablesStorageQueries.AddNewVariable(variableName, properties); } else { var properties = CopyConfig(request, targets); VariablesStorageQueries.AddNewVariable(variableName, properties); } } catch (Exception e) { CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER); } }
//additional command : //public void PluseMultiVariables(string command) //{ // VariableAnalysis.ExecuteVariableCommand(command: command); //} //protected void CutVariableAndSave(string name, string newName, string startStr, string endStr, string startNum, string endNum) //{ // VariableStorageQueries.AddNewVariable(newName, Utilities.GetSubstring(VariableStorageQueries.GetVariableValue(name), startStr, endStr, startNum, endNum)); //} //protected void ReplaceDataInVariable(string newValue, string oldValue, string name) //{ // var variable = variablestoragequeries.getvariable(name); // var value = variable.value.replace(oldvalue, variableanalysis.executevariablecommand(newvalue) ?? newvalue); // variablestoragequeries.updatevariable(name, value); //} /// <summary> /// Adds new varible in variables list /// </summary> /// <param name="name">Name of variable</param> /// <param name="value">Value of variable</param> public void AddNewVariable(string name, string value) { VariablesStorageQueries.AddNewVariable(name, value); }