示例#1
0
        public Locator(int structureType, StructureDescriptor descriptor, params string[] path)
        {
            StructureType   = structureType;
            this.descriptor = descriptor;
            Path            = path;

            PersistKey = SentinelPersistKey.Instance;
        }
示例#2
0
        private static ILocator Create(int structType, KeyDescriptor keyDescriptor, RecordDescriptor recordDescriptor, params string[] path)
        {
            if (!STSdb4.Database.StructureType.IsValid(structType))
            {
                throw new ArgumentException("Invalid structType");
            }

            StructureDescriptor descriptor = new StructureDescriptor(keyDescriptor, recordDescriptor);

            descriptor.Encode();

            return(new Locator(structType, descriptor, path));
        }
示例#3
0
        public static Locator Deserialize(BinaryReader reader)
        {
            //StructureType
            int structureType = reader.ReadByte();

            if (structureType == Locator.MIN.StructureType)
            {
                return(Locator.MIN);
            }

            //descriptor
            var descriptor = StructureDescriptor.Deserialize(reader);

            //Items
            string[] items = new string[CountCompression.Deserialize(reader)];
            for (int i = 0; i < items.Length; i++)
            {
                items[i] = reader.ReadString();
            }

            return(new Locator(structureType, descriptor, items));
        }