public void Run()
        {
            // Read in the existing map data from the ObjectDataCreator tool
            string      json = File.ReadAllText(mapFile);
            AticAtacMap map  = JsonConvert.DeserializeObject <AticAtacMap>(json);

            // Create a dictionary to make things a little smoother
            Dictionary <int, AticAtacScreen> screens = new Dictionary <int, AticAtacScreen>();

            foreach (var screen in map.screens)
            {
                screens.Add(screen.screenId, screen);
            }

            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter w = new BinaryWriter(ms))
                {
                    using (Stream s = File.OpenRead(shapeFile))
                    {
                        using (TextReader r = new StreamReader(s))
                        {
                            string line = "";
                            while ((line = r.ReadLine()) != null)
                            {
                                string[] rawBytes = line.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                                byte[]   item     = new byte[rawBytes.Length];

                                for (int i = 0; i < rawBytes.Length; i++)
                                {
                                    string temp = rawBytes[i].Substring(0, 3);
                                    item[i] = Convert.ToByte(temp, 16);
                                }

                                w.Write(item);
                            }
                        }
                    }

                    // Go back to the start of the memory stream
                    ms.Seek(0, SeekOrigin.Begin);

                    for (int i = 0; i < 149; i++)
                    {
                        int colour = ms.ReadByte();
                        int shape  = ms.ReadByte();

                        colour = colour & 7;
                        switch (colour)
                        {
                        case 0:
                            screens[i].colour = new RoomColour(0, 0, 0);
                            break;

                        case 1:
                            screens[i].colour = new RoomColour(0, 0, 0.85f);
                            break;

                        case 2:
                            screens[i].colour = new RoomColour(0.85f, 0, 0);
                            break;

                        case 3:
                            screens[i].colour = new RoomColour(0.85f, 0, 0.85f);
                            break;

                        case 4:
                            screens[i].colour = new RoomColour(0, 0.85f, 0);
                            break;

                        case 5:
                            screens[i].colour = new RoomColour(0, 0.85f, 0.85f);
                            break;

                        case 6:
                            screens[i].colour = new RoomColour(0.85f, 0.85f, 0);
                            break;

                        case 7:
                            screens[i].colour = new RoomColour(0, 0, 0);
                            break;
                        }

                        screens[i].screenShape = shape;
                    }
                }
            }

            string outJson = JsonConvert.SerializeObject(map);

            File.WriteAllText("completemap.txt", outJson);
        }
        internal void Run()
        {
            List <BackgroundItem> items = new List <BackgroundItem>();

            using (Stream s = File.OpenRead(path))
            {
                using (TextReader r = new StreamReader(s))
                {
                    string line  = "";
                    int    index = 0;
                    while ((line = r.ReadLine()) != null)
                    {
                        byte[]   item     = new byte[8];
                        string[] rawBytes = line.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                        for (int i = 0; i < 8; i++)
                        {
                            string temp = rawBytes[i].Substring(0, 3);
                            item[i] = Convert.ToByte(temp, 16);
                        }

                        items.Add(new BackgroundItem(index++, item));
                    }
                }
            }

            // Link the items in the list depending on their even/odd state
            for (int i = 0; i < items.Count; i++)
            {
                if (IsDoor(items[i]))
                {
                    if (i == 0 || i % 2 == 0)
                    {
                        // It's even
                        items[i].LinkedId = i + 1;
                    }
                    else
                    {
                        // it's odd!
                        items[i].LinkedId = i - 1;
                    }
                }
            }

            items.Sort(
                (item1, item2)
                => item1.Screen.CompareTo(item2.Screen));

            AticAtacMap map = new AticAtacMap()
            {
                screens = new List <AticAtacScreen>()
            };
            AticAtacScreen current = null;

            foreach (var item in items)
            {
                if (current == null || current.screenId != item.Screen)
                {
                    current = new AticAtacScreen()
                    {
                        screenId = item.Screen
                    };
                    current.objects = new List <BackgroundObject>();
                    current.colour  = new RoomColour()
                    {
                        red = 1f, green = 1f, blue = 1f
                    };
                    map.screens.Add(current);
                }

                current.objects.Add(new BackgroundObject(item));
            }

            string json = JsonConvert.SerializeObject(map);

            File.WriteAllText("aticatacmap.txt", json);
        }