Example #1
0
        /// <summary>
        /// return parent obj or null if no parent
        /// </summary>
        public BtrfsNfo GetParent(string uuid)
        {
            BtrfsNfo res = null;

            var nfo = btrfsNfoDict[uuid];

            if (!UUIDIsNull(nfo.ParentUUID))
            {
                btrfsNfoDict.TryGetValue(nfo.ParentUUID, out res);
            }

            return(res);
        }
Example #2
0
        public void Add(string basePath, string relPath, string uuid, string parentUUID, long generation, long genAtCreation)
        {
            // System.Console.WriteLine($"fullpath:[{fullpath}] uuid:[{uuid}] parentUUID:[{parentUUID}]"); // TODO: logger
            var nfo = new BtrfsNfo(this, basePath, relPath, uuid, parentUUID, generation, genAtCreation);

            btrfsNfoDict.Add(uuid, nfo);

            // add this obj as child of parent uuid string
            if (!UUIDIsNull(parentUUID))
            {
                List <BtrfsNfo> children = null;
                if (!btrfsNfoChildrenDict.TryGetValue(parentUUID, out children))
                {
                    children = new List <BtrfsNfo>();
                    btrfsNfoChildrenDict.Add(parentUUID, children);
                }
                children.Add(nfo);
            }
            entries.Add(nfo);
        }