예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;

            TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;

            // Setup egg2 Timers
            egg2.Interval = new TimeSpan(0, 0, 20);
            egg2.Tick    += new EventHandler(egg2_Tick);

            // Set settings menu visible state
            settingsMain.SettingsChanged += new EventHandler(settingsMain_SettingsChanged);
            settingsMain.Closed          += new EventHandler(settingsMain_Closed);
            settingsPanel.Visibility      = Visibility.Hidden;

            // Set up reach stuff
            _reachSaveManager = new Util.SaveManager <Reach.CampaignSave>(path => new Reach.CampaignSave(path));
            _reachTaglists    = new Reach.TagListManager(_reachSaveManager);

            // Set up HCEX stuff
            _hcexSaveManager = new Util.SaveManager <HCEX.CampaignSave>(path => new HCEX.CampaignSave(path));

            // Set up Halo3 stuff
            _halo3SaveManager = new Util.SaveManager <Halo3.CampaignSave>(path => new Halo3.CampaignSave(path));

            // Set up Halo3: ODST stuff
            _halo3ODSTSaveManager = new Util.SaveManager <Halo3ODST.CampaignSave>(path => new Halo3ODST.CampaignSave(path));

            // Set up Halo4 stuff
            _halo4SaveManager = new Util.SaveManager <Halo4.CampaignSave>(path => new Halo4.CampaignSave(path));

            // Set up the step viewer
            _stepViewer = new StepViewer(stepGrid);
            _stepViewer.BeforeViewNode += new EventHandler <ViewNodeEventArgs>(stepViewer_BeforeViewNode);

            // Create steps
            _stepSelectMode   = new selectMode();
            _stepOpenFile     = new openSaveFile(loadSaveFile);
            _stepSelectDevice = new selectDevice();
            selectSaveOnDevice stepSelectSave = new selectSaveOnDevice(_stepSelectDevice, _saveTransferrer, loadSaveFile);

            saving stepSaving = new saving(updateSaveFile);

            _stepTransfer = new transferSave(_saveTransferrer, this);
            allDone stepAllDone = new allDone(_stepSelectMode);

            #region Reach
            verifyFile   reachVerifyFile = new verifyFile(_reachSaveManager, _reachTaglists, this);
            editBiped    reachBiped      = new editBiped(_reachSaveManager, _reachTaglists);
            editWeapons  reachWeapons    = new editWeapons(_reachSaveManager, _reachTaglists);
            editGrenades reachGrenades   = new editGrenades(_reachSaveManager);
            editObjects  reachObjects    = new editObjects(_reachSaveManager, _reachTaglists);
            quickTweaks  reachTweaks     = new quickTweaks(_reachSaveManager);
            #endregion

            #region HCEX
            _cexVerifyFile = new HCEX.UI.cexVerifyFile(_hcexSaveManager);
            cexEditBiped    cexEditBiped    = new HCEX.UI.cexEditBiped(_hcexSaveManager);
            cexEditWeapons  cexEditWeapons  = new HCEX.UI.cexEditWeapons(_hcexSaveManager);
            cexEditGrenades cexEditGrenades = new HCEX.UI.cexEditGrenades(_hcexSaveManager);
            cexQuickTweaks  cexQuickTweaks  = new HCEX.UI.cexQuickTweaks(_hcexSaveManager);
            #endregion

            #region Halo3
            h3VerifyFile   h3VerifyFile   = new Halo3.UI.h3VerifyFile(_halo3SaveManager);
            h3EditBiped    h3EditBiped    = new Halo3.UI.h3EditBiped(_halo3SaveManager);
            h3EditWeapons  h3EditWeapons  = new Halo3.UI.h3EditWeapons(_halo3SaveManager);
            h3EditGrenades h3EditGrenades = new Halo3.UI.h3EditGrenades(_halo3SaveManager);
            h3QuickTweaks  h3QuickTweaks  = new Halo3.UI.h3QuickTweaks(_halo3SaveManager);
            #endregion

            #region Halo3ODST
            h3ODSTVerifyFile   h3ODSTVerifyFile   = new Halo3ODST.UI.h3ODSTVerifyFile(_halo3ODSTSaveManager);
            h3ODSTEditBiped    h3ODSTEditBiped    = new Halo3ODST.UI.h3ODSTEditBiped(_halo3ODSTSaveManager);
            h3ODSTEditWeapons  h3ODSTEditWeapons  = new Halo3ODST.UI.h3ODSTEditWeapons(_halo3ODSTSaveManager);
            h3ODSTEditGrenades h3ODSTEditGrenades = new Halo3ODST.UI.h3ODSTEditGrenades(_halo3ODSTSaveManager);
            #endregion

            #region Halo 4
            h4VerifyFile   h4VerifyFile   = new Halo4.UI.h4VerifyFile(_halo4SaveManager);
            h4EditBiped    h4EditBiped    = new Halo4.UI.h4EditBiped(_halo4SaveManager);
            h4EditWeapons  h4EditWeapons  = new Halo4.UI.h4EditWeapons(_halo4SaveManager);
            h4EditGrenades h4EditGrenades = new Halo4.UI.h4EditGrenades(_halo4SaveManager);
            h4QuickTweaks  h4QuickTweaks  = new Halo4.UI.h4QuickTweaks(_halo4SaveManager);
            #endregion

            // FIXME: hax, the StepGraphBuilder can't set up a WorkStepProgressUpdater or else StepViewer.Forward() will get called twice due to two events being attached
            // Maybe I should just throw away that feature where the progress bar can update mid-step so a group reference isn't needed
            IStep workStepSaving   = new WorkStepProgressUpdater(new UnnavigableWorkStep(stepSaving, gridButtons, headerControls), null, _stepViewer);
            IStep workStepTransfer = new WorkStepProgressUpdater(new UnnavigableWorkStep(_stepTransfer, gridButtons, headerControls), null, _stepViewer);

            // Add them to the step grid
            addStep(_stepSelectMode);
            addStep(_stepOpenFile);
            addStep(_stepSelectDevice);
            addStep(stepSelectSave);

            #region ReachSteps
            addStep(reachVerifyFile);
            addStep(reachBiped);
            addStep(reachWeapons);
            addStep(reachGrenades);
            addStep(reachObjects);
            addStep(reachTweaks);
            #endregion

            #region CEXSteps
            addStep(_cexVerifyFile);
            addStep(cexEditBiped);
            addStep(cexEditWeapons);
            addStep(cexEditGrenades);
            addStep(cexQuickTweaks);
            #endregion

            #region Halo3Steps
            addStep(h3VerifyFile);
            addStep(h3EditBiped);
            addStep(h3EditWeapons);
            addStep(h3EditGrenades);
            addStep(h3QuickTweaks);
            #endregion

            #region Halo3ODSTSteps
            addStep(h3ODSTVerifyFile);
            addStep(h3ODSTEditBiped);
            addStep(h3ODSTEditWeapons);
            addStep(h3ODSTEditGrenades);
            #endregion

            #region Halo4Steps
            addStep(h4VerifyFile);
            addStep(h4EditBiped);
            addStep(h4EditWeapons);
            addStep(h4EditGrenades);
            //addStep(h4QuickTweaks);
            #endregion

            addStep(stepSaving);
            addStep(_stepTransfer);
            addStep(stepAllDone);

            // Start building the step graph
            StepGraphBuilder stepGraph = new StepGraphBuilder(progressBar);
            stepGraph.AddBranchStep(_stepSelectMode, "PREPARATION");

            // Step graph: Edit save on computer
            StepGraphBuilder editSaveOnComputer = stepGraph.StartBranch(selectMode.EditingMode.EditSaveComputer, true);
            editSaveOnComputer.AddBranchStep(_stepOpenFile, "SAVE SELECTION");
            editSaveOnComputer.AddPlaceholder("SAVE SELECTION");

            // Step graph: Edit save on removable device
            StepGraphBuilder editSaveOnDevice = stepGraph.StartBranch(selectMode.EditingMode.EditSaveDevice, true);
            editSaveOnDevice.AddStep(_stepSelectDevice, "SAVE SELECTION");
            editSaveOnDevice.AddBranchStep(stepSelectSave, "SAVE SELECTION");
            editSaveOnDevice.AddPlaceholder("SAVE SELECTION");

            #region ReachSteps
            // Step graph: Edit Halo: Reach save on computer
            StepGraphBuilder reachComputerSave = editSaveOnComputer.StartBranch(Util.SaveType.Reach, true);
            reachComputerSave.AddStep(reachVerifyFile, "SAVE SELECTION");
            reachComputerSave.AddStep(reachBiped, "CHARACTER DATA");
            reachComputerSave.AddStep(reachWeapons, "WEAPON DATA");
            reachComputerSave.AddStep(reachGrenades, "WEAPON DATA");
            reachComputerSave.AddStep(reachObjects, "OBJECT DATA");
            reachComputerSave.AddStep(reachTweaks, "OBJECT DATA");
            reachComputerSave.AddStep(workStepSaving);
            reachComputerSave.AddStep(stepAllDone, "FINISHED");

            // Step graph: Edit Halo: Reach save on removable device
            StepGraphBuilder reachDeviceSave = editSaveOnDevice.StartBranch(Util.SaveType.Reach, true);
            reachDeviceSave.AddStep(reachVerifyFile, "SAVE SELECTION");
            reachDeviceSave.AddStep(reachBiped, "CHARACTER DATA");
            reachDeviceSave.AddStep(reachWeapons, "WEAPON DATA");
            reachDeviceSave.AddStep(reachGrenades, "WEAPON DATA");
            reachDeviceSave.AddStep(reachObjects, "OBJECT DATA");
            reachDeviceSave.AddStep(reachTweaks, "OBJECT DATA");
            reachDeviceSave.AddStep(workStepSaving);
            reachDeviceSave.AddStep(workStepTransfer);
            reachDeviceSave.AddStep(stepAllDone, "FINISHED");
            #endregion

            #region CEXSteps
            // Step graph: Edit HCEX save on computer
            StepGraphBuilder hcexComputerSave = editSaveOnComputer.StartBranch(Util.SaveType.Anniversary, true);
            hcexComputerSave.AddStep(_cexVerifyFile, "SAVE SELECTION");
            hcexComputerSave.AddStep(cexEditBiped, "CHARACTER DATA");
            hcexComputerSave.AddStep(cexEditWeapons, "WEAPON DATA");
            hcexComputerSave.AddStep(cexEditGrenades, "WEAPON DATA");
            hcexComputerSave.AddStep(cexQuickTweaks, "OBJECT DATA");
            hcexComputerSave.AddStep(workStepSaving);
            hcexComputerSave.AddStep(stepAllDone, "FINISHED");

            // Step graph: Edit HCEX save on removable device
            StepGraphBuilder hcexDeviceSave = editSaveOnDevice.StartBranch(Util.SaveType.Anniversary, true);
            hcexDeviceSave.AddStep(_cexVerifyFile, "SAVE SELECTION");
            hcexDeviceSave.AddStep(cexEditBiped, "CHARACTER DATA");
            hcexDeviceSave.AddStep(cexEditWeapons, "WEAPON DATA");
            hcexDeviceSave.AddStep(cexEditGrenades, "WEAPON DATA");
            hcexDeviceSave.AddStep(cexQuickTweaks, "OBJECT DATA");
            hcexDeviceSave.AddStep(workStepSaving);
            hcexDeviceSave.AddStep(workStepTransfer);
            hcexDeviceSave.AddStep(stepAllDone, "FINISHED");
            #endregion

            #region Halo3Steps
            // Step graph: Edit Halo3 save on computer
            StepGraphBuilder halo3ComputerSave = editSaveOnComputer.StartBranch(Util.SaveType.Halo3, true);
            halo3ComputerSave.AddStep(h3VerifyFile, "SAVE SELECTION");
            halo3ComputerSave.AddStep(h3EditBiped, "CHARACTER DATA");
            halo3ComputerSave.AddStep(h3EditWeapons, "WEAPON DATA");
            halo3ComputerSave.AddStep(h3EditGrenades, "WEAPON DATA");
            halo3ComputerSave.AddStep(h3QuickTweaks, "OBJECT DATA");
            halo3ComputerSave.AddStep(workStepSaving);
            halo3ComputerSave.AddStep(stepAllDone, "FINISHED");

            // Step graph: Edit Halo3 save on removable device
            StepGraphBuilder halo3DeviceSave = editSaveOnDevice.StartBranch(Util.SaveType.Halo3, true);
            halo3DeviceSave.AddStep(h3VerifyFile, "SAVE SELECTION");
            halo3DeviceSave.AddStep(h3EditBiped, "CHARACTER DATA");
            halo3DeviceSave.AddStep(h3EditWeapons, "WEAPON DATA");
            halo3DeviceSave.AddStep(h3EditGrenades, "WEAPON DATA");
            halo3DeviceSave.AddStep(h3QuickTweaks, "OBJECT DATA");
            halo3DeviceSave.AddStep(workStepSaving);
            halo3DeviceSave.AddStep(workStepTransfer);
            halo3DeviceSave.AddStep(stepAllDone, "FINISHED");
            #endregion

            #region Halo3ODSTSteps
            // Step graph: Edit Halo3 save on computer
            StepGraphBuilder halo3ODSTComputerSave = editSaveOnComputer.StartBranch(Util.SaveType.Halo3ODST, true);
            halo3ODSTComputerSave.AddStep(h3ODSTVerifyFile, "SAVE SELECTION");
            halo3ODSTComputerSave.AddStep(h3ODSTEditBiped, "CHARACTER DATA");
            halo3ODSTComputerSave.AddStep(h3ODSTEditWeapons, "WEAPON DATA");
            halo3ODSTComputerSave.AddStep(h3ODSTEditGrenades, "WEAPON DATA");
            halo3ODSTComputerSave.AddStep(workStepSaving);
            halo3ODSTComputerSave.AddStep(stepAllDone, "FINISHED");

            // Step graph: Edit Halo3 save on removable device
            StepGraphBuilder halo3ODSTDeviceSave = editSaveOnDevice.StartBranch(Util.SaveType.Halo3ODST, true);
            halo3ODSTDeviceSave.AddStep(h3ODSTVerifyFile, "SAVE SELECTION");
            halo3ODSTDeviceSave.AddStep(h3ODSTEditBiped, "CHARACTER DATA");
            halo3ODSTDeviceSave.AddStep(h3ODSTEditWeapons, "WEAPON DATA");
            halo3ODSTDeviceSave.AddStep(h3ODSTEditGrenades, "WEAPON DATA");
            halo3ODSTDeviceSave.AddStep(workStepSaving);
            halo3ODSTDeviceSave.AddStep(workStepTransfer);
            halo3ODSTDeviceSave.AddStep(stepAllDone, "FINISHED");
            #endregion

            #region Halo4Steps
            // Step graph: Edit Halo3 save on computer
            StepGraphBuilder halo4ComputerSave = editSaveOnComputer.StartBranch(Util.SaveType.Halo4, true);
            halo4ComputerSave.AddStep(h4VerifyFile, "SAVE SELECTION");
            halo4ComputerSave.AddStep(h4EditBiped, "CHARACTER DATA");
            halo4ComputerSave.AddStep(h4EditWeapons, "WEAPON DATA");
            halo4ComputerSave.AddStep(h4EditGrenades, "WEAPON DATA");
            //halo4ComputerSave.AddStep(h4QuickTweaks, "OBJECT DATA");
            halo4ComputerSave.AddStep(workStepSaving);
            halo4ComputerSave.AddStep(stepAllDone, "FINISHED");

            // Step graph: Edit Halo3 save on removable device
            StepGraphBuilder halo4DeviceSave = editSaveOnDevice.StartBranch(Util.SaveType.Halo4, true);
            halo4DeviceSave.AddStep(h4VerifyFile, "SAVE SELECTION");
            halo4DeviceSave.AddStep(h4EditBiped, "CHARACTER DATA");
            halo4DeviceSave.AddStep(h4EditWeapons, "WEAPON DATA");
            halo4DeviceSave.AddStep(h4EditGrenades, "WEAPON DATA");
            //halo4DeviceSave.AddStep(h4QuickTweaks, "OBJECT DATA");
            halo4DeviceSave.AddStep(workStepSaving);
            halo4DeviceSave.AddStep(workStepTransfer);
            halo4DeviceSave.AddStep(stepAllDone, "FINISHED");
            #endregion

            // Add dummy groups so that they show in the progress bar
            // This needs to be improved upon...
            stepGraph.AddGroup("SAVE SELECTION");
            stepGraph.AddGroup("CHARACTER DATA");
            stepGraph.AddGroup("WEAPON DATA");
            stepGraph.AddGroup("OBJECT DATA");
            stepGraph.AddGroup("FINISHED");
            editSaveOnComputer.AddGroup("CHARACTER DATA");
            editSaveOnComputer.AddGroup("WEAPON DATA");
            editSaveOnComputer.AddGroup("OBJECT DATA");
            editSaveOnComputer.AddGroup("FINISHED");
            editSaveOnDevice.AddGroup("CHARACTER DATA");
            editSaveOnDevice.AddGroup("WEAPON DATA");
            editSaveOnDevice.AddGroup("OBJECT DATA");
            editSaveOnDevice.AddGroup("FINISHED");

            _firstStep = stepGraph.BuildGraph();
            _stepViewer.ViewNode(_firstStep);
            btnBack.Visibility = _stepViewer.CanGoBack ? Visibility.Visible : Visibility.Hidden;

