Beispiel #1
0
        public void ApplyTo(IReadonlyAlephSettings settings, HierarchicalWrapper_Folder dst)
        {
            if (!dst.GetInternalPath().Equals(Path))
            {
                LoggerSingleton.Inst.Warn("HierarchyConfigCache", $"Path mismatch in ApplyTo: '{Path}' <> '{dst.GetInternalPath()}'");
                return;
            }

            if (settings.RememberHierarchyExpandedState)
            {
                dst.IsExpanded = Expanded;
            }
            else
            {
                dst.IsExpanded = true;
            }

            var counter = 1;

            foreach (var subthis in Children)
            {
                var subdst = dst.SubFolder.FirstOrDefault(p => p.Header == subthis.Name);
                if (subdst == null)
                {
                    continue;
                }

                if (!settings.SortHierarchyFoldersByName)
                {
                    subdst.CustomOrder = counter * 100;
                }
                subthis.ApplyTo(settings, subdst);

                counter++;
            }

            // (new) folders not in hierarchy cache
            foreach (var subdst in dst.SubFolder.Where(subdst => !Children.Any(subthis => subdst.Header == subthis.Name)).OrderBy(p => p.Header))
            {
                if (!settings.SortHierarchyFoldersByName)
                {
                    subdst.CustomOrder = counter * 100;
                }
                subdst.IsExpanded = true;
                counter++;
            }
        }
Beispiel #2
0
 public void ApplyTo(IReadonlyAlephSettings settings, HierarchicalWrapper_Folder dst)
 {
     Entry?.ApplyTo(settings, dst);
 }