updated to latest codebase

This commit is contained in:
Bitl 2021-10-21 11:05:04 -07:00
parent 5dc98f83a7
commit 6f207c2a3c
19 changed files with 341 additions and 176 deletions

View File

@ -18,8 +18,6 @@ class CharacterCustomizationShared
public string Custom_Shirt_URL = ""; public string Custom_Shirt_URL = "";
public string Custom_Pants_URL = ""; public string Custom_Pants_URL = "";
public string Custom_Face_URL = ""; public string Custom_Face_URL = "";
public PartColor[] PartColorList;
public List<PartColor> PartColorListConv;
public Provider[] contentProviders; public Provider[] contentProviders;
public Form Parent; public Form Parent;
public Settings.Style FormStyle; public Settings.Style FormStyle;
@ -27,13 +25,12 @@ class CharacterCustomizationShared
public ComboBox FaceTypeBox, TShirtsTypeBox, ShirtsTypeBox, PantsTypeBox; public ComboBox FaceTypeBox, TShirtsTypeBox, ShirtsTypeBox, PantsTypeBox;
public TextBox FaceIDBox, TShirtsIDBox, ShirtsIDBox, PantsIDBox, CharacterIDBox, Hat1Desc, Hat2Desc, Hat3Desc, HeadDesc, TShirtDesc, ShirtDesc, PantsDesc, FaceDesc, ExtraItemDesc; public TextBox FaceIDBox, TShirtsIDBox, ShirtsIDBox, PantsIDBox, CharacterIDBox, Hat1Desc, Hat2Desc, Hat3Desc, HeadDesc, TShirtDesc, ShirtDesc, PantsDesc, FaceDesc, ExtraItemDesc;
public CheckBox ShowHatsInExtraBox; public CheckBox ShowHatsInExtraBox;
public Label SelectedPartLabel, IconLabel; public Label SelectedPartLabel, IconLabel, AestheticDivider;
public TabControl CharacterTabControl; public TabControl CharacterTabControl;
public Panel OrganizationPanel, AestheticPanel1, AestheticPanel2; public Panel OrganizationPanel, AestheticPanel1, AestheticPanel2;
public ListBox Hat1List, Hat2List, Hat3List, HeadList, TShirtList, ShirtList, PantsList, FaceList, ExtraItemList; public ListBox Hat1List, Hat2List, Hat3List, HeadList, TShirtList, ShirtList, PantsList, FaceList, ExtraItemList;
public PictureBox Hat1Image, Hat2Image, Hat3Image, HeadImage, TShirtImage, ShirtImage, PantsImage, FaceImage, ExtraItemImage, IconImage; public PictureBox Hat1Image, Hat2Image, Hat3Image, HeadImage, TShirtImage, ShirtImage, PantsImage, FaceImage, ExtraItemImage, IconImage;
public ListView ColorView; public ListView ColorView;
private ImageList ColorImageList;
public bool closeOnLaunch = false; public bool closeOnLaunch = false;
#endregion #endregion
@ -42,40 +39,20 @@ class CharacterCustomizationShared
{ {
} }
public bool InitColors()
{
try
{
if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName))
{
PartColorList = PartColorLoader.GetPartColors();
PartColorListConv = new List<PartColor>();
PartColorListConv.AddRange(PartColorList);
return true;
}
else
{
goto Failure;
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
goto Failure;
}
Failure:
MessageBox.Show("The part colors cannot be loaded. The character customization menu will now close.", "Novetus - Cannot load part colors.", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
#endregion #endregion
#region Form Event Functions #region Form Event Functions
public void InitForm() public void InitForm()
{ {
if (GlobalFuncs.HasColorsChanged())
{
GlobalVars.ColorsLoaded = GlobalFuncs.InitColors();
closeOnLaunch = !GlobalVars.ColorsLoaded;
}
if (closeOnLaunch) if (closeOnLaunch)
{ {
MessageBox.Show("The part colors cannot be loaded. The character customization will now close.", "Novetus - Cannot load part colors.", MessageBoxButtons.OK, MessageBoxIcon.Error);
Parent.Close(); Parent.Close();
return; return;
} }
@ -134,29 +111,8 @@ class CharacterCustomizationShared
PantsIDBox.Enabled = false; PantsIDBox.Enabled = false;
} }
int imgsize = 32; int imgsize = (FormStyle == Settings.Style.Extended) ? 28 : 18;
ColorImageList = new ImageList(); PartColorLoader.AddPartColorsToListView(GlobalVars.PartColorList, ColorView, imgsize);
ColorImageList.ImageSize = new Size(imgsize, imgsize);
ColorImageList.ColorDepth = ColorDepth.Depth32Bit;
ColorView.LargeImageList = ColorImageList;
ColorView.SmallImageList = ColorImageList;
foreach (var item in PartColorList)
{
var lvi = new ListViewItem(item.ColorName);
lvi.Tag = item.ColorID;
Bitmap Bmp = new Bitmap(imgsize, imgsize, PixelFormat.Format32bppArgb);
using (Graphics gfx = Graphics.FromImage(Bmp))
using (SolidBrush brush = new SolidBrush(item.ColorObject))
{
gfx.FillRectangle(brush, 0, 0, imgsize, imgsize);
}
ColorImageList.Images.Add(item.ColorName, Bmp);
lvi.ImageIndex = ColorImageList.Images.IndexOfKey(item.ColorName);
ColorView.Items.Add(lvi);
}
//body //body
SelectedPartLabel.Text = SelectedPart; SelectedPartLabel.Text = SelectedPart;
@ -172,11 +128,29 @@ class CharacterCustomizationShared
if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish) if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish)
{ {
Parent.BackColor = Color.FromArgb(110, 152, 200); Color robBlue = Color.FromArgb(110, 152, 200);
if (FormStyle == Settings.Style.Extended) if (FormStyle == Settings.Style.Extended)
{ {
AestheticPanel1.BackColor = Color.FromArgb(110, 152, 200); AestheticPanel1.BorderStyle = BorderStyle.None;
AestheticPanel2.BackColor = Color.FromArgb(110, 152, 200); AestheticPanel1.BackColor = robBlue;
foreach (Control C in AestheticPanel1.Controls)
{
if (C is Button)
{
Button button = (Button)C;
button.FlatStyle = FlatStyle.Flat;
button.FlatAppearance.BorderColor = Color.White;
button.ForeColor = Color.White;
button.Font = new Font("Comic Sans MS", 7.8f, FontStyle.Bold);
button.BackColor = robBlue;
button.Location = new Point(button.Location.X + 1, button.Location.Y);
}
}
AestheticPanel2.BorderStyle = BorderStyle.FixedSingle;
AestheticDivider.BorderStyle = BorderStyle.None;
AestheticDivider.Size = new Size(AestheticDivider.Size.Width + 3, AestheticDivider.Size.Height);
} }
} }
@ -503,7 +477,7 @@ class CharacterCustomizationShared
public void ChangeColorOfPart(int ColorID) public void ChangeColorOfPart(int ColorID)
{ {
ChangeColorOfPart(ColorID, PartColorListConv.Find(x => x.ColorID == ColorID).ColorObject); ChangeColorOfPart(ColorID, GlobalVars.PartColorListConv.Find(x => x.ColorID == ColorID).ColorObject);
} }
public void ChangeColorOfPart(int ColorID, Color ButtonColor) public void ChangeColorOfPart(int ColorID, Color ButtonColor)
@ -562,12 +536,12 @@ class CharacterCustomizationShared
try try
{ {
ColorView.SelectedIndices.Clear(); ColorView.SelectedIndices.Clear();
ChangeColorOfPart("Head", head, PartColorListConv.Find(x => x.ColorID == head).ColorObject); ChangeColorOfPart("Head", head, GlobalVars.PartColorListConv.Find(x => x.ColorID == head).ColorObject);
ChangeColorOfPart("Torso", torso, PartColorListConv.Find(x => x.ColorID == torso).ColorObject); ChangeColorOfPart("Torso", torso, GlobalVars.PartColorListConv.Find(x => x.ColorID == torso).ColorObject);
ChangeColorOfPart("Left Arm", larm, PartColorListConv.Find(x => x.ColorID == larm).ColorObject); ChangeColorOfPart("Left Arm", larm, GlobalVars.PartColorListConv.Find(x => x.ColorID == larm).ColorObject);
ChangeColorOfPart("Right Arm", rarm, PartColorListConv.Find(x => x.ColorID == rarm).ColorObject); ChangeColorOfPart("Right Arm", rarm, GlobalVars.PartColorListConv.Find(x => x.ColorID == rarm).ColorObject);
ChangeColorOfPart("Left Leg", lleg, PartColorListConv.Find(x => x.ColorID == lleg).ColorObject); ChangeColorOfPart("Left Leg", lleg, GlobalVars.PartColorListConv.Find(x => x.ColorID == lleg).ColorObject);
ChangeColorOfPart("Right Leg", rleg, PartColorListConv.Find(x => x.ColorID == rleg).ColorObject); ChangeColorOfPart("Right Leg", rleg, GlobalVars.PartColorListConv.Find(x => x.ColorID == rleg).ColorObject);
} }
catch(Exception ex) catch(Exception ex)
{ {
@ -608,27 +582,27 @@ class CharacterCustomizationShared
for (int i = 1; i <= 6; i++) for (int i = 1; i <= 6; i++)
{ {
int RandomColor = rand.Next(PartColorListConv.Count); int RandomColor = rand.Next(GlobalVars.PartColorListConv.Count);
switch (i) switch (i)
{ {
case 1: case 1:
ChangeColorOfPart("Head", PartColorListConv[RandomColor].ColorID, PartColorListConv[RandomColor].ColorObject); ChangeColorOfPart("Head", GlobalVars.PartColorListConv[RandomColor].ColorID, GlobalVars.PartColorListConv[RandomColor].ColorObject);
break; break;
case 2: case 2:
ChangeColorOfPart("Torso", PartColorListConv[RandomColor].ColorID, PartColorListConv[RandomColor].ColorObject); ChangeColorOfPart("Torso", GlobalVars.PartColorListConv[RandomColor].ColorID, GlobalVars.PartColorListConv[RandomColor].ColorObject);
break; break;
case 3: case 3:
ChangeColorOfPart("Left Arm", PartColorListConv[RandomColor].ColorID, PartColorListConv[RandomColor].ColorObject); ChangeColorOfPart("Left Arm", GlobalVars.PartColorListConv[RandomColor].ColorID, GlobalVars.PartColorListConv[RandomColor].ColorObject);
break; break;
case 4: case 4:
ChangeColorOfPart("Right Arm", PartColorListConv[RandomColor].ColorID, PartColorListConv[RandomColor].ColorObject); ChangeColorOfPart("Right Arm", GlobalVars.PartColorListConv[RandomColor].ColorID, GlobalVars.PartColorListConv[RandomColor].ColorObject);
break; break;
case 5: case 5:
ChangeColorOfPart("Left Leg", PartColorListConv[RandomColor].ColorID, PartColorListConv[RandomColor].ColorObject); ChangeColorOfPart("Left Leg", GlobalVars.PartColorListConv[RandomColor].ColorID, GlobalVars.PartColorListConv[RandomColor].ColorObject);
break; break;
case 6: case 6:
ChangeColorOfPart("Right Leg", PartColorListConv[RandomColor].ColorID, PartColorListConv[RandomColor].ColorObject); ChangeColorOfPart("Right Leg", GlobalVars.PartColorListConv[RandomColor].ColorID, GlobalVars.PartColorListConv[RandomColor].ColorObject);
break; break;
default: default:
break; break;

View File

@ -245,6 +245,7 @@ partial class CharacterCustomizationCompact
this.listView1.HideSelection = false; this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(6, 15); this.listView1.Location = new System.Drawing.Point(6, 15);
this.listView1.Name = "listView1"; this.listView1.Name = "listView1";
this.listView1.MultiSelect = false;
this.listView1.Size = new System.Drawing.Size(271, 115); this.listView1.Size = new System.Drawing.Size(271, 115);
this.listView1.TabIndex = 0; this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.UseCompatibleStateImageBehavior = false;

View File

@ -17,7 +17,6 @@ public partial class CharacterCustomizationCompact : Form
{ {
InitializeComponent(); InitializeComponent();
InitCompactForm(); InitCompactForm();
characterCustomizationForm.closeOnLaunch = !characterCustomizationForm.InitColors();
} }
#endregion #endregion

View File

@ -208,6 +208,7 @@ partial class CharacterCustomizationExtended
// //
// panel1 // panel1
// //
this.panel1.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel1.Controls.Add(this.label9); this.panel1.Controls.Add(this.label9);
this.panel1.Controls.Add(this.button80); this.panel1.Controls.Add(this.button80);
@ -224,14 +225,16 @@ partial class CharacterCustomizationExtended
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(85, 302); this.panel1.Size = new System.Drawing.Size(85, 302);
this.panel1.TabIndex = 1; this.panel1.TabIndex = 1;
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
// //
// label9 // label9
// //
this.label9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.label9.Location = new System.Drawing.Point(3, 242); this.label9.Location = new System.Drawing.Point(3, 240);
this.label9.Name = "label9"; this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(75, 2); this.label9.Size = new System.Drawing.Size(75, 2);
this.label9.TabIndex = 14; this.label9.TabIndex = 14;
this.label9.Paint += new System.Windows.Forms.PaintEventHandler(this.label9_Paint);
// //
// button80 // button80
// //
@ -335,6 +338,7 @@ partial class CharacterCustomizationExtended
// //
// panel2 // panel2
// //
this.panel2.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel2.Controls.Add(this.tabControl1); this.panel2.Controls.Add(this.tabControl1);
this.panel2.Location = new System.Drawing.Point(93, 3); this.panel2.Location = new System.Drawing.Point(93, 3);
@ -406,6 +410,7 @@ partial class CharacterCustomizationExtended
// //
this.listView1.HideSelection = false; this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(6, 16); this.listView1.Location = new System.Drawing.Point(6, 16);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1"; this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(329, 137); this.listView1.Size = new System.Drawing.Size(329, 137);
this.listView1.TabIndex = 0; this.listView1.TabIndex = 0;
@ -1658,6 +1663,7 @@ partial class CharacterCustomizationExtended
characterCustomizationForm.OrganizationPanel = panel3; characterCustomizationForm.OrganizationPanel = panel3;
characterCustomizationForm.AestheticPanel1 = panel1; characterCustomizationForm.AestheticPanel1 = panel1;
characterCustomizationForm.AestheticPanel2 = panel2; characterCustomizationForm.AestheticPanel2 = panel2;
characterCustomizationForm.AestheticDivider = label9;
characterCustomizationForm.Hat1List = listBox1; characterCustomizationForm.Hat1List = listBox1;
characterCustomizationForm.Hat2List = listBox2; characterCustomizationForm.Hat2List = listBox2;

View File

@ -17,7 +17,6 @@ public partial class CharacterCustomizationExtended : Form
{ {
InitializeComponent(); InitializeComponent();
InitExtendedForm(); InitExtendedForm();
characterCustomizationForm.closeOnLaunch = !characterCustomizationForm.InitColors();
Size = new Size(671, 337); Size = new Size(671, 337);
panel2.Size = new Size(568, 302); panel2.Size = new Size(568, 302);
} }
@ -922,6 +921,23 @@ public partial class CharacterCustomizationExtended : Form
{ {
characterCustomizationForm.ColorButton(); characterCustomizationForm.ColorButton();
} }
private void label9_Paint(object sender, PaintEventArgs e)
{
if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish)
{
GlobalFuncs.DrawBorderSimple(e.Graphics, label9.DisplayRectangle, Color.White, ButtonBorderStyle.Solid, 1);
}
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish)
{
GlobalFuncs.DrawBorderSimple(e.Graphics, panel1.DisplayRectangle, Color.Black, ButtonBorderStyle.Solid, 1);
}
}
#endregion #endregion
} }
#endregion #endregion

View File

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACe ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACe
OAAAAk1TRnQBSQFMAgEBAwEAAWQBAQFkAQEBQAEAAUABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo OAAAAk1TRnQBSQFMAgEBAwEAAYQBAQGEAQEBQAEAAUABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
BAABAQIAAUADAAEBAQABCAYAAUAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA BAABAQIAAUADAAEBAQABCAYAAUAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -57,12 +57,15 @@ public class INIFile
255, this.path); 255, this.path);
return temp.ToString(); return temp.ToString();
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
IniWriteValue(Section, Key, DefaultValue);
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
IniWriteValue(Section, Key, DefaultValue);
return IniReadValue(Section, Key); return IniReadValue(Section, Key);
} }
} }

