public bool ReadMapHeader(string h, mapTerrainMapHeader hdr)
        {
            string[] split, subsplit;

            Debug.Print("Converting Header:" + h);

            try
            {
                split = h.Split(',');
                if (split.Length != 5)
                {
                    throw new Exception("invalid header format:" + h);
                }

                //get grid dimensions
                hdr.Width  = Int32.Parse(split[0]);
                hdr.Height = Int32.Parse(split[1]);

                //get hex dimensions
                subsplit      = split[2].Split('x');
                hdr.HexHeight = Int32.Parse(subsplit[0]);
                hdr.HexWidth  = Int32.Parse(subsplit[1]);

                if (hdr.Height == 0 || hdr.Width == 0 || hdr.HexHeight == 0 || hdr.HexWidth == 0)
                {
                    Debug.Print("Header failed to read coords");
                    throw new Exception("Header failed to read coords");
                }

                subsplit         = split[3].Split(':');
                hdr.Id           = Int32.Parse(subsplit[1]);
                hdr.bTrueColumns = split[4].Contains(HEX_TRUE);

                int vloc = split[4].IndexOf(HEX_VERSION);
                if (vloc > 0)
                {
                    hdr.version = split[4].Substring(vloc + HEX_VERSION.Length, Math.Min(10, split[4].Length - (vloc + HEX_VERSION.Length)));
                }

                //srip out crap from URL;
                hdr.URL = split[4];
                if (hdr.version.Length > 0)
                {
                    hdr.URL = hdr.URL.Replace(hdr.version, "");
                    hdr.URL = hdr.URL.Replace(HEX_VERSION, "");
                }
                if (hdr.bTrueColumns)
                {
                    hdr.URL = hdr.URL.Replace(HEX_TRUE, "");
                }
                return(true);
            }
            catch (Exception e)
            {
                Debug.Print("Failed with exception" + e.ToString());
                return(false);
            }
        }
        public bool WriteMapHeader(out string h, mapTerrainMapHeader hdr)
        {
            string tmp;

            try
            {
                tmp = hdr.Width + "," + hdr.Height + "," + hdr.HexWidth + "x" + hdr.HexHeight;
                tmp = tmp + ",id:" + hdr.Id;
                if (hdr.bTrueColumns)
                {
                    tmp = tmp + HEX_TRUE;
                }
                tmp = tmp + " " + hdr.URL;
                h   = tmp;
                return(true);
            }
            catch (Exception e)
            {
                Debug.Print("Write Header hit Exception" + e.ToString());
                h = null;
                return(false);
            }
        }