Esempio n. 1
0
        void CompressMapButton_Click(object sender, EventArgs e)
        {
            // add the output folders to the recent folders lists
            if (!Directory.Exists(SettingsHandler.MapDownloadToolSettings.MapCompressor.MapsFolder))
            {
                SettingsHandler.MapDownloadToolSettings.MapCompressor.MapsFolder = SettingsHandler.MapDownloadToolSettings.MapCompressor.PartsFolder;
            }

            // get the map file to compress from the user
            string map_file_path = Util.GetSingleFileOpenDialog(SettingsHandler.MapDownloadToolSettings.MapCompressor.MapsFolder,
                                                                "(*.map,*.yelo) Halo CE Map Cache|*.yelo;*.map",
                                                                "Select Map Cache");

            if (map_file_path.Length == 0)
            {
                return;
            }

            SettingsHandler.MapDownloadToolSettings.MapCompressor.MapsFolder = Path.GetDirectoryName(map_file_path);

            if (map_file_path != "")
            {
                MapCompressor.MapCompressorArgs compressorArgs = new MapCompressor.MapCompressorArgs
                {
                    Map               = map_file_path,
                    PartsFolder       = SettingsHandler.MapDownloadToolSettings.MapCompressor.PartsFolder,
                    DefinitionsFolder = SettingsHandler.MapDownloadToolSettings.MapCompressor.DefinitionsFolder,
                    EncryptArchive    = SettingsHandler.MapDownloadToolSettings.MapCompressor.EncryptArchive,
                    ServerPassword    = SettingsHandler.MapDownloadToolSettings.MapCompressor.ServerPassword
                };

                // create a progress controller to run the command in the background
                ProgressController progress_controller = new ProgressController(MapCompressor.CompressMap, null);

                progress_controller.WorkStarted += new EventHandler <ProgressController.ProgressControllerEventArgs>(ProgressControllerWorkStarted);
                progress_controller.WorkEnded   += new EventHandler <ProgressController.ProgressControllerEventArgs>(ProgressControllerWorkEnded);

                progress_controller.Start(compressorArgs);

                m_progress_controllers.Add(progress_controller);
            }
        }
Esempio n. 2
0
		void CompressMapButton_Click(object sender, EventArgs e)
		{
			// add the output folders to the recent folders lists
			if (!Util.BindingListFind<StringWrapperClass>(SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders,
				delegate(StringWrapperClass element)
				{
					return element.Value.Equals(m_map_compressor_globals.PartsFolder);
				}))
			{
				SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders.Insert(0, new StringWrapperClass(m_map_compressor_globals.PartsFolder));
				if (SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders.Count > 10)
					SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders.RemoveAt(SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders.Count - 1);
				RecentPartsFolderComboBox.SelectedIndex = 0;
				RecentPartsFolderComboBox.UpdateDropDownWidth();
			}
			if (!Util.BindingListFind<StringWrapperClass>(SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders,
				delegate(StringWrapperClass element)
				{
					return element.Value.Equals(m_map_compressor_globals.DefinitionsFolder);
				}))
			{
				SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders.Insert(0, new StringWrapperClass(m_map_compressor_globals.DefinitionsFolder));
				if (SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders.Count > 10)
					SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders.RemoveAt(SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders.Count - 1);
				RecentDefinitionsFolderComboBox.SelectedIndex = 0;
				RecentDefinitionsFolderComboBox.UpdateDropDownWidth();
			}

			if (!Directory.Exists(SettingsHandler.MapDownloadToolSettings.MapCompressor.LastMapsFolder))
				SettingsHandler.MapDownloadToolSettings.MapCompressor.LastMapsFolder = m_map_compressor_globals.PartsFolder;

			// get the map file to compress from the user
			string map_file_path = Util.GetSingleFileOpenDialog(SettingsHandler.MapDownloadToolSettings.MapCompressor.LastMapsFolder,
				"(*.map,*.yelo) Halo CE Map Cache|*.yelo;*.map",
				"Select Map Cache");

			if (map_file_path.Length == 0)
				return;

			SettingsHandler.MapDownloadToolSettings.MapCompressor.LastMapsFolder = Path.GetDirectoryName(map_file_path);

			if (map_file_path != "")
			{
				m_map_compressor_globals.MapCompressorArguments.Map = map_file_path;

				// create a progress controller to run the command in the background
				ProgressController progress_controller = new ProgressController(MapCompressor.CompressMap, null);

				progress_controller.WorkStarted += new EventHandler<ProgressController.ProgressControllerEventArgs>(ProgressControllerWorkStarted);
				progress_controller.WorkEnded += new EventHandler<ProgressController.ProgressControllerEventArgs>(ProgressControllerWorkEnded);
				
				progress_controller.Start(m_map_compressor_globals.MapCompressorArguments);

				m_progress_controllers.Add(progress_controller);
			}
		}