View File

@ -1,9 +1,12 @@
#region Usings #region Usings
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
#endregion #endregion
@ -16,6 +19,10 @@ public class PartColor
public string ColorRGB; public string ColorRGB;
[XmlIgnore] [XmlIgnore]
public Color ColorObject; public Color ColorObject;
[XmlIgnore]
public string ColorGroup;
[XmlIgnore]
public string ColorRawName;
} }
[XmlRoot("PartColors")] [XmlRoot("PartColors")]
@ -43,6 +50,21 @@ public class PartColorLoader
string colorFixed = Regex.Replace(colors.ColorList[i].ColorRGB, @"[\[\]\{\}\(\)\<\> ]", ""); string colorFixed = Regex.Replace(colors.ColorList[i].ColorRGB, @"[\[\]\{\}\(\)\<\> ]", "");
string[] rgbValues = colorFixed.Split(','); string[] rgbValues = colorFixed.Split(',');
colors.ColorList[i].ColorObject = Color.FromArgb(Convert.ToInt32(rgbValues[0]), Convert.ToInt32(rgbValues[1]), Convert.ToInt32(rgbValues[2])); colors.ColorList[i].ColorObject = Color.FromArgb(Convert.ToInt32(rgbValues[0]), Convert.ToInt32(rgbValues[1]), Convert.ToInt32(rgbValues[2]));
if (!(colors.ColorList[i].ColorName.Contains("[") && colors.ColorList[i].ColorName.Contains("]")))
{
colors.ColorList[i].ColorRawName = colors.ColorList[i].ColorName;
colors.ColorList[i].ColorName = "[Uncategorized]" + colors.ColorList[i].ColorName;
}
else
{
colors.ColorList[i].ColorRawName = colors.ColorList[i].ColorName;
}
int pFrom = colors.ColorList[i].ColorName.IndexOf("[");
int pTo = colors.ColorList[i].ColorName.IndexOf("]");
colors.ColorList[i].ColorGroup = colors.ColorList[i].ColorName.Substring(pFrom + 1, pTo - pFrom - 1);
colors.ColorList[i].ColorName = colors.ColorList[i].ColorName.Replace(colors.ColorList[i].ColorGroup, "").Replace("[", "").Replace("]", "");
} }
return colors.ColorList; return colors.ColorList;
@ -53,6 +75,64 @@ public class PartColorLoader
} }
} }
public static void AddPartColorsToListView(PartColor[] PartColorList, ListView ColorView, int imgsize, bool showIDs = false)
{
try
{
ImageList ColorImageList = new ImageList();
ColorImageList.ImageSize = new Size(imgsize, imgsize);
ColorImageList.ColorDepth = ColorDepth.Depth32Bit;
ColorView.LargeImageList = ColorImageList;
ColorView.SmallImageList = ColorImageList;
foreach (var item in PartColorList)
{
var lvi = new ListViewItem(item.ColorName);
lvi.Tag = item.ColorID;
if (showIDs)
{
lvi.Text = lvi.Text + " (" + item.ColorID + ")";
}
var group = ColorView.Groups.Cast<ListViewGroup>().FirstOrDefault(g => g.Header == item.ColorGroup);
if (group == null)
{
group = new ListViewGroup(item.ColorGroup);
ColorView.Groups.Add(group);
}
lvi.Group = group;
Bitmap Bmp = new Bitmap(imgsize, imgsize, PixelFormat.Format32bppArgb);
using (Graphics gfx = Graphics.FromImage(Bmp))
using (SolidBrush brush = new SolidBrush(item.ColorObject))
{
gfx.FillRectangle(brush, 0, 0, imgsize, imgsize);
}
ColorImageList.Images.Add(item.ColorName, Bmp);
lvi.ImageIndex = ColorImageList.Images.IndexOfKey(item.ColorName);
ColorView.Items.Add(lvi);
}
foreach (var group in ColorView.Groups.Cast<ListViewGroup>())
{
group.Header = group.Header + " (" + group.Items.Count + ")";
}
}
#if URI || LAUNCHER || CMD
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
#else
catch (Exception)
{
#endif
}
}
public static PartColor FindPartColorByName(PartColor[] colors, string query) public static PartColor FindPartColorByName(PartColor[] colors, string query)
{ {
if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName)) if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName))

