Example #1
0
        public void Load(Stream stream)
        {
            ILibraryFormat baseFormat;

            if ((baseFormat = new IconFormat()).IsRecognizedFormat(stream))
            {
                if (mSelectedIndex == -1)
                {
                    this.Clear();
                    this.Add(baseFormat.Load(stream)[0]);
                    this[0].Name = "Untitled";
                }
                else
                {
                    string currentName = this[mSelectedIndex].Name;
                    this[mSelectedIndex]      = baseFormat.Load(stream)[0];
                    this[mSelectedIndex].Name = currentName;
                }
            }
            else if ((baseFormat = new NEFormat()).IsRecognizedFormat(stream))
            {
                CopyFrom(baseFormat.Load(stream));
            }
            else if ((baseFormat = new PEFormat()).IsRecognizedFormat(stream))
            {
                CopyFrom(baseFormat.Load(stream));
            }
            else
            {
                throw new InvalidFileException();
            }

            SelectedIndex = Count > 0 ? 0 : -1;
        }
Example #2
0
        public void Load(Stream stream)
        {
            IconFormat iconFormat = new IconFormat();

            if (!iconFormat.IsRecognizedFormat(stream))
            {
                throw new InvalidFileException();
            }

            MultiIcon multiIcon = iconFormat.Load(stream);

            if (multiIcon.Count < 1)
            {
                return;
            }

            this.CopyFrom(multiIcon[0]);
        }