private void browseImageBtn_Click(object sender, EventArgs e)
        {
            // show the file dialog
            imageSaveFileDialog.FileName = imageFileTxtBox.Text;
            if (imageSaveFileDialog.ShowDialog() == DialogResult.OK)
            {
                // store the image path
                imageFileTxtBox.Text = imageSaveFileDialog.FileName;

                // figure out which image exporter to use based on the extension
                string imageExtension = Path.GetExtension(imageSaveFileDialog.FileName).Substring(1);
                foreach (var exporter in sspack.Exporters.ImageExporters)
                {
                    if (exporter.ImageExtension.Equals(imageExtension, StringComparison.InvariantCultureIgnoreCase))
                    {
                        currentImageExporter = exporter;
                        break;
                    }
                }
                SpriteSheetPacker.Settings.Default.ImageExt = imageExtension;

                // if there is no selected map exporter, default to the last used
                if (currentMapExporter == null)
                {
                    string mapExtension = SpriteSheetPacker.Settings.Default.MapExt;
                    foreach (var exporter in sspack.Exporters.MapExporters)
                    {
                        if (exporter.MapExtension.Equals(mapExtension, StringComparison.InvariantCultureIgnoreCase))
                        {
                            currentMapExporter = exporter;
                            break;
                        }
                    }

                    currentMapExporter = sspack.Exporters.GetTpsheetExporter();

                    // if the last used map exporter didn't exist, default to the first one
                    if (currentMapExporter == null)
                    {
                        //currentMapExporter = sspack.Exporters.MapExporters[0];
                        currentMapExporter = sspack.Exporters.GetTpsheetExporter();
                    }
                }

                mapFileTxtBox.Text = imageSaveFileDialog.FileName.Remove(imageSaveFileDialog.FileName.Length - 3) + currentMapExporter.MapExtension.ToLower();
            }
        }
Beispiel #2
0
        private void browseMapBtn_Click(object sender, EventArgs e)
        {
            // show the file dialog
            mapSaveFileDialog.FileName = mapFileTxtBox.Text;
            if (mapSaveFileDialog.ShowDialog() == DialogResult.OK)
            {
                // store the file path
                mapFileTxtBox.Text = mapSaveFileDialog.FileName;

                // figure out which map exporter to use based on the extension
                string mapExtension = Path.GetExtension(mapSaveFileDialog.FileName).Substring(1);
                foreach (var exporter in sspack.Exporters.MapExporters)
                {
                    if (exporter.MapExtension.Equals(mapExtension, StringComparison.InvariantCultureIgnoreCase))
                    {
                        currentMapExporter = exporter;
                        break;
                    }
                }
                SpriteSheetPacker.Settings.Default.MapExt = mapExtension;
            }
        }
		private void browseMapBtn_Click(object sender, EventArgs e)
		{
			// show the file dialog
			mapSaveFileDialog.FileName = mapFileTxtBox.Text;
			if (mapSaveFileDialog.ShowDialog() == DialogResult.OK)
			{
				// store the file path
				mapFileTxtBox.Text = mapSaveFileDialog.FileName;

				// figure out which map exporter to use based on the extension
                string mapExtension = Path.GetExtension(mapSaveFileDialog.FileName).Substring(1);
				foreach (var exporter in sspack.Exporters.MapExporters)
				{
                    if (exporter.MapExtension.Equals(mapExtension, StringComparison.InvariantCultureIgnoreCase))
					{
						currentMapExporter = exporter;
						break;
					}
				}
                SpriteSheetPacker.Settings.Default.MapExt = mapExtension;
			}
		}
		private void browseImageBtn_Click(object sender, EventArgs e)
		{
			// show the file dialog
			imageSaveFileDialog.FileName = imageFileTxtBox.Text;
			if (imageSaveFileDialog.ShowDialog() == DialogResult.OK)
			{
				// store the image path
				imageFileTxtBox.Text = imageSaveFileDialog.FileName;

				// figure out which image exporter to use based on the extension
                string imageExtension = Path.GetExtension(imageSaveFileDialog.FileName).Substring(1);
				foreach (var exporter in sspack.Exporters.ImageExporters)
				{
					if (exporter.ImageExtension.Equals(imageExtension, StringComparison.InvariantCultureIgnoreCase))
					{
						currentImageExporter = exporter;    
						break;
					}
				}
                SpriteSheetPacker.Settings.Default.ImageExt = imageExtension;
				
				// if there is no selected map exporter, default to the last used
                if (currentMapExporter == null)
				{
                    string mapExtension = SpriteSheetPacker.Settings.Default.MapExt;
                    foreach (var exporter in sspack.Exporters.MapExporters)
                    {
                        if (exporter.MapExtension.Equals(mapExtension, StringComparison.InvariantCultureIgnoreCase))
                        {
                            currentMapExporter = exporter;
                            break;
                        }
                    }

                    // if the last used map exporter didn't exist, default to the first one
                    if (currentMapExporter == null)
                    {
                        currentMapExporter = sspack.Exporters.MapExporters[0];
                    }
				}
				
				mapFileTxtBox.Text = imageSaveFileDialog.FileName.Remove(imageSaveFileDialog.FileName.Length - 3) + currentMapExporter.MapExtension.ToLower();
			}
		}