private void WriteAccountsFile(Mashup 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, Mashup.AccountCfgFileName); File.WriteAllText(cfgPath, string.Format("{0}{1}", MashupConfig.AccountsConfigPrefix, _accountName.Value)); } }
private void WritePlaceholdersFile(Mashup 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, "placeholders.cfg"); File.WriteAllText(cfgPath, string.Format("{0}{1}", MashupConfig.PlaceholderConfigPrefix, mashup.Placeholders)); } }
public void SaveMashup(Mashup mashup) { _log.Info(string.Format("Saving mashup with name '{0}'", mashup.Name)); var mashupFolderPath = GetMashupFolderPath(mashup.Name); EnsureMashupFolderExistsAndEmpty(mashupFolderPath); foreach (var file in mashup.Files) { EnsureMashupFileSubFolderExists(mashupFolderPath, file.FileName); File.WriteAllText(Path.Combine(mashupFolderPath, file.FileName), file.Content); } WritePlaceholdersFile(mashup, mashupFolderPath); WriteAccountsFile(mashup, mashupFolderPath); _log.Info(string.Format("Mashup with name '{0}' saved", mashup.Name)); }
public void SaveMashup(Mashup mashup) { _log.Info(string.Format("Saving mashup with name '{0}'", mashup.Name)); var mashupFolderPath = GetMashupFolderPath(mashup.Name); EnsureMashupFolderExistsAndEmpty(mashupFolderPath); foreach (var file in mashup.Files) { var mashupFileFullPath = Path.Combine(mashupFolderPath, file.FileName); if (!new DirectoryInfo(mashupFolderPath).HasParentChildRelation(new FileInfo(mashupFileFullPath).Directory)) { throw new BadMashupFileNameException("Bad mashup file name {0}".Fmt(file.FileName)); } EnsureMashupFileSubFolderExists(mashupFolderPath, file.FileName); File.WriteAllText(mashupFileFullPath, file.Content); } WritePlaceholdersFile(mashup.Name, mashup.Placeholders, mashupFolderPath); WriteAccountsFile(mashup.Name, mashupFolderPath); _log.Info(string.Format("Mashup with name '{0}' saved", mashup.Name)); }