View File

@ -29,7 +29,7 @@
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\SecurityFuncs.cs" /> <Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\SecurityFuncs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\VarStorage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\VarStorage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WinForms\FormExt.cs" /> <Compile Include="$(MSBuildThisFileDirectory)WinForms\FormExt.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WinForms\TabControlWithoutHeader.cs"> <Compile Include="$(MSBuildThisFileDirectory)WinForms\CustomFormControls.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
</ItemGroup> </ItemGroup>

View File

@ -103,10 +103,13 @@ public class GlobalFuncs
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
ReadInfoFile(infopath, other); ReadInfoFile(infopath, other);
} }
@ -254,15 +257,20 @@ public class GlobalFuncs
GlobalVars.UserConfiguration.Priority = (ProcessPriorityClass)Convert.ToInt32(priority); GlobalVars.UserConfiguration.Priority = (ProcessPriorityClass)Convert.ToInt32(priority);
GlobalVars.UserConfiguration.InitialBootup = Convert.ToBoolean(initialBootup); GlobalVars.UserConfiguration.InitialBootup = Convert.ToBoolean(initialBootup);
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
Config(cfgpath, true); Config(cfgpath, true);
} }
} }
GlobalVars.ColorsLoaded = InitColors();
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization)) if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization))
{ {
Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true); Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true);
@ -407,10 +415,13 @@ public class GlobalFuncs
GlobalVars.UserCustomization.ExtraSelectionIsHat = Convert.ToBoolean(extraishat); GlobalVars.UserCustomization.ExtraSelectionIsHat = Convert.ToBoolean(extraishat);
GlobalVars.UserCustomization.ShowHatsInExtra = Convert.ToBoolean(showhatsonextra); GlobalVars.UserCustomization.ShowHatsInExtra = Convert.ToBoolean(showhatsonextra);
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
Customization(cfgpath, true); Customization(cfgpath, true);
} }
@ -527,10 +538,13 @@ public class GlobalFuncs
break; break;
} }
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
ReShadeValues(cfgpath, true, setglobals); ReShadeValues(cfgpath, true, setglobals);
} }
@ -538,6 +552,75 @@ public class GlobalFuncs
} }
} }
public static bool InitColors()
{
try
{
if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName))
{
GlobalVars.PartColorList = PartColorLoader.GetPartColors();
GlobalVars.PartColorListConv = new List<PartColor>();
GlobalVars.PartColorListConv.AddRange(GlobalVars.PartColorList);
return true;
}
else
{
goto Failure;
}
}
#if URI || LAUNCHER || CMD
catch (Exception ex)
{
LogExceptions(ex);
#else
catch (Exception)
{
#endif
goto Failure;
}
Failure:
return false;
}
public static bool HasColorsChanged()
{
try
{
PartColor[] tempList;
if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName))
{
tempList = PartColorLoader.GetPartColors();
if (tempList.Length == GlobalVars.PartColorList.Length)
{
return true;
}
else
{
return false;
}
}
else
{
goto Failure;
}
}
#if URI || LAUNCHER || CMD
catch (Exception ex)
{
LogExceptions(ex);
#else
catch (Exception)
{
#endif
goto Failure;
}
Failure:
return false;
}
#if LAUNCHER #if LAUNCHER
public static void ReadClientValues(RichTextBox box, bool initial = false) public static void ReadClientValues(RichTextBox box, bool initial = false)
#else #else
@ -581,10 +664,13 @@ public class GlobalFuncs
ReadClientValues(name, initial); ReadClientValues(name, initial);
#endif #endif
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if LAUNCHER || CMD || URI
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
#if LAUNCHER #if LAUNCHER
@ -799,10 +885,13 @@ public class GlobalFuncs
image.SetPropertyItem(item); image.SetPropertyItem(item);
} }
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
if (!string.IsNullOrWhiteSpace(fallbackFileFullName)) if (!string.IsNullOrWhiteSpace(fallbackFileFullName))
image = LoadImage(fallbackFileFullName); image = LoadImage(fallbackFileFullName);
@ -830,10 +919,13 @@ public class GlobalFuncs
LoadClientValues(info, clientpath); LoadClientValues(info, clientpath);
return info; return info;
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if LAUNCHER || CMD || URI
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
return null; return null;
} }
@ -1338,10 +1430,13 @@ public class GlobalFuncs
} }
} }
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if LAUNCHER || CMD || URI
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
return; return;
} }
@ -1401,10 +1496,13 @@ public class GlobalFuncs
ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality, ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality,
AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, GFXQualityLevel, WindowResolution, FullscreenResolution, ModernResolution); AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, GFXQualityLevel, WindowResolution, FullscreenResolution, ModernResolution);
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if LAUNCHER || CMD || URI
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
return; return;
} }
@ -1437,10 +1535,13 @@ public class GlobalFuncs
fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile)); fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
doc = XDocument.Parse(fixedfile); doc = XDocument.Parse(fixedfile);
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
return; return;
} }
@ -1484,10 +1585,13 @@ public class GlobalFuncs
RobloxXML.EditRenderSettings(doc, "Resolution", ModernResolution.ToString(), XMLTypes.Token); RobloxXML.EditRenderSettings(doc, "Resolution", ModernResolution.ToString(), XMLTypes.Token);
} }
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
return; return;
} }
@ -1501,10 +1605,13 @@ public class GlobalFuncs
} }
} }
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
return; return;
} }
@ -2007,11 +2114,13 @@ public class GlobalFuncs
} }
} }
catch (Exception ex/* TODO: catch correct exception */)
{
// Swallow. Gulp!
#if URI || LAUNCHER || CMD #if URI || LAUNCHER || CMD
catch (Exception ex)
{
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
} }
} }
@ -2048,10 +2157,13 @@ public class GlobalFuncs
FixedFileMove(path, finalPath, File.Exists(finalPath)); FixedFileMove(path, finalPath, File.Exists(finalPath));
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if LAUNCHER || CMD || URI
LogExceptions(ex); LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
} }
} }
@ -2089,7 +2201,7 @@ public class GlobalFuncs
break; break;
case Settings.Style.Stylish: case Settings.Style.Stylish:
default: default:
CharacterCustomizationCompact ccustom3 = new CharacterCustomizationCompact(); CharacterCustomizationExtended ccustom3 = new CharacterCustomizationExtended();
ccustom3.Show(); ccustom3.Show();
break; break;
} }
@ -2113,11 +2225,21 @@ public class GlobalFuncs
} }
catch (Exception ex) catch (Exception ex)
{ {
#if LAUNCHER || CMD || URI #if URI || LAUNCHER || CMD
LogExceptions(ex); LogExceptions(ex);
#endif #endif
return "ERROR: " + ex.Message; return "ERROR: " + ex.Message;
} }
} }
public static void DrawBorderSimple(Graphics graphics, Rectangle bounds, Color color, ButtonBorderStyle style, int width)
{
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ControlPaint.DrawBorder(graphics, bounds,
color, width, style,
color, width, style,
color, width, style,
color, width, style);
}
} }
#endregion #endregion

