Ejemplo n.º 1
0
 public DataForgeEnumDefinition(DataForge documentRoot)
     : base(documentRoot)
 {
     this.NameOffset      = this._br.ReadUInt32();
     this.ValueCount      = this._br.ReadUInt16();
     this.FirstValueIndex = this._br.ReadUInt16();
 }
Ejemplo n.º 2
0
 public DataForgeDataMapping(DataForge documentRoot)
     : base(documentRoot)
 {
     this.StructCount = this._br.ReadUInt16();
     this.StructIndex = this._br.ReadUInt16();
     this.NameOffset  = documentRoot.StructDefinitionTable[this.StructIndex].NameOffset;
 }
 public DataForgePropertyDefinition(DataForge documentRoot)
     : base(documentRoot)
 {
     this.NameOffset     = this._br.ReadUInt32();
     this.StructIndex    = this._br.ReadUInt16();
     this.DataType       = (EDataType)this._br.ReadUInt16();
     this.ConversionType = (EConversionType)this._br.ReadUInt16();
     this.Padding        = this._br.ReadUInt16();
 }
Ejemplo n.º 4
0
 public DataForgeStructDefinition(DataForge documentRoot)
     : base(documentRoot)
 {
     this.NameOffset          = this._br.ReadUInt32();
     this.ParentTypeIndex     = this._br.ReadUInt32();
     this.AttributeCount      = this._br.ReadUInt16();
     this.FirstAttributeIndex = this._br.ReadUInt16();
     this.NodeType            = this._br.ReadUInt32();
 }
Ejemplo n.º 5
0
        public DataForgeRecord(DataForge documentRoot)
            : base(documentRoot)
        {
            this.NameOffset = this._br.ReadUInt32();

            if (!this.DocumentRoot.IsLegacy)
            {
                this.FileNameOffset = this._br.ReadUInt32();
            }

            this.StructIndex = this._br.ReadUInt32();
            this.Hash        = this._br.ReadGuid(false);

            this.VariantIndex = this._br.ReadUInt16();
            this.OtherIndex   = this._br.ReadUInt16();
        }
