Exemplo n.º 1
0
            public MapData(Settings.Platform platform)
            {
                Craft = 0;
                IFF   = 0;
                Name  = "";
                WPs   = null;
                switch (platform)
                {
                case Settings.Platform.TIE:
                    WPs = new Platform.Tie.FlightGroup.Waypoint[1][];
                    //WPs[0] = new Platform.Tie.FlightGroup.Waypoint[15];
                    //for(int i = 0; i < WPs[0].Length; i++) WPs[0][i] = new Platform.Tie.FlightGroup.Waypoint();
                    break;

                case Settings.Platform.XvT:
                    WPs = new Platform.Xvt.FlightGroup.Waypoint[1][];
                    //WPs[0] = new Platform.Xvt.FlightGroup.Waypoint[22];
                    //for (int i = 0; i < WPs[0].Length; i++) WPs[0][i] = new Platform.Xvt.FlightGroup.Waypoint();
                    break;

                case Settings.Platform.XWA:
                    WPs = new Platform.Xwa.FlightGroup.Waypoint[17][];
                    //for (int i = 0; i < x; i++) WPs[i] = new Platform.Xwa.FlightGroup.Waypoint();
                    break;
                }
            }
Exemplo n.º 2
0
 /// <param name="fg">WFlights array</param>
 public MapForm(Settings settings, Platform.Xwa.FlightGroupCollection fg)
 {
     _platform = Settings.Platform.XWA;
     Import(fg);
     InitializeComponent();
     try { imgCraft.Images.AddStrip(Image.FromFile(Application.StartupPath + "\\images\\craft_XWA.bmp")); }
     catch (Exception x)
     {
         MessageBox.Show(x.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Close();
     }
     startup(settings);
 }
Exemplo n.º 3
0
 /// <param name="fg">XFlights array</param>
 public MapForm(Settings settings, Platform.Xvt.FlightGroupCollection fg)
 {
     _platform = Settings.Platform.XvT;
     Import(fg);
     InitializeComponent();
     try { imgCraft.Images.AddStrip(Image.FromFile(Application.StartupPath + "\\images\\craft_XvT.bmp")); }
     catch (Exception x)
     {
         MessageBox.Show(x.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Close();
     }
     startup(settings);
 }
Exemplo n.º 4
0
        Settings.Platform _platform; // 1=XvT, 2=BoP, 3=XWA

        #endregion Fields

        #region Constructors

        /// <summary>Initialize the form, gather file listings from all categories</summary>
        /// <param name="plat">Platform identifier</param>
        public LstForm(Settings.Platform platform)
        {
            InitializeComponent();
            this.Height = 413;
            _platform = platform;
            Settings config = new Settings();
            if (platform==Settings.Platform.XvT) _installPath = config.XvtPath;
            else if (platform==Settings.Platform.BoP) _installPath = config.BopPath;
            else if (platform==Settings.Platform.XWA) _installPath = config.XwaPath;
            if (!Directory.Exists(_installPath))
            {
                MessageBox.Show("Error reading install path for platform, LST editor unavailable", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return;
            }
            if (platform==Settings.Platform.XWA)
            {
                this.Width += 190;
                lblEx.Left += 75;
                txtLST.Width += 75;
                lblEx.Width += 115;
                lblEx.Text="Example:\r\n\r\n//\r\n!BATTLE_0_HEADER![Section Title]\r\n//\r\n0\r\n* 1B0M1ex.tie\r\n!MISSION_0_DESC!Mission description\r\n1\r\n* 1B0M2ex.tie\r\n"+
                    "!MISSION_1_DESC!Keep to 1 line\r\n//\r\n!BATTLE_!_HEADER![Next Section]\r\n//\r\n2\r\n* 1B1M1ex.tie\r\n!MISSION_2_DESC!\"1B#M#*.tie\" req'd\r\n3\r\n"+
                    "* 1B1M2ex.tie\r\n!MISSION_3_DESC!etc";
                cboFile.Items.Add("MELEE\\MISSION.LST");
                cboFile.Items.Add("MISSIONS\\MISSION.LST");
                cboFile.SelectedIndex = 1;
            }
            if (platform==Settings.Platform.XvT || platform==Settings.Platform.BoP)
            {
                string[] str1 = Directory.GetFiles(_installPath+"\\Battle", "*.LST");
                string[] str6 = null;
                if (platform==Settings.Platform.BoP) str6 = Directory.GetFiles(_installPath+"\\Campaign", "*.LST");
                string[] str2 = Directory.GetFiles(_installPath+"\\Combat", "*.LST");
                string[] str3 = Directory.GetFiles(_installPath+"\\Melee", "*.LST");
                string[] str4 = Directory.GetFiles(_installPath+"\\Tourn", "*.LST");
                string[] str5 = Directory.GetFiles(_installPath+"\\Train", "*.LST");
                string[] strFiles = new string[str1.Length + (str6 != null ? str6.Length : 0) + str2.Length + str3.Length + str4.Length + str5.Length];
                int j=0, start;
                for (int i=0;i<str1.Length;i++, j++) strFiles[j] = str1[i].Substring(_installPath.Length+1);
                if (platform==Settings.Platform.BoP) for (int i=0;i<str6.Length;i++, j++) strFiles[j] = str6[i].Substring(_installPath.Length+1);
                for (int i=0;i<str2.Length;i++, j++) strFiles[j] = str2[i].Substring(_installPath.Length+1);
                for (int i=0;i<str3.Length;i++, j++) strFiles[j] = str3[i].Substring(_installPath.Length+1);
                for (int i=0;i<str4.Length;i++, j++) strFiles[j] = str4[i].Substring(_installPath.Length+1);
                start=j;
                for (int i=0;i<str5.Length;i++, j++) strFiles[j] = str5[i].Substring(_installPath.Length+1);
                cboFile.Items.AddRange(strFiles);
                cboFile.SelectedIndex = start;
            }
        }
Exemplo n.º 5
0
        /// <summary>Activates a platform and loads its corresponding library data.</summary>
        private void loadLibrary(Settings.Platform platform)
        {
            // Downgrade BoP so it can share the same library.
            if (platform == Settings.Platform.BoP)
            {
                platform = Settings.Platform.XvT;
            }

            _platform = platform;

            string label = "Tm - GG  - waves x craft (GU)";               // XvT, XWA

            if (_platform == Settings.Platform.XWING)
            {
                label = "IFF - waves x craft";
            }
            else if (_platform == Settings.Platform.TIE)
            {
                label = "IFF - GG - waves x craft";
            }
            lblMissionCraft.Text = label;
            lblLibraryCraft.Text = label;

            string filename = getLibraryFileName();

            if (filename == "")
            {
                return;
            }

            string path = getFullPath(filename);

            if (File.Exists(path))
            {
                try
                {
                    using (FileStream fs = new FileStream(path, FileMode.Open))
                    {
                        using (BinaryReader br = new BinaryReader(fs))
                        {
                            loadLibraryFromStream(fs, br);
                        }
                    }
                }
                catch (Exception x)
                {
                    MessageBox.Show("Error loading FG library!" + Environment.NewLine + x.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>Initializes and prepares the FG Library for the specified platform.</summary>
        /// <remarks>The library is saved automatically when the form is closed.</remarks>
        /// <param name="platform">The platform determines which library to load, and how to access its data.</param>
        /// <param name="flightGroupCollection">The collection of craft currently in the mission. Must be a valid FlightGroupCollection object.</param>
        /// <param name="onAddCallback">Event to call when the user requests to add FlightGroups into the mission.</param>
        /// <exception cref="ArgumentNullException">The FlightGroupCollection or callback event is null.</exception>
        /// <exception cref="ArgumentException">The supplied FlightGroupCollection does not match expected type for the platform.</exception>
        public FlightGroupLibraryForm(Settings.Platform platform, object flightGroupCollection, EventHandler onAddEvent)
        {
            InitializeComponent();

            if (flightGroupCollection == null || onAddEvent == null)
            {
                throw new ArgumentNullException("Invalid arguments to FG Library");
            }

            string collectionType = flightGroupCollection.GetType().ToString();
            string requiredType   = "";

            switch (platform)
            {
            case Settings.Platform.XWING: requiredType = typeof(Platform.Xwing.FlightGroupCollection).ToString(); break;

            case Settings.Platform.TIE: requiredType = typeof(Platform.Tie.FlightGroupCollection).ToString(); break;

            case Settings.Platform.XvT:
            case Settings.Platform.BoP: requiredType = typeof(Platform.Xvt.FlightGroupCollection).ToString(); break;

            case Settings.Platform.XWA: requiredType = typeof(Platform.Xwa.FlightGroupCollection).ToString(); break;
            }
            if (collectionType != requiredType)
            {
                throw new ArgumentException("Invalid collection passed to FG Library");
            }

            _flightGroupCollection = flightGroupCollection;
            _onAddEvent            = onAddEvent;
            resetDefaultLibrary();
            loadLibrary(platform);
            refreshGroupList();
            refreshMissionCraft();
            refreshLibraryCraft();
            Show();
        }
Exemplo n.º 7
0
        public BriefingForm(Platform.Xwa.BriefingCollection briefing)
        {
            _loading = true;
            _platform = Settings.Platform.XWA;
            _titleColor = Color.FromArgb(0x63, 0x82, 0xFF);
            _normalColor = Color.FromArgb(0xFF, 0xFF, 0xFF);
            _highlightColor = _titleColor;
            _zoomX = 32;
            _zoomY = _zoomX;
            _xwaBriefingCollection = briefing; //[JB] Added
            _currentCollectionIndex = 0;
            _xwaBriefing = briefing[0];
            _maxEvents = Platform.Xwa.Briefing.EventQuantityLimit;
            _events = new short[_maxEvents, 6];
            InitializeComponent();
            this.Text = "YOGEME Briefing Editor - XWA";
            #region XWA layout change
            label7.Text = "Icon:";
            Height = 480;
            Width = 756;
            tabBrief.Width = 752;
            Point loc = new Point(608, 246);
            pnlShipTag.Location = loc;
            pnlTextTag.Location = loc;
            pnlShipInfo.Location = loc;
            pnlRotate.Location = loc;
            pnlMove.Location = loc;
            pnlNew.Location = loc;
            pnlRegion.Location = loc;
            cmdNewShip.Visible = true;
            cmdMoveShip.Visible = true;
            cmdRotate.Visible = true;
            cmdShipInfo.Visible = true;
            cmdRegion.Visible = true;
            pctBrief.Size = new Size(510, 294);
            pctBrief.Left += 36;
            w = pctBrief.Width;
            h = pctBrief.Height;
            lblTitle.BackColor = Color.FromArgb(0x18, 0x18, 0x18);
            lblTitle.Size = new Size(510, 28);
            lblTitle.Left += 36;
            lblTitle.Top -= 4;
            lblTitle.TextAlign = ContentAlignment.TopCenter;
            lblTitle.ForeColor = _titleColor;
            lblTitle.Text = "*Defined in .LST file*";
            lblTitle.Font = new Font("Arial", 10F, FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            cmdTitle.Enabled = false;
            lblCaption.BackColor = Color.FromArgb(0x20, 0x30, 0x88);
            lblCaption.Font = new Font("Arial", 8F, FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            lblCaption.Size = new Size(510, 40);
            lblCaption.Top += 68;
            lblCaption.Left += 36;
            vsbBRF.Left -= 38;
            vsbBRF.Height = 294;
            tabBrief.Height += 58;
            hsbBRF.Top += 70;
            hsbBRF.Width = 510;
            hsbBRF.Left += 36;
            lblInstruction.Top += 58;
            pnlBottomRight.Top += 58;
            pnlBottomLeft.Top += 58;
            dataT.Height += 58;
            dataS.Height += 58;
            lstEvents.Height += 58;
            cboColorTag.Items.Clear();
            cboColorTag.Items.Add("Green");
            cboColorTag.Items.Add("Red");
            cboColorTag.Items.Add("Yellow");
            cboColorTag.Items.Add("Purple");
            cboColorTag.Items.Add("Pink");
            cboColorTag.Items.Add("Blue");
            cboColor.Items.Clear();
            cboColor.Items.Add("Green");
            cboColor.Items.Add("Red");
            cboColor.Items.Add("Yellow");
            cboColor.Items.Add("Purple");
            cboColor.Items.Add("Pink");
            cboColor.Items.Add("Blue");
            cboEvent.Items.Add("New Icon");
            cboEvent.Items.Add("Show Ship Data");
            cboEvent.Items.Add("Move Icon");
            cboEvent.Items.Add("Rotate Icon");
            cboEvent.Items.Add("Switch to Region");
            cboCraft.Items.AddRange(Platform.Xwa.Strings.CraftType);
            cboNCraft.Items.AddRange(Platform.Xwa.Strings.CraftType);
            #endregion
            importDat(Application.StartupPath + "\\images\\XWA_BRF.dat", 56);
            _tags = _xwaBriefing.BriefingTag;
            _strings = _xwaBriefing.BriefingString;
            importStrings();
            _timerInterval = Platform.Xwa.Briefing.TicksPerSecond;
            txtLength.Text = Convert.ToString(Math.Round(((decimal)_xwaBriefing.Length / _timerInterval), 2));
            hsbTimer.Maximum = _xwaBriefing.Length + 11;
            w = pctBrief.Width;
            h = pctBrief.Height;
            _mapX = 0;
            _mapY = 0;
            lstEvents.Items.Clear();
            _briefData = new BriefData[100];	// this way I don't have to deal with expanding the array
            string[] names = new string[100];
            for (int i=0;i<_briefData.Length;i++) names[i] = "Icon #" + i;
            cboFG.Items.AddRange(names);
            cboFGTag.Items.AddRange(names);
            cboInfoCraft.Items.AddRange(names);
            cboRCraft.Items.AddRange(names);
            cboMoveIcon.Items.AddRange(names);
            cboNewIcon.Items.AddRange(names);
            importEvents(_xwaBriefing.Events);
            hsbTimer.Value = 0;
            numUnk1.Value = _xwaBriefing.Unknown1;
            numUnk3.Enabled = false;
            txtNotes.Enabled = true;
            txtNotes.Text = _xwaBriefing.BriefingStringsNotes[0];
            cboText.SelectedIndex = 0;
            cboFGTag.SelectedIndex = 0;
            cboTextTag.SelectedIndex = 0;
            cboColorTag.SelectedIndex = 0;
            cboInfoCraft.SelectedIndex = 0;
            cboRCraft.SelectedIndex = 0;
            cboRotateAmount.SelectedIndex = 0;
            cboMoveIcon.SelectedIndex = 0;
            cboNewIcon.SelectedIndex = 0;
            cboNCraft.SelectedIndex = 0;
            cboIconIff.SelectedIndex = 0;

            //[JB] Set values for team selection dropdown
            for (int i = 0; i < _xwaBriefingCollection.Count; i++)  //XvT has 8 briefings
            {
                string s = "Briefing " + (i + 1);
                cboBriefIndex1.Items.Add(s);
                cboBriefIndex2.Items.Add(s);
            }
            for(int i = 0; i < 10; i++)  //XWA has 10 teams
                lstTeams.Items.Add((i + 1) + ": " + sharedTeamNames[i]);
            cboBriefIndex1.SelectedIndex = 0;
            cboBriefIndex2.SelectedIndex = 0;
            RefreshTeamList();
            UpdateTitle();

            _loading = false;
            PostLoadInit();
        }
Exemplo n.º 8
0
        public BriefingForm(Platform.Xvt.FlightGroupCollection fg, Platform.Xvt.BriefingCollection briefing)
        {
            _loading = true;
            _platform = Settings.Platform.XvT;
            _titleColor = Color.FromArgb(0xFC, 0xFC, 0x00);
            _normalColor = Color.FromArgb(0xF8, 0xFC, 0xF8);
            _highlightColor = Color.FromArgb(0x40, 0xC4, 0x40);
            _zoomY = _zoomX;
            _xvtBriefingCollection = briefing; //[JB] Added
            _currentCollectionIndex = 0;
            _xvtBriefing = briefing[0];
            _maxEvents = Platform.Xvt.Briefing.EventQuantityLimit;
            _events = new short[_maxEvents, 6];
            InitializeComponent();
            this.Text = "YOGEME Briefing Editor - XvT/BoP";
            Import(fg);
            #region XvT layout change
            Height = 422;
            Width = 756;
            tabBrief.Width = 752;
            Point loc = new Point(608, 188);
            pnlShipTag.Location = loc;
            pnlTextTag.Location = loc;
            pctBrief.Size = new Size(360, 214);
            pctBrief.Left = 150;
            lblCaption.BackColor = Color.FromArgb(0, 0, 0x78);
            lblCaption.Font = new Font("Times New Roman", 8F, FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            lblCaption.Size = new Size(360, 28);
            lblCaption.Location = new Point(150, 254);
            lblTitle.BackColor = Color.FromArgb(0x10, 0x10, 0x20);
            lblTitle.Font = new Font("Times New Roman", 8F, FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            lblTitle.Size = new Size(360, 16);
            lblTitle.TextAlign = ContentAlignment.TopCenter;
            lblTitle.ForeColor = _titleColor;
            lblTitle.Text = "*Defined in .LST file*";
            lblTitle.Location = new Point(150, 24);
            cmdTitle.Enabled = false;
            cboColorTag.Items.Clear();
            cboColorTag.Items.Add("Green");
            cboColorTag.Items.Add("Red");
            cboColorTag.Items.Add("Yellow");
            cboColorTag.Items.Add("Blue");
            cboColorTag.Items.Add("Purple");
            cboColorTag.Items.Add("Black");
            cboColor.Items.Clear();
            cboColor.Items.Add("Green");
            cboColor.Items.Add("Red");
            cboColor.Items.Add("Yellow");
            cboColor.Items.Add("Blue");
            cboColor.Items.Add("Purple");
            cboColor.Items.Add("Black");
            #endregion
            importDat(Application.StartupPath + "\\images\\XvT_BRF.dat", 22);
            _tags = _xvtBriefing.BriefingTag;
            _strings = _xvtBriefing.BriefingString;
            importStrings();
            _timerInterval = Platform.Xvt.Briefing.TicksPerSecond;
            txtLength.Text = Convert.ToString(Math.Round(((decimal)_xvtBriefing.Length / _timerInterval), 2));
            hsbTimer.Maximum = _xvtBriefing.Length + 11;
            w = pctBrief.Width;
            h = pctBrief.Height;
            _mapX = 0;
            _mapY = 0;
            lstEvents.Items.Clear();
            importEvents(_xvtBriefing.Events);
            hsbTimer.Value = 0;
            numUnk1.Value = _xvtBriefing.Unknown1;
            numUnk3.Value = _xvtBriefing.Unknown3;
            cboText.SelectedIndex = 0;
            cboFGTag.SelectedIndex = 0;
            cboTextTag.SelectedIndex = 0;
            cboColorTag.SelectedIndex = 0;

            //[JB] Set values for team selection dropdown
            for (int i = 0; i < _xvtBriefingCollection.Count; i++)  //XvT has 8 briefings
            {
                string s = "Briefing " + (i + 1);
                cboBriefIndex1.Items.Add(s);
                cboBriefIndex2.Items.Add(s);
            }
            for(int i = 0; i < 10; i++)  //XvT has 10 teams
                lstTeams.Items.Add((i + 1) + ": " + sharedTeamNames[i]);
            cboBriefIndex1.SelectedIndex = 0;
            cboBriefIndex2.SelectedIndex = 0;
            RefreshTeamList();
            UpdateTitle();

            _loading = false;
            PostLoadInit();
        }
Exemplo n.º 9
0
        public BriefingForm(Platform.Tie.FlightGroupCollection fg, Platform.Tie.Briefing briefing)
        {
            _loading = true;
            _platform = Settings.Platform.TIE;
            _titleColor = Color.FromArgb(0xFC, 0xFC, 0x54);
            _normalColor = Color.FromArgb(0xFC, 0xFC, 0xFC);
            _highlightColor = Color.FromArgb(0x00, 0xA8, 0x00);
            _zoomY = _zoomX;			// in most cases, these will remain the same
            _tieBriefing = briefing;
            _maxEvents = Platform.Tie.Briefing.EventQuantityLimit;
            _events = new short[_maxEvents,6];
            InitializeComponent();
            this.Text = "YOGEME Briefing Editor - TIE";
            #region layout edit
            // final layout update, as in VS it's spread out
            Height = 422;
            Width = 756;
            tabBrief.Width = 752;
            Point loc = new Point(608, 188);
            pnlShipTag.Location = loc;
            pnlTextTag.Location = loc;
            #endregion
            Import(fg);	// FGs are separate so they can be updated without running the BRF as well
            importDat(Application.StartupPath + "\\images\\TIE_BRF.dat", 34);
            _tags = _tieBriefing.BriefingTag;
            _strings = _tieBriefing.BriefingString;
            importStrings();
            _timerInterval = Platform.Tie.Briefing.TicksPerSecond;
            txtLength.Text = Convert.ToString(Math.Round(((decimal)_tieBriefing.Length / _timerInterval), 2));
            hsbTimer.Maximum = _tieBriefing.Length + 11;
            w = pctBrief.Width;
            h = pctBrief.Height;
            _mapX = 0;
            _mapY = 0;
            lstEvents.Items.Clear();
            importEvents(_tieBriefing.Events);
            hsbTimer.Value = 0;
            numUnk1.Value = _tieBriefing.Unknown1;
            numUnk3.Enabled = false;
            cboText.SelectedIndex = 0;
            cboFGTag.SelectedIndex = 0;
            cboTextTag.SelectedIndex = 0;
            cboColorTag.SelectedIndex = 0;

            labBriefIndex2.Visible = false;
            cboBriefIndex2.Visible = false;
            tabTeams.Enabled = false;

            _loading = false;
            PostLoadInit();
        }
Exemplo n.º 10
0
        /// <summary>Loads a platform, manages craft name strings, performs loading and merging of craft data, and path detection.</summary>
        public void LoadPlatform(Settings.Platform platform, Settings config, string[] defaultLongNames, string[] defaultShortNames, string missionPath)
        {
            // These vars will be assigned from the user's config settings.
            _currentInstallPath = "";
            bool detectMission     = false;
            bool overrideExternal  = false;
            bool overrideScan      = false;
            bool flagRemappedCraft = false;

            switch (platform)
            {
            case Settings.Platform.XWING:
                _currentInstallPath = config.XwingPath;
                detectMission       = config.XwingDetectMission;
                overrideExternal    = config.XwingOverrideExternal;
                break;

            case Settings.Platform.TIE:
                _currentInstallPath = config.TiePath;
                detectMission       = config.TieDetectMission;
                overrideExternal    = config.TieOverrideExternal;
                break;

            case Settings.Platform.XvT:
                _currentInstallPath = config.XvtPath;
                detectMission       = config.XvtDetectMission;
                overrideExternal    = config.XvtOverrideExternal;
                break;

            case Settings.Platform.BoP:
                _currentInstallPath = config.BopPath;
                detectMission       = config.XvtDetectMission;
                overrideExternal    = config.XvtOverrideExternal;
                break;

            case Settings.Platform.XWA:
                _currentInstallPath = config.XwaPath;
                detectMission       = config.XwaDetectMission;
                overrideExternal    = config.XwaOverrideExternal;
                overrideScan        = config.XwaOverrideScan;
                flagRemappedCraft   = config.XwaFlagRemappedCraft;
                break;
            }
            if (!detectMission)
            {
                missionPath = "";
            }
            _currentMissionPath = missionPath;

            bool configChanged = (_previousOverrideExternal != overrideExternal || _previousOverrideScan != overrideScan || _previousFlagRemappedCraft != flagRemappedCraft);

            if (_currentPlatform != platform || configChanged)
            {
                _currentPlatform = platform;
                setDefaultStrings(defaultLongNames, defaultShortNames);
                loadPlatformExternalCraftData();
                if (_currentPlatform == Settings.Platform.XWING)
                {
                    // If we don't want to override, or it failed to load, use the default string list.
                    if (!overrideExternal || _editorCraftData == null || _editorCraftData.Count == 0)
                    {
                        _editorCraftData = _defaultCraftData;
                    }

                    // If we did load the list, and the user modified it, then it's possible the count is incorrect.
                    // It's very important for this to be the correct size. Pad the list with the defaults, or trim the excess entries.
                    if (_editorCraftData.Count < _defaultCraftData.Count)
                    {
                        _editorCraftData = mergeLists(_editorCraftData, _defaultCraftData, false);
                    }
                    else if (_editorCraftData.Count > _defaultCraftData.Count)
                    {
                        _editorCraftData.RemoveRange(_defaultCraftData.Count, _editorCraftData.Count - _defaultCraftData.Count);
                    }
                }
            }

            _previousOverrideExternal  = overrideExternal;
            _previousOverrideScan      = overrideScan;
            _previousFlagRemappedCraft = flagRemappedCraft;

            string previousDetectedInstall = _detectedInstallPath;

            detectInstallationPaths();
            if (previousDetectedInstall != _detectedInstallPath || configChanged || _detectedInstallPath == "")
            {
                if (_detectedInstallPath != "")
                {
                    if (_currentPlatform == Settings.Platform.XWA)
                    {
                        XwaInstallSpecificExternalDataLoaded = false;

                        // Try loading a custom list from the installation directory. This allows the user to customize craft lists for different versions of XWA.
                        if (overrideExternal && File.Exists(Path.Combine(_detectedInstallPath, "craft_data_xwa.txt")))
                        {
                            _externalCraftData = loadCraftData(Path.Combine(_detectedInstallPath, "craft_data_xwa.txt"));
                            XwaInstallSpecificExternalDataLoaded = true;
                        }

                        if (overrideScan)
                        {
                            _scannedCraftData = scanXwa(flagRemappedCraft);
                        }
                    }
                }

                _finalizedCraftData = mergeLists(_defaultCraftData, _externalCraftData, overrideExternal);
                if (overrideScan && _scannedCraftData != null && _scannedCraftData.Count > 0)
                {
                    _finalizedCraftData = mergeLists(_finalizedCraftData, _scannedCraftData, true);
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>Initialize the form, gather file listings from all categories</summary>
        /// <param name="plat">Platform identifier</param>
        public LstForm(Settings.Platform platform)
        {
            InitializeComponent();
            _platform = platform;
            Settings config = new Settings();

            if (platform == Settings.Platform.XvT)
            {
                _installPath = config.XvtPath;
            }
            else if (platform == Settings.Platform.BoP)
            {
                _installPath = config.BopPath;
            }
            else if (platform == Settings.Platform.XWA)
            {
                _installPath = config.XwaPath;
            }
            if (!Directory.Exists(_installPath))
            {
                MessageBox.Show("Error reading install path for platform, LST editor unavailable", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }
            if (platform == Settings.Platform.XWA)
            {
                System.Drawing.Size max = MaximumSize;
                max.Width  += 190;
                MaximumSize = max;
                Width       = max.Width;
                System.Drawing.Size min = MinimumSize;
                min.Width     = Width;
                MinimumSize   = min;
                lblEx.Left   += 75;
                txtLST.Width += 75;
                lblEx.Width  += 115;
                lblEx.Text    = "Example:\r\n\r\n//\r\n!BATTLE_0_HEADER![Section Title]\r\n//\r\n0\r\n* 1B0M1ex.tie\r\n!MISSION_0_DESC!Mission description\r\n1\r\n* 1B0M2ex.tie\r\n" +
                                "!MISSION_1_DESC!Keep to 1 line\r\n//\r\n!BATTLE_!_HEADER![Next Section]\r\n//\r\n2\r\n* 1B1M1ex.tie\r\n!MISSION_2_DESC!\"1B#M#*.tie\" req'd\r\n3\r\n" +
                                "* 1B1M2ex.tie\r\n!MISSION_3_DESC!etc";
                cboFile.Items.Add("MELEE\\MISSION.LST");
                cboFile.Items.Add("MISSIONS\\MISSION.LST");
                cboFile.SelectedIndex = 1;
            }
            if (platform == Settings.Platform.XvT || platform == Settings.Platform.BoP)
            {
                string[] str1 = Directory.GetFiles(_installPath + "\\Battle", "*.LST");
                string[] str6 = null;
                if (platform == Settings.Platform.BoP)
                {
                    str6 = Directory.GetFiles(_installPath + "\\Campaign", "*.LST");
                }
                string[] str2 = Directory.GetFiles(_installPath + "\\Combat", "*.LST");
                string[] str3 = Directory.GetFiles(_installPath + "\\Melee", "*.LST");
                string[] str4 = Directory.GetFiles(_installPath + "\\Tourn", "*.LST");
                string[] str5 = Directory.GetFiles(_installPath + "\\Train", "*.LST");
                string[] strFiles = new string[str1.Length + (str6 != null ? str6.Length : 0) + str2.Length + str3.Length + str4.Length + str5.Length];
                int      j = 0, start;
                for (int i = 0; i < str1.Length; i++, j++)
                {
                    strFiles[j] = str1[i].Substring(_installPath.Length + 1);
                }
                if (platform == Settings.Platform.BoP)
                {
                    for (int i = 0; i < str6.Length; i++, j++)
                    {
                        strFiles[j] = str6[i].Substring(_installPath.Length + 1);
                    }
                }
                for (int i = 0; i < str2.Length; i++, j++)
                {
                    strFiles[j] = str2[i].Substring(_installPath.Length + 1);
                }
                for (int i = 0; i < str3.Length; i++, j++)
                {
                    strFiles[j] = str3[i].Substring(_installPath.Length + 1);
                }
                for (int i = 0; i < str4.Length; i++, j++)
                {
                    strFiles[j] = str4[i].Substring(_installPath.Length + 1);
                }
                start = j;
                for (int i = 0; i < str5.Length; i++, j++)
                {
                    strFiles[j] = str5[i].Substring(_installPath.Length + 1);
                }
                cboFile.Items.AddRange(strFiles);
                cboFile.SelectedIndex = start;
            }
        }