important to test :)
This commit is contained in:
@@ -22,7 +22,7 @@ namespace SequenceEditor
|
|||||||
{
|
{
|
||||||
var shp = GetTextForm.GetString( "Add SHP...", "" );
|
var shp = GetTextForm.GetString( "Add SHP...", "" );
|
||||||
if (shp == null) return;
|
if (shp == null) return;
|
||||||
Program.Shps.Add(shp, Program.LoadAndResolve(shp));
|
Program.LoadAndResolve(shp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void toolStripButton2_Click(object sender, EventArgs e)
|
void toolStripButton2_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -17,12 +17,14 @@ namespace SequenceEditor
|
|||||||
public static Palette Pal;
|
public static Palette Pal;
|
||||||
public static Dictionary<string, Sequence> Sequences = new Dictionary<string, Sequence>();
|
public static Dictionary<string, Sequence> Sequences = new Dictionary<string, Sequence>();
|
||||||
|
|
||||||
public static Bitmap[] LoadAndResolve( string shp )
|
public static void LoadAndResolve( string shp )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (Shps.ContainsKey(shp)) return;
|
||||||
|
|
||||||
var reader = new ShpReader(FileSystem.OpenWithExts(shp, ".shp", ".tem", ".sno", ".int"));
|
var reader = new ShpReader(FileSystem.OpenWithExts(shp, ".shp", ".tem", ".sno", ".int"));
|
||||||
return reader.Select(ih =>
|
Shps[shp] = reader.Select(ih =>
|
||||||
{
|
{
|
||||||
var bmp = new Bitmap(reader.Width, reader.Height);
|
var bmp = new Bitmap(reader.Width, reader.Height);
|
||||||
for (var j = 0; j < bmp.Height; j++)
|
for (var j = 0; j < bmp.Height; j++)
|
||||||
@@ -31,10 +33,7 @@ namespace SequenceEditor
|
|||||||
return bmp;
|
return bmp;
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
}
|
}
|
||||||
catch
|
catch { }
|
||||||
{
|
|
||||||
return new Bitmap[] { };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Save()
|
public static void Save()
|
||||||
@@ -87,14 +86,15 @@ namespace SequenceEditor
|
|||||||
if (UnitName == null)
|
if (UnitName == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
LoadAndResolve(UnitName);
|
||||||
|
|
||||||
var xpath = string.Format("//unit[@name=\"{0}\"]/sequence", UnitName);
|
var xpath = string.Format("//unit[@name=\"{0}\"]/sequence", UnitName);
|
||||||
foreach (XmlElement e in Doc.SelectNodes(xpath))
|
foreach (XmlElement e in Doc.SelectNodes(xpath))
|
||||||
{
|
{
|
||||||
if (e.HasAttribute("src"))
|
if (e.HasAttribute("src"))
|
||||||
{
|
{
|
||||||
var src = e.GetAttribute("src");
|
var src = e.GetAttribute("src");
|
||||||
if (!Shps.ContainsKey(src))
|
LoadAndResolve(src);
|
||||||
Shps[src] = LoadAndResolve(src);
|
|
||||||
}
|
}
|
||||||
Sequences[e.GetAttribute("name")] = new Sequence(e);
|
Sequences[e.GetAttribute("name")] = new Sequence(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user