Esempio n. 1
0
        private void itemTreeView_BeforeSelect(object sender, TreeViewCancelEventArgs e)
        {
            if (currentItem != null && currentItem.isCustomCreated)
            {
                //Making sure the hash is updated
                SpriteItem spriteItem;
                if (currentPlugin.Instance.Items.TryGetValue(currentItem.spriteId, out spriteItem))
                {
                    Buffer.BlockCopy(spriteItem.spriteHash, 0, currentItem.spriteHash, 0, spriteItem.spriteHash.Length);
                }
            }

            currentItem = null;
        }
Esempio n. 2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FileDialog dialog = new OpenFileDialog();

            //Now set the file type
            dialog.Filter = "otb files (*.otb)|*.otb|All files (*.*)|*.*";
            dialog.Title  = "Open otb file...";

            if (dialog.ShowDialog() != DialogResult.OK || dialog.FileName.Length == 0)
            {
                return;
            }

            currentItem       = null;
            currentPlugin     = null;
            previousPlugin    = null;
            currentOtbVersion = 0;

            items.Clear();

            if (otb.open(dialog.FileName, ref items, showOtbOutput))
            {
                currentOtbFullPath = dialog.FileName;
                currentOtbVersion  = items.dwMinorVersion;

                saveAsToolStripMenuItem.Enabled = true;
                saveToolStripMenuItem.Enabled   = true;

                //try find a plugin that can handle this version of otb
                currentPlugin = Program.plugins.AvailablePlugins.Find(currentOtbVersion);
                if (currentPlugin == null)
                {
                    items.Clear();
                    MessageBox.Show(String.Format("Could not find a plugin that could handle client version {0}", currentOtbVersion));
                    return;
                }

                if (!loadClient(currentPlugin, currentOtbVersion))
                {
                    currentPlugin = null;
                    items.Clear();
                    return;
                }

                createItemToolStripMenuItem.Enabled = true;
                updateToolStripMenuItem.Enabled     = true;
                buildTreeView();
            }
        }
Esempio n. 3
0
        private bool compareItem(OtbItem item, bool compareHash)
        {
            if (item.type == ItemType.Deprecated)
            {
                return(true);
            }

            SpriteItem spriteItem;

            if (currentPlugin.Instance.Items.TryGetValue(item.spriteId, out spriteItem))
            {
                if (compareHash && !Utils.ByteArrayCompare(item.spriteHash, spriteItem.spriteHash))
                {
                    return(false);
                }

                return(item.isEqual(spriteItem));
            }

            return(false);
        }
Esempio n. 4
0
        private void onSelectItem(TreeNode node)
        {
            if (node != null && node.Tag != null)
            {
                OtbItem item = (OtbItem)node.Tag;
                showItem(item);
            }
            else
            {
                currentItem = null;

                pictureBox.Image                   = null;
                pictureBox.BackColor               = Color.White;
                prevPictureBox.Image               = null;
                prevPictureBox.BackColor           = Color.White;
                tableLayoutPanelCandidates.Visible = false;
                clientIdUpDown.Value               = clientIdUpDown.Minimum;
                serverIdLbl.Text                   = "0";
                typeCombo.Text      = "";
                typeCombo.ForeColor = Color.Black;
                duplicateItemToolStripMenuItem.Enabled = false;

                foreach (Control control in optionGroupBox.Controls)
                {
                    if (control is CheckBox)
                    {
                        ((CheckBox)control).Checked = false;
                        control.ForeColor           = Color.Black;
                    }
                    else if (control is TextBox)
                    {
                        ((TextBox)control).Text = "";
                        control.ForeColor       = Color.Black;
                    }
                }
            }
        }
Esempio n. 5
0
        private UInt16 createItem(Item item)
        {
            UInt16 newId = (UInt16)(items.maxId + 1);

            //create a new otb item
            OtbItem newItem = new OtbItem(item);

            newItem.id         = newId;
            newItem.spriteHash = new byte[16];

            if (item != null)
            {
                newItem.spriteId = item.id;
                Buffer.BlockCopy(item.spriteHash, 0, newItem.spriteHash, 0, newItem.spriteHash.Length);
            }
            else
            {
                newItem.spriteId        = items.minId;
                newItem.isCustomCreated = true;
            }

            items.Add(newItem);
            return(newId);
        }
