Skip to content

Commit

Permalink
Added 1.0.6 tiles and made version checking threaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkite committed Aug 10, 2011
1 parent 1c990a1 commit 8164bd2
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 39 deletions.
76 changes: 42 additions & 34 deletions Terrafirma/MainWindow.xaml.cs
Expand Up @@ -43,6 +43,7 @@
using System.Windows.Threading;
using System.Windows.Interop;
using System.Collections;
using System.Threading;

namespace Terrafirma
{
Expand Down Expand Up @@ -108,7 +109,7 @@ public partial class MainWindow : Window
double curX, curY, curScale;
byte[] bits;
WriteableBitmap mapbits;
DispatcherTimer resizeTimer,hiliteTimer;
DispatcherTimer resizeTimer;
int curWidth, curHeight, newWidth, newHeight;
bool loaded = false;
Tile[] tiles;
Expand Down Expand Up @@ -921,52 +922,59 @@ private void checkVersion()
Version newVersion = null;
string url = "";
XmlTextReader reader = null;
try
ThreadStart start = delegate()
{
reader = new XmlTextReader("http://seancode.com/terrafirma/version.xml");
reader.MoveToContent();
string elementName = "";
if (reader.NodeType == XmlNodeType.Element && reader.Name == "terrafirma")
try
{
while (reader.Read())
reader = new XmlTextReader("http://seancode.com/terrafirma/version.xml");
reader.MoveToContent();
string elementName = "";
if (reader.NodeType == XmlNodeType.Element && reader.Name == "terrafirma")
{
if (reader.NodeType == XmlNodeType.Element)
elementName = reader.Name;
else
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Text && reader.HasValue)
if (reader.NodeType == XmlNodeType.Element)
elementName = reader.Name;
else
{
switch (elementName)
if (reader.NodeType == XmlNodeType.Text && reader.HasValue)
{
case "version":
newVersion = new Version(reader.Value);
break;
case "url":
url = reader.Value;
break;
switch (elementName)
{
case "version":
newVersion = new Version(reader.Value);
break;
case "url":
url = reader.Value;
break;
}
}
}
}
}
}
}
catch (Exception)
{
}
finally
{
if (reader!=null)
reader.Close();
}
Version curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
if (newVersion!=null && curVersion.CompareTo(newVersion) < 0)
{
if (MessageBox.Show(this, "Download the new version?", "New version detected",
MessageBoxButton.YesNo, MessageBoxImage.Question)==MessageBoxResult.Yes)
catch (Exception)
{
System.Diagnostics.Process.Start(url);
}
}
finally
{
if (reader != null)
reader.Close();
}
Version curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
if (newVersion != null && curVersion.CompareTo(newVersion) < 0)
{
Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
{
if (MessageBox.Show(this, "Download the new version?", "New version detected",
MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
System.Diagnostics.Process.Start(url);
}
}));
}
};
new Thread(start).Start();
}
}
}
4 changes: 2 additions & 2 deletions Terrafirma/Properties/AssemblyInfo.cs
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.6.0")]
[assembly: AssemblyFileVersion("1.6.6.0")]
[assembly: AssemblyVersion("1.7.0.0")]
[assembly: AssemblyFileVersion("1.7.0.0")]
31 changes: 29 additions & 2 deletions Terrafirma/tiles.xml
Expand Up @@ -58,7 +58,7 @@
<tile num="55" name="Sign" color="#7F5C45" hasExtra="1" letLight="1" />
<tile num="56" name="Obsidian" color="#5751AD" blend="0" />
<tile num="57" name="Ash" color="#44444C" />
<tile num="58" name="Hellstone" color="#8E4242" light="0.6" blend="57"/>
<tile num="58" name="Hellstone" color="#8E4242" blend="57"/>
<tile num="59" name="Mud" color="#5C4449" blend="0" />
<tile num="60" name="Jungle Grass" color="#8FD71D" isGrass="1" blend="59" />
<tile num="61" name="Jungle Weeds" color="#63971F" hasExtra="1" letLight="1" />
Expand All @@ -76,7 +76,7 @@
<tile num="73" name="Weeds #73" color="#0D6524" hasExtra="1" letLight="1" />
<tile num="74" name="Weeds #74" color="#28650D" hasExtra="1" letLight="2" />
<tile num="75" name="Obsidian Brick" color="#665CC2" />
<tile num="76" name="Hellstone Brick" color="#8E4242" light="0.6" />
<tile num="76" name="Hellstone Brick" color="#8E4242" />
<tile num="77" name="Hellforge" color="#EE6646" hasExtra="1" light="0.8" />
<tile num="78" name="Clay Pot" color="#796E61" hasExtra="1" letLight="1" />
<tile num="79" name="Bed" color="#5C6298" hasExtra="1" letLight="1" />
Expand All @@ -86,6 +86,26 @@
<tile num="83" name="Herb stalks" color="#fe5402" hasExtra="1" letLight="1" />
<tile num="84" name="Herbs" color="#fe5402" hasExtra="1" letLight="1" />
<tile num="85" name="Tombstone" color="#c0c0c0" hasExtra="1" />
<tile num="86" name="Loom" color="#7F5C45" hasExtra="1" />
<tile num="87" name="Piano" color="#584430" hasExtra="1" />
<tile num="88" name="Dresser" color="#906850" hasExtra="1" />
<tile num="89" name="Bench" color="#B18567" hasExtra="1" />
<tile num="90" name="Bathtub" color="#606060" hasExtra="1" />
<tile num="91" name="Banner" color="#188008" hasExtra="1" />
<tile num="92" name="Lamp Post" color="#323232" hasExtra="1" light="1.0" />
<tile num="93" name="Tiki Torch" color="#503B2F" hasExtra="1" light="1.0" />
<tile num="94" name="Keg" color="#A87858" hasExtra="1" />
<tile num="95" name="Chinese Lantern" color="#F87800" hasExtra="1" light="1.0" />
<tile num="96" name="Cooking Pot" color="#606060" hasExtra="1" />
<tile num="97" name="Safe" color="#808080" hasExtra="1" />
<tile num="98" name="Skull Lantern" color="#B2B28A" hasExtra="1" />
<tile num="99" name="Trash Can" color="#808080" hasExtra="1" />
<tile num="100" name="Candelabra" color="#CCB548" hasExtra="1" light="1.0" />
<tile num="101" name="Bookcase" color="#B08460" hasExtra="1" />
<tile num="102" name="Throne" color="#780C08" hasExtra="1" />
<tile num="103" name="Bowl" color="#8D624D" hasExtra="1" />
<tile num="104" name="Grandfather Clock" color="#946B50" hasExtra="1" />
<tile num="105" name="Statue" color="#282828" hasExtra="1" />

