entity.MetaEditor2.Indices.GetItems C# (CSharp) Method

GetItems() private method

private GetItems ( bool readAll ) : void
readAll bool
return void
        private void GetItems(bool readAll)
        {
            this._IndicesList.Clear();
            if (this._IndexedReflexiveChunkCount < 0)
            {
                _IndicesList.Add("Index " + this.EntName + " Is Invalid. On Line " + this._EntIndex.lineNumber.ToString());
                return;
            }
            bool openedMap = false;
            if (map.isOpen == false)
            {
                map.OpenMap(MapTypes.Internal);
                openedMap = true;
            }
            int countervalue = 0;
            int maxcount = this._IndexedReflexiveChunkCount;
            if (readAll == false && this.Value > -1)
            {
                countervalue = this.Value;
                maxcount = this.Value + 1;
            }
            else if (readAll == false)
            {
                countervalue = 0;
                maxcount = 0;
            }
            string tempValueString = "";
            for (int counter = countervalue; counter < maxcount; counter++)
            {
                try
                {
                    map.BR.BaseStream.Position = this._IndexedReflexiveTranslatedOffset + (this._EntIndex.ReflexiveSize * counter) + this._EntIndex.ItemOffset;
                    switch (this._EntIndex.ItemType.ToLower())
                    {
                        case "short":
                            {
                                tempValueString = counter.ToString() + " : " + map.BR.ReadInt16().ToString();
                                break;
                            }
                        case "int":
                            {
                                tempValueString = counter.ToString() + " : " + map.BR.ReadInt32().ToString();
                                break;
                            }
                        case "ushort":
                            {
                                tempValueString = counter.ToString() + " : " + map.BR.ReadUInt16().ToString();
                                break;
                            }
                        case "uint":
                            {
                                tempValueString = counter.ToString() + " : " + map.BR.ReadUInt32().ToString();
                                break;
                            }
                        case "float":
                            {
                                tempValueString = counter.ToString() + " : " + map.BR.ReadSingle().ToString();
                                break;
                            }
                        case "stringid":
                            {
                                int sidIndexer = map.BR.ReadInt16();
                                if (sidIndexer > -1 && sidIndexer < map.Strings.Name.Length)
                                {
                                    tempValueString = counter.ToString() + " : " + map.Strings.Name[sidIndexer];
                                }
                                else
                                {
                                    tempValueString = counter.ToString() + " : Not a String ID";
                                }
                                break;
                            }
                        case "ident":
                            {
                                int tempint = map.BR.ReadInt32();
                                int tagIndex = map.Functions.ForMeta.FindMetaByID(tempint);
                                if (tagIndex != -1)
                                {
                                    if (tempint != -1)
                                    {
                                        tempValueString = counter.ToString() + " : " + map.MetaInfo.TagType[tagIndex] + " - " + map.FileNames.Name[tagIndex];
                                    }
                                    else
                                    {
                                        tempValueString = counter.ToString() + " : Probably is NOT an ident, choose another data type";
                                    }
                                }
                                else if(tagIndex == -1)
                                {
                                    tempValueString = counter.ToString() + " : nulled ident";
                                }
                                else
                                {
                                    tempValueString = counter.ToString() + " : Probably is NOT an ident, choose another data type";
                                }
                                break;
                            }
                        case "string32":
                            {
                                Encoding decode = Encoding.ASCII;
                                byte[] tempbytes = map.BR.ReadBytes(32);
                                tempValueString = counter.ToString() + " : " + decode.GetString(tempbytes);
                                break;
                            }
                         case "unicodestring64":
                            {
                                Encoding decode = Encoding.UTF8;
                                byte[] tempbytes = map.BR.ReadBytes(64);
                                tempValueString = counter.ToString() + " : " + decode.GetString(tempbytes);
                                break;
                            }
                        case "string256":
                            {
                                Encoding decode = Encoding.ASCII;
                                byte[] tempbytes = map.BR.ReadBytes(256);
                                tempValueString = counter.ToString() + " : " + decode.GetString(tempbytes);
                                break;
                            }
                        case "unicodestring256":
                            {
                                Encoding decode = Encoding.UTF8;
                                byte[] tempbytes = map.BR.ReadBytes(256);
                                tempValueString = counter.ToString() + " : " + decode.GetString(tempbytes);
                                break;
                            }

                    }
                }
                catch
                {
                    tempValueString = counter.ToString() + " : Error with index on line number " + this._EntIndex.lineNumber.ToString();
                }
                _IndicesList.Add(tempValueString);
                if (counter == this.Value)
                    this.selectionBoxValueString = tempValueString;
            }
            _IndicesList.Add("nulled");
            if (openedMap == true)
                map.CloseMap();
        }