// Constructor
        public EditModeInfo(Plugin plugin, Type type, EditModeAttribute attr)
        {
            // Initialize
            this.plugin  = plugin;
            this.type    = type;
            this.attribs = attr;

            // Make switch action info
            if (!string.IsNullOrEmpty(attribs.SwitchAction))
            {
                switchactionattr = new BeginActionAttribute(attribs.SwitchAction);
            }

            // Make button info
            if (!string.IsNullOrEmpty(attr.ButtonImage))
            {
                using (Stream stream = plugin.GetResourceStream(attr.ButtonImage))
                {
                    if (stream != null)
                    {
                        buttonimage = Image.FromStream(stream);
                        buttondesc  = attr.DisplayName + (attribs.IsDeprecated ? " (deprecated)" : "");
                        buttonorder = attr.ButtonOrder;
                    }
                }
            }

            // We have no destructor
            GC.SuppressFinalize(this);
        }
Exemple #2
0
        // Constructor
        public EditModeInfo(Plugin plugin, Type type, EditModeAttribute attr)
        {
            // Initialize
            this.plugin  = plugin;
            this.type    = type;
            this.attribs = attr;

            // Make switch action info
            if ((attribs.SwitchAction != null) && (attribs.SwitchAction.Length > 0))
            {
                switchactionattr = new BeginActionAttribute(attribs.SwitchAction);
            }

            // Make button info
            if (attr.ButtonImage != null)
            {
                buttonimagestream = plugin.GetResourceStream(attr.ButtonImage);
                if (buttonimagestream != null)
                {
                    buttonimage = Image.FromStream(buttonimagestream);
                    buttondesc  = attr.DisplayName;
                    buttonorder = attr.ButtonOrder;
                }
            }

            // We have no destructor
            GC.SuppressFinalize(this);
        }