Ejemplo n.º 6
0
        public static void CheckScripts(Int64 build, String manifestFile)
        {
            var scripts = HoloXPLOR_App.Scripts;

            HoloXPLOR_App._scriptsPath = HostingEnvironment.MapPath(String.Format("~/App_Data/Scripts-{0}", build));

            if (!Directory.Exists(HoloXPLOR_App._scriptsPath))
            {
                Directory.CreateDirectory(HoloXPLOR_App._scriptsPath);
            }

            if (!File.Exists(Path.Combine(HoloXPLOR_App._scriptsPath, "game.xml")))
            {
                using (WebClient client = new WebClient())
                {
                    // client.DownloadFile(manifestFile, Path.Combine(scriptsPath, String.Format("{0}.json", build)));
                    var manifest = client.DownloadString(manifestFile).FromJSON <Manifest>();

                    #region Download DataXML.pak

                    using (Stream pakStream = client.OpenRead(String.Format("{0}/{1}/{2}", manifest.WebseedUrls[HoloXPLOR_App._random.Next(manifest.WebseedUrls.Length)], manifest.KeyPrefix, "Data/DataXML.pak")))
                    {
                        using (var zipStream = new ZipInputStream(pakStream))
                        {
                            ZipEntry zipEntry = zipStream.GetNextEntry();
                            while (zipEntry != null)
                            {
                                String entryFileName = zipEntry.Name;

                                if (entryFileName.StartsWith("Scripts"))
                                {
                                    String fullZipToPath = Path.Combine(HoloXPLOR_App._scriptsPath, entryFileName).Replace(@"\Scripts\", @"\");
                                    String directoryName = Path.GetDirectoryName(fullZipToPath);

                                    if (directoryName.Length > 0)
                                    {
                                        Directory.CreateDirectory(directoryName);
                                    }

                                    using (var ms = new MemoryStream())
                                    {
                                        zipStream.CopyTo(ms);

                                        ms.Seek(0, SeekOrigin.Begin);

                                        var xml = CryXmlSerializer.ReadStream(ms);
                                        xml.Save(fullZipToPath);
                                    }
                                }

                                zipEntry = zipStream.GetNextEntry();
                            }
                        }
                    }

                    #endregion

                    #region Download GameData.pak

                    using (Stream pakStream = client.OpenRead(String.Format("{0}/{1}/{2}", manifest.WebseedUrls[HoloXPLOR_App._random.Next(manifest.WebseedUrls.Length)], manifest.KeyPrefix, "Data/GameData.pak")))
                    {
                        using (var zipStream = new ZipInputStream(pakStream))
                        {
                            ZipEntry zipEntry = zipStream.GetNextEntry();
                            while (zipEntry != null)
                            {
                                String entryFileName = zipEntry.Name;

                                if (entryFileName.EndsWith(".dcb"))
                                {
                                    String fullZipToPath = Path.Combine(HoloXPLOR_App._scriptsPath, "game.xml");

                                    using (var ms = new MemoryStream())
                                    {
                                        zipStream.CopyTo(ms);
                                        ms.Seek(0, SeekOrigin.Begin);

                                        using (var br = new BinaryReader(ms))
                                        {
                                            var df = new DataForge.DataForge(br);
                                            // df.GenerateXML();
                                            df.Save(fullZipToPath);
                                        }
                                    }
                                }

                                zipEntry = zipStream.GetNextEntry();
                            }
                        }
                    }

                    #endregion
                }

                scripts = new Scripts(HoloXPLOR_App._scriptsPath);
            }

            scripts = scripts ?? new Scripts(HoloXPLOR_App._scriptsPath);

            if (scripts.Ammo.Count > 0 &
                scripts.Items.Count > 0 &&
                scripts.Loadout.Count > 0 &&
                scripts.Localization.Count > 0 &&
                scripts.Vehicles.Count > 0)
            {
                String latestBuildFile = HostingEnvironment.MapPath("~/App_Data/latestBuild.txt");
                File.WriteAllText(latestBuildFile, HoloXPLOR_App._scriptsPath);
                HoloXPLOR_App.Scripts = scripts;
            }
        }
Ejemplo n.º 7
0
 public DataForgePointer(DataForge documentRoot)
     : base(documentRoot)
 {
     this.StructType = this._br.ReadUInt32();
     this.Index      = this._br.ReadUInt32();
 }
Ejemplo n.º 8
0
        public static void Process(params String[] args)
        {
            if (args.Length < 1 || args.Length > 2)
            {
                Console.WriteLine("Usage: HoloXPLOR.DataForge.exe [infile]");
                Console.WriteLine();
                Console.WriteLine("Converts any Star Citizen binary file into an actual XML file.");
                Console.WriteLine("CryXml files (.xml) are saved as .raw in the original location.");
                Console.WriteLine("DataForge files (.dcb) are saved as .xml in the original location.");
                Console.WriteLine();
                Console.WriteLine("Can also convert all compatible files in a directory, and it's");
                Console.WriteLine("sub-directories. In that case, all CryXml files are saved in-place,");
                Console.WriteLine("and any DataForge files are saved to both .xml and extracted to");
                Console.WriteLine("the original component locations.");
                return;
            }

            try
            {
                if (File.Exists(args[0]))
                {
                    if (Path.GetExtension(args[0]) == ".dcb")
                    {
                        using (BinaryReader br = new BinaryReader(File.OpenRead(args[0])))
                        {
                            var legacy = new FileInfo(args[0]).Length < 0x0e2e00;

                            var df = new DataForge(br, legacy);

                            df.GenerateSerializationClasses();

                            df.Save(Path.ChangeExtension(args[0], "xml"));
                        }
                    }
                    else
                    {
                        var xml = CryXmlSerializer.ReadFile(args[0]);

                        if (xml != null)
                        {
                            if (_overwrite)
                            {
                                xml.Save(args[0]);
                            }
                            else
                            {
                                xml.Save(Path.ChangeExtension(args[0], "raw"));
                            }
                        }
                        else
                        {
                            Console.WriteLine("{0} already in XML format", args[0]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error converting {0}: {1}", args[0], ex.Message);
            }
        }
Ejemplo n.º 9
0
 public DataForgeUInt64(DataForge documentRoot)
     : base(documentRoot)
 {
     this.Value = this._br.ReadUInt64();
 }
Ejemplo n.º 10
0
 public DataForgeStringLookup(DataForge documentRoot)
     : base(documentRoot)
 {
     this._value = this._br.ReadUInt32();
 }
Ejemplo n.º 11
0
 public DataForgeLocale(DataForge documentRoot)
     : base(documentRoot)
 {
     this._value = this._br.ReadUInt32();
 }
Ejemplo n.º 12
0
 public DataForgeDouble(DataForge documentRoot)
     : base(documentRoot)
 {
     this.Value = this._br.ReadDouble();
 }
Ejemplo n.º 13
0
 public DataForgeString(DataForge documentRoot)
     : base(documentRoot)
 {
     this.Value = this._br.ReadCString();
 }
Ejemplo n.º 14
0
 public DataForgeReference(DataForge documentRoot)
     : base(documentRoot)
 {
     this.Item1 = this._br.ReadUInt32();
     this.Value = this._br.ReadGuid(false).Value;
 }
Ejemplo n.º 15
0
 public DataForgeGuid(DataForge documentRoot)
     : base(documentRoot)
 {
     this.Value = this._br.ReadGuid(false).Value;
 }
Ejemplo n.º 16
0
 public DataForgeBoolean(DataForge documentRoot)
     : base(documentRoot)
 {
     this.Value = this._br.ReadBoolean();
 }
Ejemplo n.º 17
0
 public DataForgeInt8(DataForge documentRoot)
     : base(documentRoot)
 {
     this.Value = this._br.ReadSByte();
 }
Ejemplo n.º 18
0
 public _DataForgeSerializable(DataForge documentRoot)
 {
     this.DocumentRoot = documentRoot;
     this._br          = documentRoot._br;
 }
Ejemplo n.º 19
0
 public DataForgeInt16(DataForge documentRoot)
     : base(documentRoot)
 {
     this.Value = this._br.ReadInt16();
 }