コード例 #1
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 (!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);
        }
コード例 #2
0
ファイル: EditModeInfo.cs プロジェクト: volte/doombuilderx
        // 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);
        }
コード例 #3
0
        /// <summary>
        /// Provides basic user input interface functionality for a Doom Builder editing mode.
        /// </summary>
        public EditMode()
        {
            // Fetch attributes
            object[] attrs = this.GetType().GetCustomAttributes(true);
            foreach (object a in attrs)
            {
                if (a is EditModeAttribute)
                {
                    attributes = (EditModeAttribute)a;
                    break;
                }
            }

            // No attributes found?
            if (attributes == null)
            {
                throw new Exception("Editing mode \"" + this.GetType().Name + "\" is missing EditMode attributes!");
            }

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