Exemplo n.º 1
0
 public StringId(string name, EngineManager.HaloEngine engine)
     : base(name, FieldSize, FieldType.StringId, engine)
 {
     // Set fields to default values.
     this.handle    = Blam.Objects.DataTypes.string_id._string_id_empty;
     stringConstant = "";
 }
Exemplo n.º 2
0
        public override void Write(EndianWriter bw, int magic)
        {
            // Add the string to the string_id_globals table.
            this.handle = Blam.TagFiles.TagGroups._CreateStringId(this.stringConstant);

            // Write the string handle to the steam.
            bw.Write((uint)this.handle);
        }
Exemplo n.º 3
0
        public override void Read(EndianReader br, int Magic)
        {
            // Read the 32bit string_id value from the stream.
            this.handle = br.ReadUInt32();

            // Check if the string_id is not invalid.
            if (this.handle != Blam.Objects.DataTypes.string_id._string_id_invalid)
            {
                // Resolve the string constant.
                this.stringConstant = Blam.TagFiles.TagGroups.string_id_get_string_const(this.handle);
            }
        }
Exemplo n.º 4
0
        void consoleWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            // Get the background worker that owns this thread
            BackgroundWorker worker = (BackgroundWorker)sender;

            // Wait until the console worker has canceled the opperation
            while (worker.IsBusy)
            {
                System.Windows.Forms.Application.DoEvents();
            }

            // Split the command so we can parse the info from it
            string[] cmd = Global.Events.Debugging.SplitCommandLine((string)e.UserState);

            // Pull out the console command structure
            Global.Events.ConsoleCommand command = Global.Events.Debugging.GetCommandEntry(cmd[0]);

            // Check if it has a default event handler
            if (command.HasDefaultHandler)
            {
                // Call the default event handler
                command.OnExecute(cmd);
            }
            else
            {
                // Handle the command manually
                switch (cmd[0])
                {
                    #region open_project

                case "get_str_const":
                {
                    Blam.Objects.DataTypes.string_id handle = Blam.Objects.DataTypes.string_id._string_id_empty;
                    Blam.Engine.Engine.g_string_id_globals.ContainsValue(cmd[1], ref handle);

                    if (handle == Blam.Objects.DataTypes.string_id._string_id_empty)
                    {
                        Console.WriteLine("not found");
                    }
                    else
                    {
                        Console.WriteLine("0x{0} {1}", handle.Handle.ToString("x"), cmd[1]);
                    }
                    break;
                }

                case "open_project":
                {
                    // Check for Open Project
                    if (Global.Application.Instance.IsProjectOpen)
                    {
                        // Report error
                        Console.WriteLine("error only one project may be open at a time!");
                        break;
                    }

                    // Check to make sure the file exists
                    if (!File.Exists(cmd[1]))
                    {
                        // Report error
                        Console.WriteLine("error file \'{0}\' does not exist!", cmd[1]);
                        break;
                    }

                    // Init Project
                    Global.Application.Instance.OpenProject(cmd[1], true);

                    // Output
                    MessagesWriteLine(cmd[1] + " opened");
                    this.dckProjectExplorer.Text = "Project Explorer - " + Global.Application.Instance.Project.Name;
                    break;
                }

                    #endregion
                }
            }

            // Resume the console worker thread
            worker.RunWorkerAsync();
        }