View File

@ -7,6 +7,11 @@
* replace == and != with .equals * replace == and != with .equals
*/ */
#region Usings
using System.Collections.Generic;
using System.Windows.Forms;
#endregion
#region Global Variables #region Global Variables
public static class GlobalVars public static class GlobalVars
{ {
@ -28,6 +33,8 @@ public static class GlobalVars
public static FileFormat.Config UserConfiguration = new FileFormat.Config(); public static FileFormat.Config UserConfiguration = new FileFormat.Config();
public static FileFormat.ClientInfo SelectedClientInfo = new FileFormat.ClientInfo(); public static FileFormat.ClientInfo SelectedClientInfo = new FileFormat.ClientInfo();
public static FileFormat.CustomizationConfig UserCustomization = new FileFormat.CustomizationConfig(); public static FileFormat.CustomizationConfig UserCustomization = new FileFormat.CustomizationConfig();
public static PartColor[] PartColorList;
public static List<PartColor> PartColorListConv;
#endregion #endregion
#region Joining #region Joining
@ -52,6 +59,7 @@ public static class GlobalVars
public static bool ExtendedVersionNumber = false; public static bool ExtendedVersionNumber = false;
public static bool LocalPlayMode = false; public static bool LocalPlayMode = false;
public static bool AdminMode = false; public static bool AdminMode = false;
public static bool ColorsLoaded = false;
#endregion #endregion
#region Discord Variables #region Discord Variables

View File

@ -141,10 +141,13 @@ public class ScriptFuncs
string result = code.Substring(pFrom, pTo - pFrom); string result = code.Substring(pFrom, pTo - pFrom);
return result; return result;
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
return "%donothing%"; return "%donothing%";
} }
@ -253,10 +256,13 @@ public class ScriptFuncs
return source; return source;
} }
} }
#if URI || LAUNCHER || CMD
catch (Exception ex) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
return source; return source;
} }

