public PluginProfileErrorCollection Delete(string name)
        {
            DeleteMashupNameToPlugin(name);
            _scriptStorage.DeleteMashup(name);
            var dto = new Mashup {
                Name = name
            };

            _bus.Send(dto.CreatePluginMashupMessage());
            _log.InfoFormat("Clean mashup commnad sent to TP (Mashup '{0}' for account '{1}')", dto.Name, _context.AccountName.Value);
            return(new PluginProfileErrorCollection());
        }
        public PluginProfileErrorCollection Add(Mashup dto, bool generateUniqueName)
        {
            if (generateUniqueName)
            {
                dto.Name = GetUniqueMashupName(dto.Name);
            }

            var errors = dto.ValidateAdd(ManagerProfile);

            if (errors.Any())
            {
                return(errors);
            }

            AddMashupNameToPlugin(dto.Name);
            _scriptStorage.SaveMashup(dto);
            _bus.Send(dto.CreatePluginMashupMessage());
            _log.InfoFormat("Add mashup command sent to TP (Mashup '{0}' for account '{1}')", dto.Name, _context.AccountName.Value);
            return(errors);
        }
Example #3
0
        public Mashup Load(string mashupFolderPath, string mashupName)
        {
            if (!Directory.Exists(mashupFolderPath))
            {
                return(null);
            }

            var configFiles  = Directory.GetFiles(mashupFolderPath, "*.cfg");
            var mashupConfig = new MashupConfig(configFiles.SelectMany(File.ReadAllLines));
            var files        = Directory.GetFiles(mashupFolderPath, "*", SearchOption.AllDirectories).Where(f => !configFiles.Contains(f));
            var mashupFiles  = files.Select(f => new MashupFile
            {
                FileName = f.GetRelativePathTo(mashupFolderPath),
                Content  = File.ReadAllText(f)
            }).ToList();

            var mashup = new Mashup(mashupFiles)
            {
                Name         = mashupName,
                Placeholders = String.Join(",", mashupConfig.Placeholders)
            };

            return(mashup);
        }
		public static PluginProfileErrorCollection Save(IMashupScriptStorage scriptStorage, Mashup mashup)
		{
			return ReifyError(() => scriptStorage.SaveMashup(mashup));
		}