public override void Reset()
        {
            base.Reset();

            DynamicTagGroups = new DataArray();
            Strings          = new Util.StringPool(true, CalculateStringPoolBaseAddress());
        }
예제 #2
0
 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);
 }
예제 #3
0
 /// <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>();
 }
예제 #4
0
파일: Data.cs 프로젝트: CodeAsm/open-sauce
		/// <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>();
		}
예제 #5
0
        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();
        }
예제 #7
0
        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();
        }
예제 #8
0
        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;
                }
            }
        }
예제 #9
0
		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;
			}
		}
예제 #10
0
        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);
            }
        }
예제 #11
0
		public override void Reset()
		{
			base.Reset();

			DynamicTagGroups = new DataArray();
			Strings = new Util.StringPool(true, CalculateStringPoolBaseAddress());
		}
예제 #12
0
		internal Compiler(Project.ProjectState state) : base(state.Engine)
		{
			OwnerState = state;

			DynamicTagGroups = new DataArray();
			Strings = new Util.StringPool(true, CalculateStringPoolBaseAddress());

			InitializeTypeIndicies();
		}
예제 #13
0
		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();
		}
예제 #14
0
		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);
		}