public override void Reset() { base.Reset(); DynamicTagGroups = new DataArray(); Strings = new Util.StringPool(true, CalculateStringPoolBaseAddress()); }
public void DumpGraph(System.IO.StreamWriter s, Util.StringPool strings) { s.WriteLine("{0}:{1}", this.GetType() == typeof(ScriptBlock) ? "Script" : "Global", Name); Root.DumpGraph(s, 1, strings); }
/// <summary> /// Initialize the execution state for the compiler using a blam-script definition /// </summary> /// <param name="definition"></param> internal Data(Scripting.XmlInterface definition) { this.definition = definition; Nodes = new List <ScriptNode>(this.definition.MaxNodes); StringData = new Util.StringPool(false); Scripts = new List <ScriptBlock>(); Globals = new List <GlobalsBlock>(); }
/// <summary> /// Initialize the execution state for the compiler using a blam-script definition /// </summary> /// <param name="definition"></param> internal Data(Scripting.XmlInterface definition) { this.definition = definition; Nodes = new List<ScriptNode>(this.definition.MaxNodes); StringData = new Util.StringPool(false); Scripts = new List<ScriptBlock>(); Globals = new List<GlobalsBlock>(); }
protected Compiler(BlamVersion engine) { Head = new CacheFileHeader(engine); MemoryStream = null; OwnerState = null; DebugStrings = new Util.StringPool(true); RamMemory = new BlamLib.IO.EndianWriter(new System.IO.MemoryStream(1024), this); }
internal Compiler(Project.ProjectState state) : base(state.Engine) { OwnerState = state; DynamicTagGroups = new DataArray(); Strings = new Util.StringPool(true, CalculateStringPoolBaseAddress()); InitializeTypeIndicies(); }
public virtual void Reset() { Dispose(); Head = new CacheFileHeader(Head); DebugStrings = new Util.StringPool(true); RamMemory = new BlamLib.IO.EndianWriter(new System.IO.MemoryStream(1024), this); Locations.Clear(); }
public static void InteropReadStringData(Blam.CacheFile cf, int cache_offset, out Util.StringPool strings_pool, byte k_pad_character) { strings_pool = new Util.StringPool(); cf.InputStream.Seek(cache_offset, System.IO.SeekOrigin.Begin); var hs_strings = new BlamLib.TagInterface.Data(); hs_strings.ReadHeader(cf); if (hs_strings.Size == 0) { return; } hs_strings.Read(cf); int offset = 0; byte btchar = 0; while (true) { var stringEntry = new System.Text.StringBuilder(); try { do { if (offset < hs_strings.Size) { btchar = hs_strings[offset]; if (btchar != 0) { stringEntry.Append((char)btchar); } } offset++; } while ((btchar != 0 && btchar != k_pad_character) && offset < hs_strings.Size); } catch (IndexOutOfRangeException ex) { throw new BlamLib.Debug.ExceptionLog("Offset was outside the bounds of the data array. {0}{1}", BlamLib.Program.NewLine, ex); } strings_pool.Add(stringEntry.ToString()); if (btchar == k_pad_character) { break; } } }
public static void InteropReadStringData(Blam.CacheFile cf, int cache_offset, out Util.StringPool strings_pool, byte k_pad_character) { strings_pool = new Util.StringPool(); cf.InputStream.Seek(cache_offset, System.IO.SeekOrigin.Begin); var hs_strings = new BlamLib.TagInterface.Data(); hs_strings.ReadHeader(cf); if (hs_strings.Size == 0) return; hs_strings.Read(cf); int offset = 0; byte btchar = 0; while (true) { var stringEntry = new System.Text.StringBuilder(); try { do { if (offset < hs_strings.Size) { btchar = hs_strings[offset]; if (btchar != 0) stringEntry.Append((char)btchar); } offset++; } while ((btchar != 0 && btchar != k_pad_character) && offset < hs_strings.Size); } catch (IndexOutOfRangeException ex) { throw new BlamLib.Debug.ExceptionLog("Offset was outside the bounds of the data array. {0}{1}", BlamLib.Program.NewLine, ex); } strings_pool.Add(stringEntry.ToString()); if (btchar == k_pad_character) break; } }
public void DumpGraph(System.IO.StreamWriter s, int indent, Util.StringPool strings) { string indent_string = string.Empty; if (indent != 0) { System.Text.StringBuilder pad = new System.Text.StringBuilder(indent); for (int x = 0; x < indent; x++) { pad.Append('\t'); } indent_string = pad.ToString(); } s.Write("{0}Node:{1:X8}", indent_string, this.nodeIndex); s.Write("\tNext Set:{0:X4}", NextSet != null ? NextSet.nodeIndex : (short)-1); s.Write("\tPrev:{0:X4}", Previous != null ? Previous.nodeIndex : (short)-1); s.Write("\tNext:{0:X4}", Next != null ? Next.nodeIndex : (short)-1); s.WriteLine(); s.Write("{0} {1}", indent_string, HexDump()); string string_data; if (Util.Flags.Test(pointerType, (short)1) && strings.TryAndGet((uint)pointer, out string_data)) { s.Write("\t{0}", string_data); } s.WriteLine(); if (Next != null) { Next.DumpGraph(s, indent + 1, strings); } if (NextSet != null) { NextSet.DumpGraph(s, indent, strings); } }