Esempio n. 6
0
        private void reloadItem(OtbItem item)
        {
            //to avoid problems with events
            OtbItem tmpItem = currentItem;

            currentItem = null;

            SpriteItem spriteItem;

            if (currentPlugin.Instance.Items.TryGetValue(item.spriteId, out spriteItem))
            {
                if (showUpdateOutput)
                {
                    Trace.WriteLine(String.Format("Reloading item id: {0}", item.id));
                }

                UInt16 tmpId = item.id;
                item.itemImpl = (ItemImpl)spriteItem.itemImpl.Clone();
                item.id       = tmpId;
                Buffer.BlockCopy(spriteItem.spriteHash, 0, item.spriteHash, 0, spriteItem.spriteHash.Length);

                currentItem = tmpItem;
            }
        }
Esempio n. 7
0
        private void pictureBoxCandidate_Click(object sender, EventArgs e)
        {
            if (currentItem != null)
            {
                PictureBox box = (PictureBox)sender;
                if (box.Tag is OtbItem)
                {
                    OtbItem newItem = (OtbItem)box.Tag;

                    SpriteItem spriteItem;
                    if (!currentPlugin.Instance.Items.TryGetValue(newItem.spriteId, out spriteItem))
                    {
                        return;
                    }

                    if (!spriteItem.isEqual(currentItem))
                    {
                        DialogResult result = MessageBox.Show(
                            "The item attributes does not match the current information, would you like to continue anyway?",
                            "Item attributes does not match",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Question,
                            MessageBoxDefaultButton.Button1);

                        if (result != DialogResult.Yes)
                        {
                            return;
                        }
                    }

                    currentItem.prevSpriteId = currentItem.spriteId;
                    currentItem.spriteId     = spriteItem.id;
                    showItem(currentItem);
                }
            }
        }