<wall num="1" name="Stone Wall" color="#343434" />
<wall num="2" name="Dirt Wall" color="#583D2E" />
Expand All @@ -100,6 +120,13 @@
<wall num="11" name="Silver Brick Wall" color="#576162" />
<wall num="12" name="Copper Brick Wall" color="#4B200B" />
<wall num="13" name="Hellstone Brick Wall" color="#301515" />
<wall num="14" name="Obsidian Wall" color="#332F60" />
<wall num="15" name="Mud Wall" color="#31282B" />
<wall num="16" name="Dirt Wall" color="#583D2E" />
<wall num="17" name="Dark Blue Brick Wall" color="#2A2D48" />
<wall num="18" name="Dark Green Brick Wall" color="#4F4F43" />
<wall num="19" name="Dark Pink Brick Wall" color="#543E40" />
<wall num="20" name="Dark Obsidian Wall" color="#332F60" />
<global id="sky" color="#84AAF8" />
<global id="earth" color="#583D2E" />
<global id="rock" color="#4A433C" />
Expand Down
2 changes: 1 addition & 1 deletion terrafirma.wxs
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!-- Increase product version each release.. and that's the only change -->
<?define ProductVersion="1.6.5"?>
<?define ProductVersion="1.7.0"?>
<?define ProductUpgradeCode="77851f13-31d3-473a-8654-5b6325fc53ab"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Expand Down

0 comments on commit 8164bd2

Please sign in to comment.