示例#1
0
        public override void LoadFromStream(Stream aStream, HCStyle aStyle, ushort aFileVersion)
        {
            base.LoadFromStream(aStream, aStyle, aFileVersion);
            BeginAdd();
            try
            {
                byte[] vBuffer;

                if (aFileVersion > 39)
                {
                    FColumns = (byte)aStream.ReadByte();
                    Byte vByte = (byte)aStream.ReadByte();
                    FMultSelect  = HC.IsOdd(vByte >> 7);
                    FItemHit     = HC.IsOdd(vByte >> 6);
                    FColumnAlign = HC.IsOdd(vByte >> 5);
                    FBoxRight    = HC.IsOdd(vByte >> 4);
                }

                FItems.Clear();
                string vS = "";
                HC.HCLoadTextFromStream(aStream, ref vS, aFileVersion);
                if (vS != "")
                {
                    string[] vStrings = vS.Split(new string[] { HC.sLineBreak }, StringSplitOptions.None);
                    for (int i = 0; i < vStrings.Length; i++)
                    {
                        AddItem(vStrings[i]);
                    }

                    if (aFileVersion > 35)
                    {
                        HC.HCLoadTextFromStream(aStream, ref vS, aFileVersion);
                        if (vS != "")
                        {
                            vStrings = vS.Split(new string[] { HC.sLineBreak }, StringSplitOptions.None);
                            for (int i = 0; i < vStrings.Length; i++)
                            {
                                FItems[i].TextValue = vStrings[i];
                            }
                        }
                    }

                    vBuffer = BitConverter.GetBytes(false);
                    for (int i = 0; i < FItems.Count; i++)
                    {
                        aStream.Read(vBuffer, 0, vBuffer.Length);
                        FItems[i].Checked = BitConverter.ToBoolean(vBuffer, 0);
                    }
                }

                if (aFileVersion > 33)
                {
                    this.FRadioStyle = (HCRadioStyle)aStream.ReadByte();
                }
            }
            finally
            {
                EndAdd();
            }
        }