Esempio n. 8
0
        private bool showItem(OtbItem item)
        {
            currentItem = null;
            resetAllDatabindings(this);

            if (item == null)
            {
                return(false);
            }

            SpriteItem spriteItem;

            if (!currentPlugin.Instance.Items.TryGetValue(item.spriteId, out spriteItem))
            {
                return(false);
            }

            duplicateItemToolStripMenuItem.Enabled = true;

            drawSprite(pictureBox, spriteItem);
            if (!item.isCustomCreated && item.spriteHash != null && spriteItem.spriteHash != null)
            {
                pictureBox.BackColor = ((Utils.ByteArrayCompare(item.spriteHash, spriteItem.spriteHash) ? Color.White : Color.Red));
            }

            typeCombo.Text      = item.type.ToString();
            typeCombo.ForeColor = (item.type == spriteItem.type ? Color.Black : Color.Red);

            //
            serverIdLbl.DataBindings.Add("Text", item, "id");
            clientIdUpDown.Minimum = items.minId;
            clientIdUpDown.Maximum = items.maxId;
            clientIdUpDown.DataBindings.Add("Value", spriteItem, "id");

            //Options
            blockObjectCheck.DataBindings.Add("Checked", item, "blockObject");
            blockObjectCheck.ForeColor = (item.blockObject == spriteItem.blockObject ? Color.Black : Color.Red);

            blockProjectileCheck.DataBindings.Add("Checked", item, "blockProjectile");
            blockProjectileCheck.ForeColor = (item.blockProjectile == spriteItem.blockProjectile ? Color.Black : Color.Red);

            blockPathFindCheck.DataBindings.Add("Checked", item, "blockPathFind");
            blockPathFindCheck.ForeColor = (item.blockPathFind == spriteItem.blockPathFind ? Color.Black : Color.Red);

            moveableCheck.DataBindings.Add("Checked", item, "isMoveable");
            moveableCheck.ForeColor = (item.isMoveable == spriteItem.isMoveable ? Color.Black : Color.Red);

            hasHeightCheck.DataBindings.Add("Checked", item, "hasHeight");
            hasHeightCheck.ForeColor = (item.hasHeight == spriteItem.hasHeight ? Color.Black : Color.Red);

            pickupableCheck.DataBindings.Add("Checked", item, "isPickupable");
            pickupableCheck.ForeColor = (item.isPickupable == spriteItem.isPickupable ? Color.Black : Color.Red);

            hangableCheck.DataBindings.Add("Checked", item, "isHangable");
            hangableCheck.ForeColor = (item.isHangable == spriteItem.isHangable ? Color.Black : Color.Red);

            useableCheck.DataBindings.Add("Checked", item, "hasUseWith");
            useableCheck.ForeColor = (item.hasUseWith == spriteItem.hasUseWith ? Color.Black : Color.Red);

            rotatableCheck.DataBindings.Add("Checked", item, "isRotatable");
            rotatableCheck.ForeColor = (item.isRotatable == spriteItem.isRotatable ? Color.Black : Color.Red);

            stackableCheck.DataBindings.Add("Checked", item, "isStackable");
            stackableCheck.ForeColor = (item.isStackable == spriteItem.isStackable ? Color.Black : Color.Red);

            verticalCheck.DataBindings.Add("Checked", item, "isVertical");
            verticalCheck.ForeColor = (item.isVertical == spriteItem.isVertical ? Color.Black : Color.Red);

            walkStackCheck.DataBindings.Add("Checked", item, "walkStack");
            walkStackCheck.ForeColor = (item.walkStack == spriteItem.walkStack ? Color.Black : Color.Red);

            horizontalCheck.DataBindings.Add("Checked", item, "isHorizontal");
            horizontalCheck.ForeColor = (item.isHorizontal == spriteItem.isHorizontal ? Color.Black : Color.Red);

            alwaysOnTopCheck.DataBindings.Add("Checked", item, "alwaysOnTop");
            alwaysOnTopCheck.ForeColor = (item.alwaysOnTop == spriteItem.alwaysOnTop ? Color.Black : Color.Red);

            readableCheck.DataBindings.Add("Checked", item, "isReadable");
            readableCheck.ForeColor = (item.isReadable == spriteItem.isReadable ? Color.Black : Color.Red);

            speedText.DataBindings.Add("Text", item, "groundSpeed");
            speedText.ForeColor = (item.groundSpeed == spriteItem.groundSpeed ? Color.Black : Color.Red);

            topOrderText.DataBindings.Add("Text", item, "alwaysOnTopOrder");
            topOrderText.ForeColor = (item.alwaysOnTopOrder == spriteItem.alwaysOnTopOrder ? Color.Black : Color.Red);

            lightLevelText.DataBindings.Add("Text", item, "lightLevel");
            lightLevelText.ForeColor = (item.lightLevel == spriteItem.lightLevel ? Color.Black : Color.Red);

            lightColorText.DataBindings.Add("Text", item, "lightColor");
            lightColorText.ForeColor = (item.lightColor == spriteItem.lightColor ? Color.Black : Color.Red);

            maxReadCharsText.DataBindings.Add("Text", item, "maxReadChars");
            maxReadCharsText.ForeColor = (item.maxReadChars == spriteItem.maxReadChars ? Color.Black : Color.Red);

            maxReadWriteCharsText.DataBindings.Add("Text", item, "maxReadWriteChars");
            maxReadWriteCharsText.ForeColor = (item.maxReadWriteChars == spriteItem.maxReadWriteChars ? Color.Black : Color.Red);

            lookThroughCheck.DataBindings.Add("Checked", item, "lookThrough");
            lookThroughCheck.ForeColor = (item.lookThrough == spriteItem.lookThrough ? Color.Black : Color.Red);

            minimapColorText.DataBindings.Add("Text", item, "minimapColor");
            minimapColorText.ForeColor = (item.minimapColor == spriteItem.minimapColor ? Color.Black : Color.Red);

            wareIdText.DataBindings.Add("Text", item, "wareId");
            wareIdText.ForeColor = (item.wareId == spriteItem.wareId ? Color.Black : Color.Red);

            nameText.DataBindings.Add("Text", item, "name");
            nameText.ForeColor = (item.name.CompareTo(spriteItem.name) == 0 ? Color.Black : Color.Red);

            tableLayoutPanelCandidates.Visible = false;
            for (int i = 0; i < tableLayoutPanelCandidates.ColumnCount; ++i)
            {
                PictureBox box = (PictureBox)tableLayoutPanelCandidates.GetControlFromPosition(i, 0);
                box.Image = null;
            }

            if (previousPlugin != null)
            {
                SpriteItem prevSpriteItem;
                if (previousPlugin.Instance.Items.TryGetValue(item.prevSpriteId, out prevSpriteItem))
                {
                    drawSprite(prevPictureBox, prevSpriteItem);

                    if (prevSpriteItem.spriteSignature != null)
                    {
                        //Sprite does not match, use the sprite signature to find possible candidates
                        showSpriteCandidates(prevSpriteItem);
                    }
                }
                else
                {
                    prevPictureBox.Image = null;
                }
            }

            currentItem = item;
            return(true);
        }
