Example #1
0
        private void PlayBriefing(int n)
        {
            if (baseHog == null)
            {
                MessageBox.Show(null, "Select a valid base HOG first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string briefing          = null;
            string newLoadedBriefing = briefingNameTextBox.Text;

            if (newLoadedBriefing != loadedBriefing)
            {
                byte[] txb = FindFile(newLoadedBriefing);
                if (txb == null)
                {
                    MessageBox.Show(null, newLoadedBriefing + " not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                briefing = TXBConverter.DecodeTXB(txb);
                bl.Load(briefing);
                bh.Load(briefing);
                loadedBriefing = newLoadedBriefing;
            }
            PlayBriefing(briefing, n, false);
        }
Example #2
0
        private void SaveBriefing(string filename, string contents)
        {
            string text = contents.Replace("\r", "");

            if (Properties.Settings.Default.addEndSection)
            {
                string append = "";
                if (!text.Contains("$S999"))
                {
                    append = "$S999\n";
                    if (!text.EndsWith("\n"))
                    {
                        append = "\n" + text;
                    }
                }
                text += append;
            }
            editor.ModifyText(text.Replace("\n", "\r\n"));
            byte[] txb = TXBConverter.EncodeTXB(text);
            workingHog.ReplaceLump(new HOGLump(filename, txb));
            workingHog.Write(workingHogFile);
        }