Esempio n. 1
0
        public ArkTribe(string fileName, ArkNameCache arkNameCache = null, ArkNameTree exclusivePropertyNameTree = null) : this()
        {
            _fileName = fileName;

            if (arkNameCache != null)
            {
                _arkNameCache = arkNameCache;
            }
            _exclusivePropertyNameTree = exclusivePropertyNameTree;
            var fi = new FileInfo(fileName);

            SaveTime = fi.LastWriteTimeUtc;
            var size = fi.Length;

            if (size == 0)
            {
                return;
            }
            using (MemoryMappedFile mmf = MemoryMappedFile.CreateFromFile(fileName, FileMode.Open, null, 0L, MemoryMappedFileAccess.Read))
            {
                using (MemoryMappedViewAccessor va = mmf.CreateViewAccessor(0L, 0L, MemoryMappedFileAccess.Read))
                {
                    ArkArchive archive = new ArkArchive(va, size, _arkNameCache, exclusivePropertyNameTree: _exclusivePropertyNameTree);
                    readBinary(archive);
                }
            }
        }
Esempio n. 2
0
        public ArkCloudInventoryDinoData(float version, ArkArrayByte dinoData, ArkNameCache arkNameCache = null, ArkNameTree exclusivePropertyNameTree = null) : this()
        {
            //if (version != 3.0) throw new NotSupportedException("Unknown Cloud Inventory Dino Data Version " + version);
            DinoDataVersion = version;

            if (dinoData == null || dinoData.Any(x => !x.HasValue))
            {
                throw new NotSupportedException("DinoData was null or contained null-values.");
            }

            if (arkNameCache != null)
            {
                _arkNameCache = arkNameCache;
            }
            _exclusivePropertyNameTree = exclusivePropertyNameTree;


            //since the ArkArchive implementation we have takes a MemoryMappedViewAccessor for reading operations lets do the lazy thing and write this managed byte[] data to a new memory mapped file
            using (MemoryMappedFile mmf = MemoryMappedFile.CreateNew("ArkCloudInventoryDinoData", dinoData.Count, MemoryMappedFileAccess.ReadWrite))
            {
                using (MemoryMappedViewAccessor va = mmf.CreateViewAccessor(0L, 0L, MemoryMappedFileAccess.ReadWrite))
                {
                    va.WriteArray(0, dinoData.Select(x => x.Value).ToArray(), 0, dinoData.Count);
                    ArkArchive archive = new ArkArchive(va, dinoData.Count, _arkNameCache, exclusivePropertyNameTree: _exclusivePropertyNameTree);
                    readBinary(archive);
                }
            }
        }
Esempio n. 3
0
 private bool _isInstanceInTable;    // true only for hibernation object archives
 // private bool _isSlice;              // true if this a subarchive
 public ArkArchive(MemoryMappedViewAccessor va, long size, ArkNameCache arkNameCache = null, ArkStringCache arkStringCache = null, ArkNameTree exclusivePropertyNameTree = null)
 {
     _va                        = va;
     _size                      = size;
     _arkNameCache              = arkNameCache ?? new ArkNameCache();
     _arkStringCache            = arkStringCache ?? new ArkStringCache();
     _exclusivePropertyNameTree = exclusivePropertyNameTree;
 }
Esempio n. 4
0
 public ArkSavegame(int?savegameMaxDegreeOfParallelism = null, ArkNameTree exclusivePropertyNameTree = null)
 {
     Objects         = new List <GameObject>();
     _arkNameCache   = new ArkNameCache();
     _arkStringCache = new ArkStringCache();
     _savegameMaxDegreeOfParallelism = savegameMaxDegreeOfParallelism;
     _exclusivePropertyNameTree      = exclusivePropertyNameTree;
 }
Esempio n. 5
0
 public ArkArchive(ArkArchive toClone, MemoryMappedViewAccessor va)
 {
     _va                        = va;
     _size                      = toClone._size;
     _nameTable                 = toClone._nameTable;
     _arkNameCache              = toClone._arkNameCache;
     _arkStringCache            = toClone._arkStringCache;
     _exclusivePropertyNameTree = toClone._exclusivePropertyNameTree;
 }
        public ArkSavegame(string fileName, ArkNameCache arkNameCache = null, int?savegameMaxDegreeOfParallelism = null, ArkNameTree exclusivePropertyNameTree = null)
        {
            _fileName       = fileName;
            _arkNameCache   = arkNameCache ?? new ArkNameCache();
            _arkStringCache = new ArkStringCache();
            _savegameMaxDegreeOfParallelism = savegameMaxDegreeOfParallelism;
            _exclusivePropertyNameTree      = exclusivePropertyNameTree;

            var fi   = new FileInfo(_fileName);
            var size = fi.Length;

            SaveTime = fi.LastWriteTimeUtc;
            //if (size == 0) return false;

            _mmf     = MemoryMappedFile.CreateFromFile(_fileName, FileMode.Open, null, 0L, MemoryMappedFileAccess.Read);
            _va      = _mmf.CreateViewAccessor(0L, 0L, MemoryMappedFileAccess.Read);
            _archive = new ArkArchive(_va, size, _arkNameCache, _arkStringCache, _exclusivePropertyNameTree);
        }