public void SaveMashup(MashupDto mashup) { _log.Info(string.Format("Saving mashup with name '{0}'", mashup.Name)); var mashupFolderPath = GetMashupFolderPath(mashup.Name); ClearOrCreateFolder(mashupFolderPath); var scriptPath = Path.Combine(mashupFolderPath, mashup.Name + ".js"); File.WriteAllText(scriptPath, mashup.Script); WritePlaceholdersFile(mashup, mashupFolderPath); WriteAccountsFile(mashup, mashupFolderPath); _log.Info(string.Format("Mashup with name '{0}' saved", mashup.Name)); }
private void WriteAccountsFile(MashupDto mashup, string mashupFolderPath) { if (_accountName.Value != AccountName.Empty) { _log.Info(string.Format("Add account config to mashup with name '{0}'", mashup.Name)); var cfgPath = Path.Combine(mashupFolderPath, MashupDto.AccountCfgFileName); File.WriteAllText(cfgPath, string.Format("{0}{1}", MashupConfig.AccountsConfigPrefix, _accountName.Value)); } }
private void WritePlaceholdersFile(MashupDto mashup, string mashupFolderPath) { if (!string.IsNullOrEmpty(mashup.Placeholders)) { _log.Info(string.Format("Add placeholder config to mashup with name '{0}'", mashup.Name)); var cfgPath = Path.Combine(mashupFolderPath, MashupDto.PlaceholdersCfgFileName); File.WriteAllText(cfgPath, string.Format("{0}{1}", MashupConfig.PlaceholderConfigPrefix, mashup.Placeholders)); } }