/// <summary> /// Saves the contents in the file with the given <paramref name="fileName"/>. /// </summary> /// <param name="fileName">The name of the file to save the contents into.</param> public void Save(string fileName) { using (BfshaFileSaver saver = new BfshaFileSaver(this, fileName)) { saver.Execute(); } }
void IResData.Save(BfshaFileSaver saver) { // Update the Patricia trie values in the nodes. UpdateNodes(); // Write header. // saver.WriteSignature("_DIC"); saver.Write(0); saver.Write(Count); // Write nodes. int index = -1; // Start at -1 due to root node. int curNode = 0; foreach (Node node in _nodes) { saver.Write(node.Reference); saver.Write(node.IdxLeft); saver.Write(node.IdxRight); if (curNode == 0) { saver.SaveRelocateEntryToSection(saver.Position, 1, (uint)_nodes.Count, 1, BfshaFileSaver.Section1, ""); // <------------ Entry Set saver.SaveString(""); } else { saver.SaveString(node.Key); } curNode++; } }
void IResData.Save(BfshaFileSaver saver) { saver.WriteSignature(_signature); saver.Write(position); saver.Write(5); saver.Write(0); }
void IResData.Save(BfshaFileSaver saver) { saver.SaveCustom(Frames, () => { switch (FrameType) { case AnimCurveFrameType.Single: saver.Write(Frames); break; case AnimCurveFrameType.Decimal10x5: foreach (float frame in Frames) { saver.Write((Decimal10x5)frame); } break; case AnimCurveFrameType.Byte: foreach (float frame in Frames) { saver.Write((byte)frame); } break; } }); saver.SaveCustom(Keys, () => { switch (KeyType) { case AnimCurveKeyType.Single: foreach (float key in Keys) { saver.Write(key); } break; case AnimCurveKeyType.Int16: foreach (float key in Keys) { saver.Write((short)key); } break; case AnimCurveKeyType.SByte: foreach (float key in Keys) { saver.Write((sbyte)key); } break; } }); saver.Write(_flags); saver.Write((ushort)Frames.Length); saver.Write(AnimDataOffset); saver.Write(StartFrame); saver.Write(EndFrame); saver.Write(Scale); saver.Write(Offset); saver.Write(Delta); }
void IResData.Save(BfshaFileSaver saver) { saver.Write(Property); saver.Write(0); saver.Write(0); saver.Write(Reserved); }
void IResData.Save(BfshaFileSaver saver) { // PreSave(); Version = SaveVersion(); saver.WriteSignature(_signature); saver.Write(0x20202020); saver.Write(Version); saver.Write(ByteOrder, true); saver.Write((byte)Alignment); saver.Write((byte)TargetAddressSize); saver.SaveFileNameString(Name); saver.Write((ushort)Flag); saver.SaveHeaderBlock(true); saver.SaveRelocationTablePointerPointer(); saver.SaveFieldFileSize(); saver.Write(new byte[64]); //GRSC saver.WriteSignature(_grscSignature); saver.SaveHeaderBlock(); saver.Write(Unknown); saver.Write(Unknown2); saver.Write(Unknown3); saver.Write(Unknown4); saver.Write(ShaderVariations.Count); shaderVariationArrayOffset = saver.SaveOffset(); saver.Write(0L); saver.Write(Unknown5); saver.Write(new byte[40]); //reserved }
// ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- /// <summary> /// Saves the contents in the given <paramref name="stream"/> and optionally leaves it open /// </summary> /// <param name="stream">The <see cref="Stream"/> to save the contents into.</param> /// <param name="leaveOpen"><c>true</c> to leave the stream open after writing, otherwise <c>false</c>.</param> public void Save(Stream stream, bool leaveOpen = false) { using (BfshaFileSaver saver = new BfshaFileSaver(this, stream, leaveOpen)) { saver.Execute(); } }
void IResData.Save(BfshaFileSaver saver) { saver.SaveString(Name); saver.Write(Index); saver.Write((ushort)Offset); saver.Write((byte)BlockIndex); saver.Seek(1); }
void IResData.Save(BfshaFileSaver saver) { saver.Write((ushort)SourceData.Count); saver.Write(new byte[6]); //reserved PtrCodeSizesPos = saver.SaveOffset(); PtrCodeOffsetsPos = saver.SaveOffset(); saver.Write(new byte[8]); //reserved }
void IResData.Save(BfshaFileSaver saver) { PtrVertexShaderCodePos = saver.SaveOffset(); PtrTess0ShaderCodePos = saver.SaveOffset(); PtrTess1ShaderCodePos = saver.SaveOffset(); PtrGeometryShaderCodePos = saver.SaveOffset(); PtrPixelShaderCodePos = saver.SaveOffset(); PtrComputeShaderCodePos = saver.SaveOffset(); }
void IResData.Save(BfshaFileSaver saver) { saver.Write(new byte[8]); //padding PtrCodeOffset1Pos = saver.SaveOffset(); PtrCodeOffset2Pos = saver.SaveOffset(); saver.Write(BinaryData[1].Length); saver.Write(BinaryData[0].Length); saver.Write(new byte[32]); //padding }
void IResData.Save(BfshaFileSaver saver) { _position = saver.Position; saver.Write(0L); //source pointer saver.Write(0L); saver.Write(0L); //binary pointer saver.Write(saver.BnshFile.SizeOfGRSC); saver.Write(new byte[32]); //reserved }
void IResData.Save(BfshaFileSaver saver) { saver.WriteSection(ShaderInfoData); saver.Write(MemoryData.Length); saver.Write(0); //padding PtrMemPos = saver.SaveOffset(); saver.Write(ParentShaderVariation._position); PtrRefelctionPos = saver.SaveOffset(); saver.Write(new byte[32]); //padding }
void IResData.Save(BfshaFileSaver saver) { saver.Write(Type); saver.Write(Format, false); saver.Write(new byte[2]); //padding saver.Write(CompressionType); PtrVertexShaderCodePos = saver.SaveOffset(); PtrTessellatioControlShaderCodePos = saver.SaveOffset(); PtrTessellationEvaluationShaderCodePos = saver.SaveOffset(); PtrGeometryShaderCodePos = saver.SaveOffset(); PtrPixelShaderCodePos = saver.SaveOffset(); PtrComputeShaderCodePos = saver.SaveOffset(); saver.Write(new byte[40]); //padding }
void IResData.Save(BfshaFileSaver saver) { saver.Write(0); // DataPointer saver.Write(Data[0].Length); // Size saver.Write(0); // Handle saver.Write(Stride); saver.Write((ushort)Data.Length); // NumBuffering saver.Write(0); // ContextPointer saver.SaveBlock(Data, BfshaFileSaver.AlignmentSmall, () => { for (int i = 0; i < Data.Length; i++) { saver.Write(Data[i]); } }); }
void IResData.Save(BfshaFileSaver saver) { // PreSave(); saver.WriteSignature(_signature); saver.Write(0x20202020); saver.Write(VersionMajor); saver.Write(VersionMinor); saver.Write(VersionMicro); saver.Write(ByteOrder, true); saver.Write((byte)Alignment); saver.Write((byte)TargetAddressSize); saver.Write(0); saver.Write((ushort)Flag); saver.Write((ushort)BlockOffset); // saver.Save(RelocationTable, true); saver.SaveFieldFileSize(); saver.SaveString(Name); }
void IResData.Save(BfshaFileSaver saver) { saver.SaveString(Name); saver.SaveDict(ChoiceDict); }
void IResData.Save(BfshaFileSaver saver) { saver.SaveString(Name); }
void IResData.Save(BfshaFileSaver saver) { saver.SaveList(Uniforms); saver.SaveDict(UniformDict); }
void IResData.Save(BfshaFileSaver saver) { }
void IResData.Save(BfshaFileSaver saver) { saver.Write((byte)Index); saver.Write((byte)Location); }
void IResData.Save(BfshaFileSaver saver) { saver.Write(CompressedData.Length); saver.Write(DecompressedSize); PtrCodeOffsetsPos = saver.SaveOffset(); }
void IResData.Save(BfshaFileSaver saver) { saver.SaveString(String, Encoding); }
void IResData.Save(BfshaFileSaver saver) { saver.SaveString(Extra); saver.Write((byte)Index); saver.Seek(7); }
void IResData.Save(BfshaFileSaver saver) { saver.SaveString(Name); saver.Write((ushort)((Array)_value).Length); // Unsafe cast, but _value should always be Array. saver.Write(Type, true); }