Пример #1
0
        internal void SaveBinding(TaskBinding binding)
        {
            var parser = new FileIniDataParser(Parser);
            var data   = parser.ReadFile(FilePath);

            data.UpdateBindings(binding);
            parser.WriteFile(FilePath, data);
        }
Пример #2
0
        internal static TaskBinding FromXml(string bindingsXml)
        {
            var binding = new TaskBinding();
            var xml     = XDocument.Parse(bindingsXml, LoadOptions.None);

            binding.BeforeBuild = xml.Root.GetTasksForTarget(BindingTargets.BeforeBuild);
            binding.AfterBuild  = xml.Root.GetTasksForTarget(BindingTargets.AfterBuild);
            binding.Clean       = xml.Root.GetTasksForTarget(BindingTargets.Clean);
            binding.Open        = xml.Root.GetTasksForTarget(BindingTargets.Open);
            return(binding);
        }
Пример #3
0
 internal static void UpdateBindings(this IniData data, TaskBinding binding, string sectionName = "TaskRunnerBindings")
 {
     if (data.Sections.ContainsSection(sectionName))
     {
         data.Sections.RemoveSection(sectionName);
     }
     data.Sections.AddSection(sectionName);
     data[sectionName].AddIfAny(BindingTargets.BeforeBuild, binding.BeforeBuild);
     data[sectionName].AddIfAny(BindingTargets.AfterBuild, binding.AfterBuild);
     data[sectionName].AddIfAny(BindingTargets.Clean, binding.Clean);
     data[sectionName].AddIfAny(BindingTargets.Open, binding.Open);
 }