Esempio n. 3
0
		void CompressMapButton_Click(object sender, EventArgs e)
		{
			// add the output folders to the recent folders lists
			if (!Directory.Exists(SettingsHandler.MapDownloadToolSettings.MapCompressor.MapsFolder))
			{
				SettingsHandler.MapDownloadToolSettings.MapCompressor.MapsFolder = SettingsHandler.MapDownloadToolSettings.MapCompressor.PartsFolder;
			}

			// get the map file to compress from the user
			string map_file_path = Util.GetSingleFileOpenDialog(SettingsHandler.MapDownloadToolSettings.MapCompressor.MapsFolder,
				"(*.map,*.yelo) Halo CE Map Cache|*.yelo;*.map",
				"Select Map Cache");

			if (map_file_path.Length == 0)
				return;

			SettingsHandler.MapDownloadToolSettings.MapCompressor.MapsFolder = Path.GetDirectoryName(map_file_path);

			if (map_file_path != "")
			{
				MapCompressor.MapCompressorArgs compressorArgs = new MapCompressor.MapCompressorArgs
				{
					Map = map_file_path,
					PartsFolder = SettingsHandler.MapDownloadToolSettings.MapCompressor.PartsFolder,
					DefinitionsFolder = SettingsHandler.MapDownloadToolSettings.MapCompressor.DefinitionsFolder,
					EncryptArchive = SettingsHandler.MapDownloadToolSettings.MapCompressor.EncryptArchive,
					ServerPassword = SettingsHandler.MapDownloadToolSettings.MapCompressor.ServerPassword
				};

				// create a progress controller to run the command in the background
				ProgressController progress_controller = new ProgressController(MapCompressor.CompressMap, null);

				progress_controller.WorkStarted += new EventHandler<ProgressController.ProgressControllerEventArgs>(ProgressControllerWorkStarted);
				progress_controller.WorkEnded += new EventHandler<ProgressController.ProgressControllerEventArgs>(ProgressControllerWorkEnded);

				progress_controller.Start(compressorArgs);

				m_progress_controllers.Add(progress_controller);
			}
		}
Esempio n. 4
0
        void CompressMapButton_Click(object sender, EventArgs e)
        {
            // add the output folders to the recent folders lists
            if (!Util.BindingListFind <StringWrapperClass>(SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders,
                                                           delegate(StringWrapperClass element)
            {
                return(element.Value.Equals(m_map_compressor_globals.PartsFolder));
            }))
            {
                SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders.Insert(0, new StringWrapperClass(m_map_compressor_globals.PartsFolder));
                if (SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders.Count > 10)
                {
                    SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders.RemoveAt(SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentPartsFolders.Count - 1);
                }
                RecentPartsFolderComboBox.SelectedIndex = 0;
                RecentPartsFolderComboBox.UpdateDropDownWidth();
            }
            if (!Util.BindingListFind <StringWrapperClass>(SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders,
                                                           delegate(StringWrapperClass element)
            {
                return(element.Value.Equals(m_map_compressor_globals.DefinitionsFolder));
            }))
            {
                SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders.Insert(0, new StringWrapperClass(m_map_compressor_globals.DefinitionsFolder));
                if (SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders.Count > 10)
                {
                    SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders.RemoveAt(SettingsHandler.MapDownloadToolSettings.MapCompressor.RecentDefinitionsFolders.Count - 1);
                }
                RecentDefinitionsFolderComboBox.SelectedIndex = 0;
                RecentDefinitionsFolderComboBox.UpdateDropDownWidth();
            }

            if (!Directory.Exists(SettingsHandler.MapDownloadToolSettings.MapCompressor.LastMapsFolder))
            {
                SettingsHandler.MapDownloadToolSettings.MapCompressor.LastMapsFolder = m_map_compressor_globals.PartsFolder;
            }

            // get the map file to compress from the user
            string map_file_path = Util.GetSingleFileOpenDialog(SettingsHandler.MapDownloadToolSettings.MapCompressor.LastMapsFolder,
                                                                "(*.map,*.yelo) Halo CE Map Cache|*.yelo;*.map",
                                                                "Select Map Cache");

            if (map_file_path.Length == 0)
            {
                return;
            }

            SettingsHandler.MapDownloadToolSettings.MapCompressor.LastMapsFolder = Path.GetDirectoryName(map_file_path);

            if (map_file_path != "")
            {
                m_map_compressor_globals.MapCompressorArguments.Map = map_file_path;

                // create a progress controller to run the command in the background
                ProgressController progress_controller = new ProgressController(MapCompressor.CompressMap, null);

                progress_controller.WorkStarted += new EventHandler <ProgressController.ProgressControllerEventArgs>(ProgressControllerWorkStarted);
                progress_controller.WorkEnded   += new EventHandler <ProgressController.ProgressControllerEventArgs>(ProgressControllerWorkEnded);

                progress_controller.Start(m_map_compressor_globals.MapCompressorArguments);

                m_progress_controllers.Add(progress_controller);
            }
        }