diff --git a/ImageDecode/Format40.cs b/ImageDecode/Format40.cs
new file mode 100644
index 0000000000..3e6d6736f9
--- /dev/null
+++ b/ImageDecode/Format40.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+
+namespace ImageDecode
+{
+ public static class Format40
+ {
+ static byte ReadByte( MemoryStream input )
+ {
+ int inp = input.ReadByte();
+ if( inp == -1 )
+ throw new InvalidDataException();
+
+ return (byte)inp;
+ }
+
+ static int ReadWord( MemoryStream input )
+ {
+ int inp = ReadByte( input );
+ return inp + ( ReadByte( input ) << 8 );
+ }
+
+ //static void ReplicatePrevious( byte[] dest, int destIndex, int srcIndex, int count )
+ //{
+ // for( int i = 0 ; i < Math.Min( count, destIndex - srcIndex ) ; i++ )
+ // dest[ destIndex + i ] = dest[ srcIndex + i ];
+
+ // if( srcIndex + count <= destIndex )
+ // return;
+
+ // for( int i = destIndex + destIndex - srcIndex ; i < destIndex + count ; i++ )
+ // dest[ i ] = dest[ destIndex - 1 ];
+ //}
+
+ public static int DecodeInto( MemoryStream input, byte[] dest )
+ {
+ int destIndex = 0;
+ while( true )
+ {
+ byte i = ReadByte( input );
+ if( ( i & 0x80 ) == 0 )
+ {
+ int count = i & 0x7F;
+ if( count == 0 )
+ {
+ // case 6
+ count = ReadByte( input );
+ byte value = ReadByte( input );
+ for( int end = destIndex + count ; destIndex < end ; destIndex++ )
+ dest[ destIndex ] ^= value;
+ }
+ else
+ {
+ // case 5
+ for( int end = destIndex + count ; destIndex < end ; destIndex++ )
+ dest[ destIndex ] ^= ReadByte( input );
+ }
+ }
+ else
+ {
+ int count = i & 0x7F;
+ if( count == 0 )
+ {
+ count = ReadWord( input );
+ if( count == 0 )
+ return destIndex;
+
+ if( ( count & 0x8000 ) == 0 )
+ {
+ // case 2
+ destIndex += ( count & 0x7FFF );
+ }
+ else if( ( count & 0x4000 ) == 0 )
+ {
+ // case 3
+ for( int end = destIndex + ( count & 0x3FFF ) ; destIndex < end ; destIndex++ )
+ dest[ destIndex ] ^= ReadByte( input );
+ }
+ else
+ {
+ // case 4
+ byte value = ReadByte( input );
+ for( int end = destIndex + ( count & 0x3FFF ) ; destIndex < end ; destIndex++ )
+ dest[ destIndex ] ^= value;
+ }
+ }
+ else
+ {
+ // case 1
+ destIndex += count;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ImageDecode/Format80.cs b/ImageDecode/Format80.cs
new file mode 100644
index 0000000000..17ec8d2fab
--- /dev/null
+++ b/ImageDecode/Format80.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+
+namespace ImageDecode
+{
+ public static class Format80
+ {
+ static byte ReadByte( MemoryStream input )
+ {
+ int inp = input.ReadByte();
+ if( inp == -1 )
+ throw new InvalidDataException();
+
+ return (byte)inp;
+ }
+
+ static int ReadWord( MemoryStream input )
+ {
+ int inp = ReadByte( input );
+ return inp + ( ReadByte( input ) << 8 );
+ }
+
+ static void ReplicatePrevious( byte[] dest, int destIndex, int srcIndex, int count )
+ {
+ if( srcIndex >= destIndex )
+ throw new NotImplementedException( string.Format( "srcIndex >= destIndex {0} {1}", srcIndex, destIndex ) );
+
+ for( int i = 0 ; i < Math.Min( count, destIndex - srcIndex ) ; i++ )
+ dest[ destIndex + i ] = dest[ srcIndex + i ];
+
+ if( srcIndex + count <= destIndex )
+ return;
+
+ for( int i = destIndex + destIndex - srcIndex ; i < destIndex + count ; i++ )
+ dest[ i ] = dest[ destIndex - 1 ];
+ }
+
+ public static int DecodeInto( MemoryStream input, byte[] dest )
+ {
+ int destIndex = 0;
+ while( true )
+ {
+ byte i = ReadByte( input );
+ if( ( i & 0x80 ) == 0 )
+ {
+ // case 2
+ byte secondByte = ReadByte( input );
+ int count = ( ( i & 0x70 ) >> 4 ) + 3;
+ int rpos = ( ( i & 0xf ) << 8 ) + secondByte;
+
+ ReplicatePrevious( dest, destIndex, destIndex - rpos, count );
+ destIndex += count;
+ }
+ else if( ( i & 0x40 ) == 0 )
+ {
+ // case 1
+ int count = i & 0x3F;
+ if( count == 0 )
+ return destIndex;
+
+ input.Read( dest, destIndex, count );
+ destIndex += count;
+ }
+ else
+ {
+ int count3 = i & 0x3F;
+ if( count3 == 0x3E )
+ {
+ // case 4
+ int count = ReadWord( input );
+ byte color = ReadByte( input );
+
+ for( int end = destIndex + count ; destIndex < end ; destIndex++ )
+ dest[ destIndex ] = color;
+ }
+ else if( count3 == 0x3F )
+ {
+ // case 5
+ int count = ReadWord( input );
+ int srcIndex = ReadWord( input );
+ if( srcIndex >= destIndex )
+ throw new NotImplementedException( string.Format( "srcIndex >= destIndex {0} {1}", srcIndex, destIndex ) );
+
+ for( int end = destIndex + count ; destIndex < end ; destIndex++ )
+ dest[ destIndex ] = dest[ srcIndex++ ];
+ }
+ else
+ {
+ // case 3
+ int count = count3 + 3;
+ int srcIndex = ReadWord( input );
+ if( srcIndex >= destIndex )
+ throw new NotImplementedException( string.Format( "srcIndex >= destIndex {0} {1}", srcIndex, destIndex ) );
+
+ for( int end = destIndex + count ; destIndex < end ; destIndex++ )
+ dest[ destIndex ] = dest[ srcIndex++ ];
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ImageDecode/ImageDecode.csproj b/ImageDecode/ImageDecode.csproj
new file mode 100644
index 0000000000..f297956fa4
--- /dev/null
+++ b/ImageDecode/ImageDecode.csproj
@@ -0,0 +1,55 @@
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {39352FD2-28B0-4DF5-97C7-499CE1AECCB9}
+ Exe
+ Properties
+ ImageDecode
+ ImageDecode
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageDecode/Program.cs b/ImageDecode/Program.cs
new file mode 100644
index 0000000000..50ad4ba1d2
--- /dev/null
+++ b/ImageDecode/Program.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Drawing;
+
+namespace ImageDecode
+{
+ public static class Program
+ {
+ [STAThread]
+ public static void Main()
+ {
+ ShpReader.Read( File.OpenRead( "stek.shp" ) );
+ }
+ }
+}
diff --git a/ImageDecode/Properties/AssemblyInfo.cs b/ImageDecode/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..59ee034e96
--- /dev/null
+++ b/ImageDecode/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle( "ImageDecode" )]
+[assembly: AssemblyDescription( "" )]
+[assembly: AssemblyConfiguration( "" )]
+[assembly: AssemblyCompany( "" )]
+[assembly: AssemblyProduct( "ImageDecode" )]
+[assembly: AssemblyCopyright( "Copyright © 2007" )]
+[assembly: AssemblyTrademark( "" )]
+[assembly: AssemblyCulture( "" )]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible( false )]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid( "f236056f-1b46-4a95-9d44-e2c77a9e91c0" )]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion( "1.0.0.0" )]
+[assembly: AssemblyFileVersion( "1.0.0.0" )]
diff --git a/ImageDecode/ShpReader.cs b/ImageDecode/ShpReader.cs
new file mode 100644
index 0000000000..dbe651d95b
--- /dev/null
+++ b/ImageDecode/ShpReader.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+using System.IO;
+
+namespace ImageDecode
+{
+ public class ImageHeader
+ {
+ public uint Offset;
+ public Format Format;
+ public uint RefOffset;
+ public Format RefFormat;
+ public byte[] Image;
+
+ public ImageHeader( BinaryReader reader )
+ {
+ Offset = reader.ReadUInt32();
+ Format = (Format)( Offset >> 24 );
+ Offset &= 0xFFFFFF;
+
+ RefOffset = reader.ReadUInt16();
+ RefFormat = (Format)reader.ReadUInt16();
+ }
+ }
+
+ public enum Format
+ {
+ Format20 = 0x20,
+ Format40 = 0x40,
+ Format80 = 0x80,
+ }
+
+ public static class ShpReader
+ {
+ public static IEnumerable Read( Stream stream )
+ {
+ BinaryReader reader = new BinaryReader( stream );
+
+ ushort numImages = reader.ReadUInt16();
+ reader.ReadUInt16();
+ reader.ReadUInt16();
+ ushort width = reader.ReadUInt16();
+ ushort height = reader.ReadUInt16();
+ reader.ReadUInt32();
+
+ List headers = new List();
+ for( int i = 0 ; i < numImages ; i++ )
+ headers.Add( new ImageHeader( reader ) );
+
+ new ImageHeader( reader ); // end-of-file header
+ new ImageHeader( reader ); // all-zeroes header
+
+ foreach( ImageHeader h in headers )
+ {
+ reader.BaseStream.Position = h.Offset;
+ switch( h.Format )
+ {
+ case Format.Format20:
+ //throw new NotImplementedException();
+ break;
+ case Format.Format40:
+ //throw new NotImplementedException();
+ break;
+ case Format.Format80:
+ {
+ byte[] compressedBytes = reader.ReadBytes( (int)( reader.BaseStream.Length - reader.BaseStream.Position ) );
+ MemoryStream ms = new MemoryStream( compressedBytes );
+ byte[] imageBytes = new byte[ width * height ];
+ Format80.DecodeInto( ms, imageBytes );
+ h.Image = imageBytes;
+ break;
+ }
+ default:
+ throw new InvalidDataException();
+ }
+
+ if( h.Image != null )
+ yield return h.Image;
+ }
+ }
+ }
+}
diff --git a/MixBrowser/MixBrowser.csproj b/MixBrowser/MixBrowser.csproj
index 4bad552aca..d8dfbb520d 100644
--- a/MixBrowser/MixBrowser.csproj
+++ b/MixBrowser/MixBrowser.csproj
@@ -29,6 +29,10 @@
4
+
+ False
+ ..\debug\MixDecrypt.dll
+
@@ -41,12 +45,6 @@
-
-
- {6F5D4280-3D23-41FF-AE2A-511B5553E377}
- MixDecrypt
-
-