bobster
12-19-2007, 04:04 AM
Great work, Seaxouri !
Very enjoyable version so far.
I have but one issue, and that is the same I brought up last time I looked at the 1.20 client.. For us Non-US users, we still need the Numformat reference in the mapreader class. Otherwise the map won't draw.
mapreader.cs :
using System.Globalization;
public static class MapReader
{
private static Settings Settings = Settings.GetSingleton();
public static MapFileLine WorkingLine = new MapFileLine();
public static MapFileLabel WorkingLabel = new MapFileLabel();
public static MapFileLineType ParseLine(string line)
{
IFormatProvider NumFormat = new CultureInfo("en-US");
string [] tokens;
int r, g, b;
if (line == null)
return MapFileLineType.MLT_EOF;
if (line.Length == 0)
return MapFileLineType.MLT_EMPTY;
if (line.Length < 10)
return MapFileLineType.MLT_INVALID;
try
{
tokens = line.Remove(0,1).Split(',');
switch (line[0])
{
// Line parsing
case 'L':
WorkingLine.from.x = (int)float.Parse(tokens[0], NumFormat);
WorkingLine.from.y = (int)float.Parse(tokens[1], NumFormat);
WorkingLine.from.z = (int)float.Parse(tokens[2], NumFormat);
WorkingLine.to.x = (int)float.Parse(tokens[3], NumFormat);
WorkingLine.to.y = (int)float.Parse(tokens[4], NumFormat);
WorkingLine.to.z = (int)float.Parse(tokens[5], NumFormat);
r = int.Parse(tokens[6]);
g = int.Parse(tokens[7]);
b = int.Parse(tokens[8]);
if (Settings.forceBlack)
{
WorkingLine.pen = Pens.Black;
}
else
{
WorkingLine.pen = ColorManager.FindNearestSystemPen(Color.FromArgb(r , g, b));
if (WorkingLine.pen.Color == Pens.DarkGray.Color)
WorkingLine.pen = Pens.Black;
}
return MapFileLineType.MLT_LINE;
// Label parsing
case 'P':
WorkingLabel.at.x = (int)float.Parse(tokens[0], NumFormat);
WorkingLabel.at.y = (int)float.Parse(tokens[1], NumFormat);
WorkingLabel.at.z = (int)float.Parse(tokens[2], NumFormat);
r = int.Parse(tokens[3]);
g = int.Parse(tokens[4]);
b = int.Parse(tokens[5]);
if (Settings.forceBlack)
WorkingLabel.brush = (SolidBrush) Brushes.Black;
else
WorkingLabel.brush = ColorManager.FindNearestSystemBrush(Color.FromArgb (r, g, b));
WorkingLabel.fontSize = Math.Max(0,Math.Min(int.Parse(tokens[6]), 3));
WorkingLabel.text = tokens[7];
return MapFileLineType.MLT_LABEL;
// Anything else is invalid
default:
return MapFileLineType.MLT_INVALID;
}
}
catch (Exception ex)
{
Logger.Debug("MapReader:ParseLine - " + ex.Message);
return MapFileLineType.MLT_INVALID;
}
}
In order to build "on your own", you need to remove the "clickonce" manifest signing under project properties.
Also, solution looks for structures.cs, which does not exist so we need to delete/remove that from project reference list.
I can live with it. ;)
Bobster
Very enjoyable version so far.
I have but one issue, and that is the same I brought up last time I looked at the 1.20 client.. For us Non-US users, we still need the Numformat reference in the mapreader class. Otherwise the map won't draw.
mapreader.cs :
using System.Globalization;
public static class MapReader
{
private static Settings Settings = Settings.GetSingleton();
public static MapFileLine WorkingLine = new MapFileLine();
public static MapFileLabel WorkingLabel = new MapFileLabel();
public static MapFileLineType ParseLine(string line)
{
IFormatProvider NumFormat = new CultureInfo("en-US");
string [] tokens;
int r, g, b;
if (line == null)
return MapFileLineType.MLT_EOF;
if (line.Length == 0)
return MapFileLineType.MLT_EMPTY;
if (line.Length < 10)
return MapFileLineType.MLT_INVALID;
try
{
tokens = line.Remove(0,1).Split(',');
switch (line[0])
{
// Line parsing
case 'L':
WorkingLine.from.x = (int)float.Parse(tokens[0], NumFormat);
WorkingLine.from.y = (int)float.Parse(tokens[1], NumFormat);
WorkingLine.from.z = (int)float.Parse(tokens[2], NumFormat);
WorkingLine.to.x = (int)float.Parse(tokens[3], NumFormat);
WorkingLine.to.y = (int)float.Parse(tokens[4], NumFormat);
WorkingLine.to.z = (int)float.Parse(tokens[5], NumFormat);
r = int.Parse(tokens[6]);
g = int.Parse(tokens[7]);
b = int.Parse(tokens[8]);
if (Settings.forceBlack)
{
WorkingLine.pen = Pens.Black;
}
else
{
WorkingLine.pen = ColorManager.FindNearestSystemPen(Color.FromArgb(r , g, b));
if (WorkingLine.pen.Color == Pens.DarkGray.Color)
WorkingLine.pen = Pens.Black;
}
return MapFileLineType.MLT_LINE;
// Label parsing
case 'P':
WorkingLabel.at.x = (int)float.Parse(tokens[0], NumFormat);
WorkingLabel.at.y = (int)float.Parse(tokens[1], NumFormat);
WorkingLabel.at.z = (int)float.Parse(tokens[2], NumFormat);
r = int.Parse(tokens[3]);
g = int.Parse(tokens[4]);
b = int.Parse(tokens[5]);
if (Settings.forceBlack)
WorkingLabel.brush = (SolidBrush) Brushes.Black;
else
WorkingLabel.brush = ColorManager.FindNearestSystemBrush(Color.FromArgb (r, g, b));
WorkingLabel.fontSize = Math.Max(0,Math.Min(int.Parse(tokens[6]), 3));
WorkingLabel.text = tokens[7];
return MapFileLineType.MLT_LABEL;
// Anything else is invalid
default:
return MapFileLineType.MLT_INVALID;
}
}
catch (Exception ex)
{
Logger.Debug("MapReader:ParseLine - " + ex.Message);
return MapFileLineType.MLT_INVALID;
}
}
In order to build "on your own", you need to remove the "clickonce" manifest signing under project properties.
Also, solution looks for structures.cs, which does not exist so we need to delete/remove that from project reference list.
I can live with it. ;)
Bobster