diff --git a/Terrafirma/MainWindow.xaml.cs b/Terrafirma/MainWindow.xaml.cs
index 2e556eb..926a032 100644
--- a/Terrafirma/MainWindow.xaml.cs
+++ b/Terrafirma/MainWindow.xaml.cs
@@ -433,7 +433,7 @@ class NPC
///
/// Interaction logic for MainWindow.xaml
///
- public partial class MainWindow : Window
+ public partial class MainWindow : Window, IDisposable
{
const int MapVersion = 71;
const int MaxTile = 250;
@@ -456,9 +456,9 @@ public partial class MainWindow : Window
Int32 groundLevel, rockLevel;
string[] worlds;
string currentWorld;
- Int32 worldID=0;
- string[] players;
- string player;
+ Int32 worldID = 0;
+ string[] players;
+ string player;
List chests = new List();
List signs = new List();
List npcs = new List();
@@ -579,10 +579,10 @@ public MainWindow()
int id = Convert.ToInt32(wallList[i].Attributes["num"].Value);
wallInfo[id].name = wallList[i].Attributes["name"].Value;
wallInfo[id].color = parseColor(wallList[i].Attributes["color"].Value);
- if (wallList[i].Attributes["blend"] != null)
- wallInfo[id].blend = Convert.ToInt16(wallList[i].Attributes["blend"].Value);
- else
- wallInfo[id].blend = (Int16)id;
+ if (wallList[i].Attributes["blend"] != null)
+ wallInfo[id].blend = Convert.ToInt16(wallList[i].Attributes["blend"].Value);
+ else
+ wallInfo[id].blend = (Int16)id;
}
XmlNodeList globalList = xml.GetElementsByTagName("global");
for (int i = 0; i < globalList.Count; i++)
@@ -698,7 +698,7 @@ private void addVariants(ArrayList quickItems, TileInfo info)
if (v.name != info.name)
{
v.isHilighting = true;
- quickItems.Add(new HTile(v.name,v));
+ quickItems.Add(new HTile(v.name, v));
}
addVariants(quickItems, v);
}
@@ -1756,13 +1756,13 @@ private void SelectPlayer(object sender, ExecutedRoutedEventArgs e)
RenderMap();
}));
- };
- new Thread(loader).Start();
- }
- private void SelectPlayer_CanExecute(object sender, CanExecuteRoutedEventArgs e)
- {
- e.CanExecute = !busy;
- }
+ };
+ new Thread(loader).Start();
+ }
+ private void SelectPlayer_CanExecute(object sender, CanExecuteRoutedEventArgs e)
+ {
+ e.CanExecute = !busy;
+ }
private void FogOfWar_Toggle(object sender, ExecutedRoutedEventArgs e)
{
if (FogOfWar.IsChecked)
@@ -1842,6 +1842,7 @@ private void ConnectToServer_Executed(object sender, ExecutedRoutedEventArgs e)
}
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ _disposed = false;
System.Net.IPAddress[] ips;
try
{
@@ -2066,7 +2067,7 @@ private void HandleMessage(int start, int len)
killedBoss3 = (flags & 8) == 8;
hardMode = (flags & 16) == 16;
killedClown = (flags & 32) == 32;
- killedPlantBoss = (flags & 128) == 128;
+ killedPlantBoss = (flags & 128) == 128;
killedMechBoss1 = (flags2 & 1) == 1;
killedMechBoss2 = (flags2 & 2) == 2;
killedMechBoss3 = (flags2 & 4) == 4;
@@ -2270,14 +2271,14 @@ private void HandleMessage(int start, int len)
int slot = BitConverter.ToInt16(messages, payload); payload += 2;
float posx = BitConverter.ToSingle(messages, payload); payload += 4;
float posy = BitConverter.ToSingle(messages, payload); payload += 4;
- payload += 9; //skip velocity and target
- byte flags=messages[payload++];
- payload+=4; //skip life
- //skip any applicable AI
- if ((flags&32)==32) payload+=4;
- if ((flags&16)==16) payload+=4;
- if ((flags&8)==8) payload+=4;
- if ((flags&4)==4) payload+=4;
+ payload += 9; //skip velocity and target
+ byte flags = messages[payload++];
+ payload += 4; //skip life
+ //skip any applicable AI
+ if ((flags & 32) == 32) payload += 4;
+ if ((flags & 16) == 16) payload += 4;
+ if ((flags & 8) == 8) payload += 4;
+ if ((flags & 4) == 4) payload += 4;
int id = BitConverter.ToInt16(messages, payload);
bool found = false;
for (int i = 0; i < npcs.Count; i++)
@@ -2382,7 +2383,7 @@ private void HandleMessage(int start, int len)
Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
{
serverText.Text = "";
- render.SetWorld(tilesWide, tilesHigh, groundLevel, rockLevel, styles, treeX, treeStyle, caveBackX,caveBackStyle,jungleBackStyle,hellBackStyle, npcs);
+ render.SetWorld(tilesWide, tilesHigh, groundLevel, rockLevel, styles, treeX, treeStyle, caveBackX, caveBackStyle, jungleBackStyle, hellBackStyle, npcs);
loaded = true;
curX = spawnX;
curY = spawnY;
@@ -3011,7 +3012,7 @@ private void QuickHilite_SelectionChanged(object sender, SelectionChangedEventAr
{
foreach (object obj in QuickHilite.Items)
{
- HTile info=(HTile)obj;
+ HTile info = (HTile)obj;
info.Info.isHilighting = false;
}
HTile tile = (HTile)QuickHilite.SelectedItem;
@@ -3019,7 +3020,7 @@ private void QuickHilite_SelectionChanged(object sender, SelectionChangedEventAr
if (loaded)
RenderMap();
}
-
+
private void Lighting_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch (Lighting.SelectedIndex)
@@ -3044,5 +3045,27 @@ private void Lighting_SelectionChanged(object sender, SelectionChangedEventArgs
if (loaded)
RenderMap();
}
+ public void Dispose()
+ {
+ Dispose(true);
+
+ // Use SupressFinalize in case a subclass
+ // of this type implements a finalizer.
+ GC.SuppressFinalize(this);
+ }
+ private bool _disposed;
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposed)
+ {
+ if (disposing)
+ {
+ if (socket != null)
+ socket.Dispose();
+ }
+ socket = null;
+ _disposed = true;
+ }
+ }
}
}
diff --git a/Terrafirma/Terrafirma.csproj b/Terrafirma/Terrafirma.csproj
index a09579f..8176de6 100644
--- a/Terrafirma/Terrafirma.csproj
+++ b/Terrafirma/Terrafirma.csproj
@@ -15,6 +15,7 @@
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
4
+ false
publish\
true
Disk
@@ -27,7 +28,6 @@
true
0
1.0.0.%2a
- false
false
true
diff --git a/makeinstaller.bat b/makeinstaller.bat
index d92e2c3..0560031 100644
--- a/makeinstaller.bat
+++ b/makeinstaller.bat
@@ -1,5 +1,4 @@
-"c:\Program Files (x86)\Windows Installer XML v3.5\bin\candle.exe" MyInstallDirDlg.wxs
"c:\Program Files (x86)\Windows Installer XML v3.5\bin\candle.exe" MyWixUI_InstallDir.wxs
"c:\Program Files (x86)\Windows Installer XML v3.5\bin\candle.exe" terrafirma.wxs
-"c:\Program Files (x86)\Windows Installer XML v3.5\bin\light.exe" -ext WixUIExtension -o terrafirma.msi terrafirma.wixobj MyInstallDirDlg.wixobj MyWixUI_InstallDir.wixobj
+"c:\Program Files (x86)\Windows Installer XML v3.5\bin\light.exe" -ext WixUIExtension -o terrafirma.msi terrafirma.wixobj MyWixUI_InstallDir.wixobj
@pause
\ No newline at end of file
diff --git a/terrafirma.wxs b/terrafirma.wxs
index ba91a3f..faffeb8 100644
--- a/terrafirma.wxs
+++ b/terrafirma.wxs
@@ -1,6 +1,6 @@
-
+
@@ -31,15 +31,12 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -49,7 +46,6 @@
-
INSTALLDIR