public ExplorerObjectSerialization(IExplorerObject exObject)
 {
     if (!PlugInManager.IsPlugin(exObject))
     {
         return;
     }
     _guid     = PlugInManager.PlugInID(exObject);
     _fullname = exObject.FullName;
 }
Exemple #2
0
        public ExplorerObjectSerialization(IExplorerObject exObject)
        {
            if (!PlugInManager.IsPlugin(exObject))
            {
                return;
            }
            _guid     = PlugInManager.PlugInID(exObject);
            _fullname = exObject.FullName;

            //foreach (Type basetype in exObject.GetType().GetInterfaces())
            //{
            //    _exObjectTypes.Add(basetype);
            //}
            //if (exObject.Object == null) return;
            //foreach (Type basetype in exObject.Object.GetType().GetInterfaces())
            //{
            //    _ObjectTypes.Add(basetype);
            //}
        }
Exemple #3
0
        virtual public object Clone()
        {
            if (!(this is IPersistable))
            {
                return(null);
            }

            try
            {
                object clone = null;
                if (PlugInManager.IsPlugin(this))
                {
                    PlugInManager compMan = new PlugInManager();
                    clone = compMan.CreateInstance(PlugInManager.PlugInID(this));
                }
                else
                {
                    global::System.Reflection.Assembly assembly = global::System.Reflection.Assembly.GetAssembly(this.GetType());
                    clone = assembly.CreateInstance(this.GetType().ToString());
                }
                if (clone == null)
                {
                    return(null);
                }

                XmlStream stream = new XmlStream("root");
                ((IPersistable)this).Save(stream);
                ((IPersistable)clone).Load(stream);

                return(clone);
            }
            catch
            {
            }
            return(null);
        }