Esempio n. 1
0
        private int CreateParentDirectoryRecursive(ref PathParser parser, ref SaveEntryKey key)
        {
            int prevIndex = 0;

            while (!parser.IsFinished())
            {
                int index = DirectoryTable.GetIndexFromKey(ref key).Index;

                if (index < 0)
                {
                    var newEntry = new TableEntry <SaveFindPosition>();
                    index = DirectoryTable.Add(ref key, ref newEntry);

                    if (prevIndex > 0)
                    {
                        LinkDirectoryToParent(prevIndex, index);
                    }
                }

                prevIndex  = index;
                key.Parent = index;
                parser.TryGetNext(out key.Name);
            }

            return(prevIndex);
        }
Esempio n. 2
0
        private void FindPathRecursive(ReadOnlySpan <byte> path, out SaveEntryKey key)
        {
            var parser = new PathParser(path);

            key = new SaveEntryKey(parser.GetCurrent(), 0);

            while (!parser.IsFinished())
            {
                key.Parent = DirectoryTable.GetOffsetFromKey(ref key);
                parser.TryGetNext(out key.Name);
            }
        }
Esempio n. 3
0
        private bool FindPathRecursive(ReadOnlySpan <byte> path, out SaveEntryKey key)
        {
            var parser = new PathParser(path);

            key = new SaveEntryKey(parser.GetCurrent(), 0);

            while (!parser.IsFinished())
            {
                key.Parent = DirectoryTable.GetIndexFromKey(ref key).Index;

                if (key.Parent < 0)
                {
                    return(false);
                }

                parser.TryGetNext(out key.Name);
            }

            return(true);
        }