View File

@ -259,10 +259,13 @@ public class SecurityFuncs
string[] a3 = a2.Split('<'); string[] a3 = a2.Split('<');
ipAddress = a3[0]; ipAddress = a3[0];
} }
catch (Exception ex)
{
#if URI || LAUNCHER || CMD #if URI || LAUNCHER || CMD
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
#else
catch (Exception)
{
#endif #endif
ipAddress = "localhost"; ipAddress = "localhost";
} }

View File

@ -1,5 +1,6 @@
#region Usings #region Usings
using System; using System;
using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
#endregion #endregion
@ -22,3 +23,5 @@ public partial class TabControlWithoutHeader : TabControl
} }
} }
#endregion #endregion

View File

@ -344,7 +344,7 @@ namespace NovetusLauncher
{ {
launcherForm.AddNewMap(); launcherForm.AddNewMap();
} }
#endregion #endregion
} }
#endregion #endregion
} }

View File

@ -107,17 +107,7 @@ namespace NovetusLauncher
void splashLabel_Paint(object sender, PaintEventArgs e) void splashLabel_Paint(object sender, PaintEventArgs e)
{ {
DrawBorderSimple(e.Graphics, splashLabel.DisplayRectangle, Color.White, ButtonBorderStyle.Solid, 1); GlobalFuncs.DrawBorderSimple(e.Graphics, splashLabel.DisplayRectangle, Color.White, ButtonBorderStyle.Solid, 1);
}
void DrawBorderSimple(Graphics graphics, Rectangle bounds, Color color, ButtonBorderStyle style, int width)
{
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ControlPaint.DrawBorder(graphics, bounds,
color, width, style,
color, width, style,
color, width, style,
color, width, style);
} }
public void ReadConfigValues(bool initial = false) public void ReadConfigValues(bool initial = false)