#if DEBUG
            btnBetaPlayground.Visibility = System.Windows.Visibility.Visible;
            lblBetaWatermark.Visibility  = System.Windows.Visibility.Visible;

            string            datetime  = DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString().Remove(0, 2);
            Security.SaveSHA1 sha1      = new Security.SaveSHA1();
            UTF8Encoding      utf       = new UTF8Encoding();
            byte[]            buildHash = Security.SaveSHA1.ComputeHash(utf.GetBytes(Assembly.GetExecutingAssembly().GetName().Version.ToString() + lblBetaWatermark.Text));


            lblBetaWatermark.Text = string.Format("Liberty Developer Preview" + Environment.NewLine + "Build {0}.tfs_main.{1}-1733.{2}",
                                                  Assembly.GetExecutingAssembly().GetName().Version.ToString().Replace(".", ""),
                                                  datetime,
                                                  BitConverter.ToString(buildHash).ToLower().Replace("-", "").Remove(16));
#else
            btnBetaPlayground.Visibility = System.Windows.Visibility.Hidden;
            lblBetaWatermark.Visibility  = System.Windows.Visibility.Hidden;
#endif
        }
예제 #2
0
 public editGrenades(Util.SaveManager <Reach.CampaignSave> saveManager)
 {
     _saveManager = saveManager;
     this.InitializeComponent();
 }