private static void AddTransactionNames(IVuGenScript script, string usrFileName = null) { try { if (script == null) { return; } List <IExtraFileScriptItem> extraFiles = script.GetExtraFiles(); IExtraFileScriptItem dynamicTransacrions = null; foreach (IExtraFileScriptItem extraFile in extraFiles) { if (extraFile.FileName == "dynamic_transactions.txt") //This is not configurable. This is the file name! { dynamicTransacrions = extraFile; break; } } if (dynamicTransacrions == null) { return; } string fileContent = File.ReadAllText(dynamicTransacrions.FullFileName); string[] transactionNames = fileContent.Split(new String[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); IScriptDataObject scriptData = script.GenerateDataObject() as IScriptDataObject; if (scriptData == null) { return; } List <String> transactionsList = scriptData.SpecialSteps.Transactions; transactionsList.AddRange(transactionNames); IniUsrFile usr; if (usrFileName != null) { usr = new IniUsrFile(usrFileName); } else { usr = new IniUsrFile(script.FileName); } usr.WriteTransactions(transactionsList); usr.Save(); } catch { //Don't want to have adverse influence on the regular usage of VuGen. If this fails it does so silently. } }
private static void AddTransactionNames(IVuGenScript script, string usrFileName=null) { try { if (script == null) return; List<IExtraFileScriptItem> extraFiles = script.GetExtraFiles(); IExtraFileScriptItem dynamicTransacrions = null; foreach (IExtraFileScriptItem extraFile in extraFiles) { if (extraFile.FileName == "dynamic_transactions.txt") //This is not configurable. This is the file name! { dynamicTransacrions = extraFile; break; } } if (dynamicTransacrions == null) return; string fileContent = File.ReadAllText(dynamicTransacrions.FullFileName); string[] transactionNames = fileContent.Split(new String[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); IScriptDataObject scriptData = script.GenerateDataObject() as IScriptDataObject; if (scriptData == null) return; List<String> transactionsList = scriptData.SpecialSteps.Transactions; transactionsList.AddRange(transactionNames); IniUsrFile usr; if (usrFileName != null) { usr = new IniUsrFile(usrFileName); } else { usr = new IniUsrFile(script.FileName); } usr.WriteTransactions(transactionsList); usr.Save(); } catch { //Don't want to have adverse influence on the regular usage of VuGen. If this fails it does so silently. } }