Esempio n. 9
0
        public static bool open(string filename, ref OtbList items, bool outputDebug)
        {
            FileStream fileStream = new FileStream(filename, FileMode.Open);

            try
            {
                using (OtbLoader reader = new OtbLoader(fileStream))
                {
                    //get root node
                    BinaryReader nodeReader = reader.getRootNode();
                    if (nodeReader == null)
                    {
                        return(false);
                    }

                    nodeReader.ReadByte();                     //first byte of otb is 0
                    nodeReader.ReadUInt32();                   //4 bytes flags, unused

                    byte attr = nodeReader.ReadByte();
                    if ((rootattrib_t)attr == rootattrib_t.ROOT_ATTR_VERSION)
                    {
                        UInt16 datalen = nodeReader.ReadUInt16();
                        if (datalen != 4 + 4 + 4 + 1 * 128)
                        {
                            //error = wxT("items.otb: Size of version header is invalid, updated .otb version?");
                            if (outputDebug)
                            {
                                Trace.WriteLine(String.Format("Size of version header is invalid."));
                            }
                            return(false);
                        }

                        items.dwMajorVersion = nodeReader.ReadUInt32();                        //major, file version
                        items.dwMinorVersion = nodeReader.ReadUInt32();                        //minor, client version
                        items.dwBuildNumber  = nodeReader.ReadUInt32();                        //build number, revision
                        nodeReader.BaseStream.Seek(128, SeekOrigin.Current);
                    }

                    nodeReader = reader.getChildNode();
                    if (nodeReader == null)
                    {
                        return(false);
                    }

                    do
                    {
                        OtbItem item = new OtbItem();

                        byte itemGroup = nodeReader.ReadByte();
                        if (outputDebug)
                        {
                            Trace.WriteLine(String.Format("Node:ItemGroup {0}", (itemgroup_t)itemGroup));
                        }

                        switch ((itemgroup_t)itemGroup)
                        {
                        case itemgroup_t.ITEM_GROUP_NONE: item.type = ItemType.None; break;

                        case itemgroup_t.ITEM_GROUP_GROUND: item.type = ItemType.Ground; break;

                        case itemgroup_t.ITEM_GROUP_SPLASH: item.type = ItemType.Splash; break;

                        case itemgroup_t.ITEM_GROUP_FLUID: item.type = ItemType.Fluid; break;

                        case itemgroup_t.ITEM_GROUP_CONTAINER: item.type = ItemType.Container; break;

                        case itemgroup_t.ITEM_GROUP_DEPRECATED: item.type = ItemType.Deprecated; break;

                        default: break;
                        }

                        itemflags_t flags = (itemflags_t)nodeReader.ReadUInt32();
                        if (outputDebug)
                        {
                            Trace.WriteLine(String.Format("Node:flags {0}", flags));
                        }

                        item.blockObject     = ((flags & itemflags_t.FLAG_BLOCK_SOLID) == itemflags_t.FLAG_BLOCK_SOLID);
                        item.blockProjectile = ((flags & itemflags_t.FLAG_BLOCK_PROJECTILE) == itemflags_t.FLAG_BLOCK_PROJECTILE);
                        item.blockPathFind   = ((flags & itemflags_t.FLAG_BLOCK_PATHFIND) == itemflags_t.FLAG_BLOCK_PATHFIND);
                        item.isPickupable    = ((flags & itemflags_t.FLAG_PICKUPABLE) == itemflags_t.FLAG_PICKUPABLE);
                        item.isMoveable      = ((flags & itemflags_t.FLAG_MOVEABLE) == itemflags_t.FLAG_MOVEABLE);
                        item.isStackable     = ((flags & itemflags_t.FLAG_STACKABLE) == itemflags_t.FLAG_STACKABLE);
                        item.alwaysOnTop     = ((flags & itemflags_t.FLAG_ALWAYSONTOP) == itemflags_t.FLAG_ALWAYSONTOP);
                        item.isVertical      = ((flags & itemflags_t.FLAG_VERTICAL) == itemflags_t.FLAG_VERTICAL);
                        item.isHorizontal    = ((flags & itemflags_t.FLAG_HORIZONTAL) == itemflags_t.FLAG_HORIZONTAL);
                        item.isHangable      = ((flags & itemflags_t.FLAG_HANGABLE) == itemflags_t.FLAG_HANGABLE);
                        item.isRotatable     = ((flags & itemflags_t.FLAG_ROTABLE) == itemflags_t.FLAG_ROTABLE);
                        item.isReadable      = ((flags & itemflags_t.FLAG_READABLE) == itemflags_t.FLAG_READABLE);
                        item.hasUseWith      = ((flags & itemflags_t.FLAG_USEABLE) == itemflags_t.FLAG_USEABLE);
                        item.hasHeight       = ((flags & itemflags_t.FLAG_HAS_HEIGHT) == itemflags_t.FLAG_HAS_HEIGHT);
                        item.lookThrough     = ((flags & itemflags_t.FLAG_LOOKTHROUGH) == itemflags_t.FLAG_LOOKTHROUGH);
                        item.allowDistRead   = ((flags & itemflags_t.FLAG_ALLOWDISTREAD) == itemflags_t.FLAG_ALLOWDISTREAD);
                        item.isAnimation     = ((flags & itemflags_t.FLAG_ANIMATION) == itemflags_t.FLAG_ANIMATION);
                        item.walkStack       = ((flags & itemflags_t.FLAG_WALKSTACK) == itemflags_t.FLAG_WALKSTACK);

                        while (nodeReader.PeekChar() != -1)
                        {
                            byte   attribute = nodeReader.ReadByte();
                            UInt16 datalen   = nodeReader.ReadUInt16();

                            if (outputDebug)
                            {
                                Trace.WriteLine(String.Format("Node[{0}]:attribut {1}, size: {2}",
                                                              reader.currentNodePos, ((itemattrib_t)attribute), datalen, reader.currentNodePos + nodeReader.BaseStream.Position));
                            }

                            switch ((itemattrib_t)attribute)
                            {
                            case itemattrib_t.ITEM_ATTR_SERVERID:
                            {
                                if (datalen != sizeof(UInt16))
                                {
                                    if (outputDebug)
                                    {
                                        Trace.WriteLine(String.Format("Unexpected data length of server id block (Should be 2 bytes)"));
                                    }
                                    return(false);
                                }

                                item.id = nodeReader.ReadUInt16();
                                if (outputDebug)
                                {
                                    System.Diagnostics.Debug.WriteLine(String.Format("Node:attribute:data {0}", item.id));
                                }
                            } break;

                            case itemattrib_t.ITEM_ATTR_CLIENTID:
                            {
                                if (datalen != sizeof(UInt16))
                                {
                                    if (outputDebug)
                                    {
                                        Trace.WriteLine(String.Format("Unexpected data length of client id block (Should be 2 bytes)"));
                                    }
                                    return(false);
                                }

                                item.spriteId = nodeReader.ReadUInt16();
                                if (outputDebug)
                                {
                                    Trace.WriteLine(String.Format("Node:attribute:data {0}", item.spriteId));
                                }
                            } break;

                            case itemattrib_t.ITEM_ATTR_WAREID:
                            {
                                if (datalen != sizeof(UInt16))
                                {
                                    if (outputDebug)
                                    {
                                        Trace.WriteLine(String.Format("Unexpected data length of ware id block (Should be 2 bytes)"));
                                    }
                                    return(false);
                                }

                                item.wareId = nodeReader.ReadUInt16();
                                if (outputDebug)
                                {
                                    Trace.WriteLine(String.Format("Node:attribute:data {0}", item.wareId));
                                }
                            } break;

                            case itemattrib_t.ITEM_ATTR_SPEED:
                            {
                                if (datalen != sizeof(UInt16))
                                {
                                    if (outputDebug)
                                    {
                                        Trace.WriteLine(String.Format("Unexpected data length of speed block (Should be 2 bytes)"));
                                    }
                                    return(false);
                                }

                                item.groundSpeed = nodeReader.ReadUInt16();
                                if (outputDebug)
                                {
                                    Trace.WriteLine(String.Format("Node:attribute:data {0}", item.groundSpeed));
                                }
                            } break;

                            case itemattrib_t.ITEM_ATTR_NAME:
                            {
                                item.name = new string(nodeReader.ReadChars(datalen));
                                if (outputDebug)
                                {
                                    Trace.WriteLine(String.Format("Node:attribute:data {0}", item.name));
                                }
                            } break;

                            case itemattrib_t.ITEM_ATTR_SPRITEHASH:
                            {
                                if (datalen != 16)
                                {
                                    return(false);
                                }

                                item.spriteHash = nodeReader.ReadBytes(16);
                                if (outputDebug)
                                {
                                    Trace.WriteLine(String.Format("Node:attribute:data {0}", item.alwaysOnTopOrder));
                                }
                            } break;

                            case itemattrib_t.ITEM_ATTR_MINIMAPCOLOR:
                            {
                                if (datalen != 2)
                                {
                                    return(false);
                                }

                                item.minimapColor = nodeReader.ReadUInt16();
                                if (outputDebug)
                                {
                                    Trace.WriteLine(String.Format("Node:attribute:data {0}", item.minimapColor));
                                }
                            } break;

                            case itemattrib_t.ITEM_ATTR_07:
                            {
                                //read/write-able
                                if (datalen != 2)
                                {
                                    return(false);
                                }

                                item.maxReadWriteChars = nodeReader.ReadUInt16();
                            } break;

                            case itemattrib_t.ITEM_ATTR_08:
                            {
                                //readable
                                if (datalen != 2)
                                {
                                    return(false);
                                }

                                item.maxReadChars = nodeReader.ReadUInt16();
                            } break;

                            case itemattrib_t.ITEM_ATTR_LIGHT2:
                            {
                                if (datalen != sizeof(UInt16) * 2)
                                {
                                    if (outputDebug)
                                    {
                                        Trace.WriteLine(String.Format("Unexpected data length of item light (2) block"));
                                    }
                                    return(false);
                                }

                                item.lightLevel = nodeReader.ReadUInt16();
                                item.lightColor = nodeReader.ReadUInt16();
                                if (outputDebug)
                                {
                                    Trace.WriteLine(String.Format("Node:attribute:data {0}, {1}", item.lightLevel, item.lightColor));
                                }
                            } break;

                            case itemattrib_t.ITEM_ATTR_TOPORDER:
                            {
                                if (datalen != sizeof(byte))
                                {
                                    if (outputDebug)
                                    {
                                        Trace.WriteLine(String.Format("Unexpected data length of item toporder block (Should be 1 byte)"));
                                    }
                                    return(false);
                                }

                                item.alwaysOnTopOrder = nodeReader.ReadByte();
                                if (outputDebug)
                                {
                                    Trace.WriteLine(String.Format("Node:attribute:data {0}", item.alwaysOnTopOrder));
                                }
                            } break;

                            default:
                            {
                                //skip unknown attributes
                                nodeReader.BaseStream.Seek(datalen, SeekOrigin.Current);
                                if (outputDebug)
                                {
                                    Trace.WriteLine(String.Format("Skipped unknown attribute"));
                                }
                            } break;
                            }
                        }

                        items.Add(item);

                        nodeReader = reader.getNextNode();
                    } while (nodeReader != null);
                }
            }
            finally
            {
                fileStream.Close();
            }

            return(true);
        }