View File

@ -39,8 +39,9 @@ partial class ItemCreationSDKColorMenu
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.colorMenu.HideSelection = false; this.colorMenu.HideSelection = false;
this.colorMenu.Location = new System.Drawing.Point(12, 12); this.colorMenu.Location = new System.Drawing.Point(12, 12);
this.colorMenu.MultiSelect = false;
this.colorMenu.Name = "colorMenu"; this.colorMenu.Name = "colorMenu";
this.colorMenu.Size = new System.Drawing.Size(647, 385); this.colorMenu.Size = new System.Drawing.Size(666, 385);
this.colorMenu.TabIndex = 1; this.colorMenu.TabIndex = 1;
this.colorMenu.UseCompatibleStateImageBehavior = false; this.colorMenu.UseCompatibleStateImageBehavior = false;
this.colorMenu.SelectedIndexChanged += new System.EventHandler(this.colorMenu_SelectedIndexChanged); this.colorMenu.SelectedIndexChanged += new System.EventHandler(this.colorMenu_SelectedIndexChanged);
@ -54,7 +55,7 @@ partial class ItemCreationSDKColorMenu
this.Note.ForeColor = System.Drawing.Color.Red; this.Note.ForeColor = System.Drawing.Color.Red;
this.Note.Location = new System.Drawing.Point(21, 410); this.Note.Location = new System.Drawing.Point(21, 410);
this.Note.Name = "Note"; this.Note.Name = "Note";
this.Note.Size = new System.Drawing.Size(624, 13); this.Note.Size = new System.Drawing.Size(643, 13);
this.Note.TabIndex = 85; this.Note.TabIndex = 85;
this.Note.Text = "Select a color to use for your item! The window will close and automatically appl" + this.Note.Text = "Select a color to use for your item! The window will close and automatically appl" +
"y it."; "y it.";
@ -65,7 +66,7 @@ partial class ItemCreationSDKColorMenu
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLightLight; this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.ClientSize = new System.Drawing.Size(671, 432); this.ClientSize = new System.Drawing.Size(690, 432);
this.Controls.Add(this.Note); this.Controls.Add(this.Note);
this.Controls.Add(this.colorMenu); this.Controls.Add(this.colorMenu);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
#endregion #endregion
@ -12,9 +13,6 @@ public partial class ItemCreationSDKColorMenu : Form
{ {
#region Variables #region Variables
private ItemCreationSDK parent; private ItemCreationSDK parent;
private ImageList ColorImageList;
private PartColor[] PartColorList;
private List<PartColor> PartColorListConv;
public bool closeOnLaunch = false; public bool closeOnLaunch = false;
#endregion #endregion
@ -22,37 +20,8 @@ public partial class ItemCreationSDKColorMenu : Form
public ItemCreationSDKColorMenu(ItemCreationSDK par) public ItemCreationSDKColorMenu(ItemCreationSDK par)
{ {
InitializeComponent(); InitializeComponent();
InitColors();
closeOnLaunch = !InitColors();
parent = par; parent = par;
} }
public bool InitColors()
{
try
{
if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName))
{
PartColorList = PartColorLoader.GetPartColors();
PartColorListConv = new List<PartColor>();
PartColorListConv.AddRange(PartColorList);
return true;
}
else
{
goto Failure;
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
goto Failure;
}
Failure:
MessageBox.Show("The part colors cannot be loaded. The color menu will now close.", "Novetus - Cannot load part colors.", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
#endregion #endregion
#region Form Events #region Form Events
@ -78,36 +47,20 @@ public partial class ItemCreationSDKColorMenu : Form
private void ItemCreationSDKColorMenu_Load(object sender, EventArgs e) private void ItemCreationSDKColorMenu_Load(object sender, EventArgs e)
{ {
if (GlobalFuncs.HasColorsChanged())
{
GlobalVars.ColorsLoaded = GlobalFuncs.InitColors();
closeOnLaunch = !GlobalVars.ColorsLoaded;
}
if (closeOnLaunch) if (closeOnLaunch)
{ {
MessageBox.Show("The part colors cannot be loaded. The part colors menu will now close.", "Novetus - Cannot load part colors.", MessageBoxButtons.OK, MessageBoxIcon.Error);
Close(); Close();
return; return;
} }
int imgsize = 32; PartColorLoader.AddPartColorsToListView(GlobalVars.PartColorList, colorMenu, 32, true);
ColorImageList = new ImageList();
ColorImageList.ImageSize = new Size(imgsize, imgsize);
ColorImageList.ColorDepth = ColorDepth.Depth32Bit;
colorMenu.LargeImageList = ColorImageList;
colorMenu.SmallImageList = ColorImageList;
foreach (var item in PartColorList)
{
var lvi = new ListViewItem(item.ColorName);
lvi.Tag = item.ColorID;
Bitmap Bmp = new Bitmap(imgsize, imgsize, PixelFormat.Format32bppArgb);
using (Graphics gfx = Graphics.FromImage(Bmp))
using (SolidBrush brush = new SolidBrush(item.ColorObject))
{
gfx.FillRectangle(brush, 0, 0, imgsize, imgsize);
}
ColorImageList.Images.Add(item.ColorName, Bmp);
lvi.ImageIndex = ColorImageList.Images.IndexOfKey(item.ColorName);
colorMenu.Items.Add(lvi);
}
CenterToScreen(); CenterToScreen();
} }
#endregion #endregion

View File

@ -20,7 +20,7 @@ enum XMLContentType
public partial class XMLContentEditor : Form public partial class XMLContentEditor : Form
{ {
#region Private Variables #region Private Variables
public PartColor[] PartColorList; public PartColor[] XMLPartColorList;
public Provider[] contentProviders; public Provider[] contentProviders;
List<object> loaderList = new List<object>(); List<object> loaderList = new List<object>();
XMLContentType ListType; XMLContentType ListType;
@ -174,14 +174,14 @@ public partial class XMLContentEditor : Form
case XMLContentType.PartColors: case XMLContentType.PartColors:
if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName)) if (File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.PartColorXMLName))
{ {
PartColorList = PartColorLoader.GetPartColors(); XMLPartColorList = PartColorLoader.GetPartColors();
} }
else else
{ {
MessageBox.Show("Cannot load the Part Color list because the Part Color XML file does not exist.", "XML Content Editor - Part Color Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Cannot load the Part Color list because the Part Color XML file does not exist.", "XML Content Editor - Part Color Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
loaderList.AddRange(PartColorList); loaderList.AddRange(XMLPartColorList);
break; break;
default: default:
break; break;
@ -226,7 +226,7 @@ public partial class XMLContentEditor : Form
else if (obj is PartColor) else if (obj is PartColor)
{ {
PartColor pc = obj as PartColor; PartColor pc = obj as PartColor;
string[] partColorRow = new string[] { pc.ColorName, pc.ColorID.ToString(), pc.ColorRGB }; string[] partColorRow = new string[] { pc.ColorRawName, pc.ColorID.ToString(), pc.ColorRGB };
XMLView.Rows.Add(partColorRow); XMLView.Rows.Add(partColorRow);
} }
} }
@ -269,7 +269,7 @@ public partial class XMLContentEditor : Form
break; break;
case XMLContentType.PartColors: case XMLContentType.PartColors:
PartColor pc = new PartColor(); PartColor pc = new PartColor();
pc.ColorName = data.Cells[0].Value.ToString(); pc.ColorRawName = data.Cells[0].Value.ToString();
pc.ColorID = Convert.ToInt32(data.Cells[1].Value); pc.ColorID = Convert.ToInt32(data.Cells[1].Value);
pc.ColorRGB = data.Cells[2].Value.ToString(); pc.ColorRGB = data.Cells[2].Value.ToString();
partColorList.Add(pc); partColorList.Add(pc);