//=========== HELPERS ============ #region Helpers /**<summary>Creates a rupee combobox item.</summary>*/ private void AddComboBoxItem(ComboBox comboBox, RupeeColors color) { ComboBoxItem item = new ComboBoxItem(); item.Height = 24; Grid grid = new Grid(); ColumnDefinition c0 = new ColumnDefinition(); c0.Width = new GridLength(20); ColumnDefinition c1 = new ColumnDefinition(); c1.Width = new GridLength(1, GridUnitType.Star); grid.ColumnDefinitions.Add(c0); grid.ColumnDefinitions.Add(c1); Image rupeeImage = new Image(); rupeeImage.HorizontalAlignment = HorizontalAlignment.Center; rupeeImage.VerticalAlignment = VerticalAlignment.Center; rupeeImage.Width = 10; rupeeImage.Height = 22; rupeeImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/Content/Images/RupeeItem" + color.ToString() + ".png")); grid.Children.Add(rupeeImage); Grid.SetColumn(rupeeImage, 0); TextBlock rupeeName = new TextBlock(); rupeeName.HorizontalAlignment = HorizontalAlignment.Left; rupeeName.VerticalAlignment = VerticalAlignment.Center; rupeeName.Text = color.ToString(); rupeeName.Padding = new Thickness(4, 0, 0, 0); grid.Children.Add(rupeeName); Grid.SetColumn(rupeeName, 1); item.Content = grid; comboBox.Items.Add(item); imagePortal.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Resources/Content/Images/RupeePortal" + ContentReplacer.Gold.ToString() + ".png")); }
/**<summary>Gets an image resource.</summary>*/ private static Bitmap GetImage(ImageTypes type, RupeeColors color) { ResourceManager rm = new ResourceManager("TerrariaRupeeReplacer.Properties.Resources", typeof(Resources).Assembly); return((Bitmap)rm.GetObject("Rupee" + type + color)); }
/**<summary>Replaces an image content file.</summary>*/ private static void ReplaceImage(ImageTypes type, RupeeColors color, string outputFile) { PngConverter.Convert(GetImage(type, color), Path.Combine(ImageDir, outputFile)); }