Esempio n. 10
0
        private bool compareItems()
        {
            if (System.IO.File.Exists(file1Text.Text) && System.IO.File.Exists(file2Text.Text))
            {
                OtbList items1 = new OtbList();
                OtbList items2 = new OtbList();

                bool result;
                result = otb.open(file1Text.Text, ref items1, false);
                if (!result)
                {
                    MessageBox.Show("Could not open {0}", file1Text.Text);
                    return(false);
                }

                result = otb.open(file2Text.Text, ref items2, false);
                if (!result)
                {
                    MessageBox.Show("Could not open {0}", file2Text.Text);
                    return(false);
                }

                IEnumerator <OtbItem> enumerator1 = items1.GetEnumerator();
                IEnumerator <OtbItem> enumerator2 = items2.GetEnumerator();

                if (items1.Count != items2.Count)
                {
                    resultTextBox.AppendText(string.Format("Item count:  [{0}]/[{1}]" + Environment.NewLine, items1.Count, items2.Count));
                }

                while (enumerator1.MoveNext())
                {
                    if (!enumerator2.MoveNext())
                    {
                        return(false);
                    }

                    OtbItem item1 = enumerator1.Current;
                    OtbItem item2 = enumerator2.Current;

                    if (item1.spriteId != item2.spriteId)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} Sprite changed [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.spriteId, item2.spriteId));
                        continue;
                    }

                    if (item1.spriteHash != null && item2.spriteHash != null && !Utils.ByteArrayCompare(item1.spriteHash, item2.spriteHash))
                    {
                        resultTextBox.AppendText(string.Format("id: {0} Sprite updated" + Environment.NewLine, item1.id));
                    }

                    if (item1.type != item2.type)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} type [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.type, item2.type));
                    }

                    if (item1.alwaysOnTop != item2.alwaysOnTop)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} alwaysOnTop [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.alwaysOnTop, item2.alwaysOnTop));
                    }

                    if (item1.alwaysOnTopOrder != item2.alwaysOnTopOrder)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} alwaysOnTopOrder [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.alwaysOnTopOrder, item2.alwaysOnTopOrder));
                    }

                    if (item1.blockObject != item2.blockObject)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} blockObject [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.blockObject, item2.blockObject));
                    }

                    if (item1.blockPathFind != item2.blockPathFind)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} blockPathFind [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.blockPathFind, item2.blockPathFind));
                    }

                    if (item1.blockProjectile != item2.blockProjectile)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} blockProjectile [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.blockProjectile, item2.blockProjectile));
                    }

                    if (item1.groundSpeed != item2.groundSpeed)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} groundSpeed [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.groundSpeed, item2.groundSpeed));
                    }

                    if (item1.hasHeight != item2.hasHeight)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} hasHeight [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.hasHeight, item2.hasHeight));
                    }

                    if (item1.hasUseWith != item2.hasUseWith)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} Useable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.hasUseWith, item2.hasUseWith));
                    }

                    if (item1.isHangable != item2.isHangable)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} isHangable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isHangable, item2.isHangable));
                    }

                    if (item1.isHorizontal != item2.isHorizontal)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} isHorizontal [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isHorizontal, item2.isHorizontal));
                    }

                    if (item1.isMoveable != item2.isMoveable)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} isMoveable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isMoveable, item2.isMoveable));
                    }

                    if (item1.isPickupable != item2.isPickupable)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} isPickupable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isPickupable, item2.isPickupable));
                    }

                    if (item1.isReadable != item2.isReadable)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} isReadable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isReadable, item2.isReadable));
                    }

                    if (item1.isRotatable != item2.isRotatable)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} isRotatable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isRotatable, item2.isRotatable));
                    }

                    if (item1.isStackable != item2.isStackable)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} isStackable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isStackable, item2.isStackable));
                    }

                    if (item1.isVertical != item2.isVertical)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} isVertical [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isVertical, item2.isVertical));
                    }

                    if (item1.lightColor != item2.lightColor)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} lightColor [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.lightColor, item2.lightColor));
                    }

                    if (item1.lightLevel != item2.lightLevel)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} lightLevel [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.lightLevel, item2.lightLevel));
                    }

                    if (item1.lookThrough != item2.lookThrough)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} lookThrough [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.lookThrough, item2.lookThrough));
                    }

                    if (item1.maxReadChars != item2.maxReadChars)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} maxReadChars [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.maxReadChars, item2.maxReadChars));
                    }

                    if (item1.maxReadWriteChars != item2.maxReadWriteChars)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} maxReadWriteChars [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.maxReadWriteChars, item2.maxReadWriteChars));
                    }

                    if (item1.minimapColor != item2.minimapColor)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} minimapColor [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.minimapColor, item2.minimapColor));
                    }

                    if (item1.name != item2.name)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} name [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.name, item2.name));
                    }

                    if (item1.walkStack != item2.walkStack)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} walkstack [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.walkStack, item2.walkStack));
                    }

                    if (item1.wareId != item2.wareId)
                    {
                        resultTextBox.AppendText(string.Format("id: {0} wareid [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.wareId, item2.wareId));
                    }
                }

                if (resultTextBox.Text.Length == 0)
                {
                    MessageBox.Show("No differences found!");
                }

                return(true);
            }

            return(false);
        }