/// <summary>
        /// Virtual call
        /// </summary>
        /// <param name="content"></param>
        public NdfEditorMainViewModel(byte[] content)
        {
            OwnerFile = null;
            EdataFileViewModel = null;

            var ndfbinReader = new NdfbinReader();
            NdfBinary = ndfbinReader.Read(content);

            InitializeNdfEditor();

            SaveNdfbinCommand = new ActionCommand(SaveNdfbinExecute, () => false);
        }
        public NdfEditorMainViewModel(EdataContentFile contentFile, EdataFileViewModel ownerVm)
        {
            OwnerFile = contentFile;
            EdataFileViewModel = ownerVm;

            var ndfbinReader = new NdfbinReader();
            NdfBinary = ndfbinReader.Read(ownerVm.EdataManager.GetRawData(contentFile));

            //var ndfbinManager = new NdfbinManager(ownerVm.EdataManager.GetRawData(contentFile));
            //NdfbinManager = ndfbinManager;

            //ndfbinManager.Initialize();

            InitializeNdfEditor();
        }
Exemplo n.º 3
0
        public ScenarioFile Read(Stream s)
        {
            var f = new ScenarioFile();

            var buffer = new byte[10];
            s.Read(buffer, 0, buffer.Length);

            if (!Utils.ByteArrayCompare(Encoding.ASCII.GetBytes("SCENARIO\r\n"), buffer))
                throw new InvalidDataException("Wrong scenario header magic!");

            buffer = new byte[16];
            s.Read(buffer, 0, buffer.Length);
            f.Checksum = buffer;

            s.Seek(2, SeekOrigin.Current);

            buffer = new byte[4];
            s.Read(buffer, 0, buffer.Length);
            f.Version = BitConverter.ToInt32(buffer, 0);

            s.Read(buffer, 0, buffer.Length);
            int subFilesCount = BitConverter.ToInt32(buffer, 0);

            for (int i = 0; i < subFilesCount; i++)
            {
                s.Read(buffer, 0, buffer.Length);
                var contentFileBuffer = new byte[BitConverter.ToUInt32(buffer, 0)];
                s.Read(contentFileBuffer, 0, contentFileBuffer.Length);
                f.ContentFiles.Add(contentFileBuffer);
            }

            var reader = new NdfbinReader();
            f.NdfBinary = reader.Read(f.ContentFiles[1]);

            f.ZoneData = ReadZoneData(f.ContentFiles[0]);

            return f;
        }
Exemplo n.º 4
0
        private Model.Ndfbin.NdfBinary ReadTextureBindings(Stream s, MeshFile file)
        {
            var buffer = new byte[file.SubHeader.MeshMaterial.Size];

            s.Seek(file.SubHeader.MeshMaterial.Offset, SeekOrigin.Begin);
            s.Read(buffer, 0, buffer.Length);

            var ndfReader = new NdfbinReader();

            return ndfReader.Read(buffer);
        }