コード例 #1
0
        private void LoadTemplates()
        {
            IEnumerable <CasparServerCommands.TlsCommand.TemplatePath> Paths;

            if (PluginInterfaces.PublicProviders.CasparServer.IsConnected)
            {
                Paths = CasparServerCommands.TlsCommand.ParseResponse(PluginInterfaces.PublicProviders.CasparServer.ExecuteCommand(new CasparServerCommands.TlsCommand()));
            }
            else
            {
                Paths = new List <CasparServerCommands.TlsCommand.TemplatePath>()
                {
                    new CasparServerCommands.TlsCommand.TemplatePath("1/1.1/1.1.1/FILE_1.1.1", 1, "20141234"),
                    new CasparServerCommands.TlsCommand.TemplatePath("1/1.1/1.1.2/FILE_1.1.2", 2, "20141234"),
                    new CasparServerCommands.TlsCommand.TemplatePath("1/1.2/1.2.1/FILE_1.2.1", 3, "20141234"),
                    new CasparServerCommands.TlsCommand.TemplatePath("1/1.2/1.2.2/FILE_1.2.2", 4, "20141234"),
                    new CasparServerCommands.TlsCommand.TemplatePath("2/2.1/2.1.1/FILE_2.1.1", 5, "20141234"),
                    new CasparServerCommands.TlsCommand.TemplatePath("2/2.1/2.1.2/FILE_2.1.2", 6, "20141234"),
                    new CasparServerCommands.TlsCommand.TemplatePath("2/2.2/2.2.1/FILE_2.2.1", 7, "20141234"),
                    new CasparServerCommands.TlsCommand.TemplatePath("2/2.2/2.2.2/FILE_2.2.2", 8, "20141234")
                };
                //return;
            }
            var InvisibleRootDirectory = TemplateDirectory.RootDirectory;

            foreach (var i in Paths)
            {
                if (!String.IsNullOrEmpty(i.Directory))
                {
                    var PathParts = i.Directory.Split('/');

                    var CurrentParentDirectory = InvisibleRootDirectory;
                    TemplateDirectory CurrentDirectory;

                    foreach (var PathPart in PathParts)
                    {
                        CurrentDirectory = CurrentParentDirectory.Children.SingleOrDefault(j => j.Name == PathPart);
                        if (CurrentDirectory == null)
                        {
                            CurrentDirectory = new TemplateDirectory(PathPart);
                            CurrentParentDirectory.Add(CurrentDirectory);
                        }
                        CurrentParentDirectory = CurrentDirectory;
                    }
                }
            }
            ViewModel.TemplateDirectories = InvisibleRootDirectory.Children;
        }
コード例 #2
0
 public void Add(TemplateDirectory Child)
 {
     _Children.Add(Child);
     Child.Parent = this;
 }