Exemplo n.º 1
0
        protected SCOR.AScorItem GetGuiElement(string name, byte[] data)
        {
            SCOR.AScorItem ret = null;
            if (GuiElements.ContainsKey(name))
            {
                ret = System.Activator.CreateInstance(GuiElements[name], new object[] { this }) as SCOR.AScorItem;
            }
            if (ret == null)
            {
                ret = new SCOR.ScoreItemDefault(this);
            }
            if (data != null)
            {
                System.IO.BinaryReader br = new System.IO.BinaryReader(new System.IO.MemoryStream(data));
                ret.SetData(name, br);
                br.Close();
            }

            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Unserializes a BinaryStream into the Attributes of this Instance
        /// </summary>
        /// <param name="reader">The Stream that contains the FileData</param>
        internal void Unserialize(System.IO.BinaryReader reader)
        {
            string name = StreamHelper.ReadString(reader);

            SCOR.IScorItemToken tp = GetTokenParser(name);

            lock (tp)
            {
                byte[] data = tp.UnserializeToken(this, reader);

                if (tp.ActivatedGUI == null)
                {
                    SetGui(name, data);
                }
                else
                {
                    gui = tp.ActivatedGUI;
                    gui.SetData(name, null);
                }
            }
        }
Exemplo n.º 3
0
 protected void SetGui(string name, byte[] data)
 {
     //if (gui != null) gui.Dispose();
     gui = GetGuiElement(name, data);
 }