Beispiel #1
0
        //Retrieves the tag as a byte array. This method does not attempt to read the tag data,
        //it simply reads the header and if present the tag bytes are read directly from the
        //stream. This means that typical exceptions that get thrown in a tag read will not
        //occur in this method.
        public byte[] GetTagBytes(int majorVersion, int minorVersion)
        {
            RegisteredId3Handler registeredHandler = RegisteredHandlers.GetHandler(majorVersion, minorVersion);

            byte[] tagBytes = registeredHandler.Handler.GetTagBytes(_stream);
            return(tagBytes);
        }
        // override the base method
        protected override void DescribeComponent(ScriptComponentDescriptor descriptor)
        {
            // Register fields and handlers for use in client-side

            if (Search != null)
            {
                RegisteredFields.Add(new Obout.Ajax.UI.HTMLEditor.Popups.RegisteredField("search", Search));
            }
            if (ReplaceWith != null)
            {
                RegisteredFields.Add(new Obout.Ajax.UI.HTMLEditor.Popups.RegisteredField("replaceWith", ReplaceWith));
            }
            if (MatchCase != null)
            {
                RegisteredFields.Add(new Obout.Ajax.UI.HTMLEditor.Popups.RegisteredField("matchCase", MatchCase));
            }
            if (SearchNext != null)
            {
                RegisteredHandlers.Add(new Obout.Ajax.UI.HTMLEditor.Popups.RegisteredField("searchNext", SearchNext));
            }
            if (Replace != null)
            {
                RegisteredHandlers.Add(new Obout.Ajax.UI.HTMLEditor.Popups.RegisteredField("replace", Replace));
            }
            if (ReplaceAll != null)
            {
                RegisteredHandlers.Add(new Obout.Ajax.UI.HTMLEditor.Popups.RegisteredField("replaceAll", ReplaceAll));
            }

            base.DescribeComponent(descriptor);
        }
Beispiel #3
0
        protected virtual void AddMessageHandler <T>(Func <IMessage <T>, object> processMessageFn, Action <IMessage <T>, Exception> processExceptionEx, TQueueHandlerConfiguration queueHandlerConfiguration, MessageHandlerConfiguration messageHandlerConfiguration)
        {
            if (RegisteredHandlers.ContainsKey(typeof(T)))
            {
                throw new ArgumentException("Message handler has already been registered for type: " + typeof(T).Name);
            }

            this.RegisteredHandlers.Add(typeof(T), RegisterHandler(processMessageFn, processExceptionEx, queueHandlerConfiguration, messageHandlerConfiguration));
        }
        public static FileHandler GetFileHandler(FileHandler.FileType fileType)
        {
            FileHandler newHandler = null;

            if (RegisteredHandlers.ContainsKey(fileType))
            {
                newHandler = Activator.CreateInstance(RegisteredHandlers[fileType]) as FileHandler;
            }
            else
            {
                Logger.Error("Unable to determine file parser type");
            }

            return(newHandler);
        }
Beispiel #5
0
        public bool WriteTag(Id3Tag tag, WriteConflictAction conflictAction = WriteConflictAction.NoAction)
        {
            EnsureWritePermissions(Id3Messages.NoWritePermissions_CannotWriteTag);
            if (tag == null)
            {
                throw new ArgumentNullException("tag");
            }

            //The tag should specify major version number
            if (tag.MajorVersion == 0)
            {
                throw new ArgumentException(Id3Messages.MajorTagVersionMissing, "tag");
            }

            //Get any existing handlers from the same family as the tag
            IEnumerable <RegisteredId3Handler> familyHandlers = ExistingHandlers.GetHandlers(tag.Family);

            //If a tag already exists from the same family, but is a different version than the passed tag,
            //delete it if conflictAction is Replace.
            RegisteredId3Handler familyHandler = familyHandlers.FirstOrDefault();

            if (familyHandler != null)
            {
                Id3Handler handler = familyHandler.Handler;
                if (handler.MajorVersion != tag.MajorVersion || handler.MinorVersion != tag.MinorVersion)
                {
                    if (conflictAction == WriteConflictAction.NoAction)
                    {
                        return(false);
                    }
                    if (conflictAction == WriteConflictAction.Replace)
                    {
                        Id3Handler handlerCopy = handler;
                        handlerCopy.DeleteTag(_stream);
                    }
                }
            }

            //Write the tag to the file. The handler will know how to overwrite itself.
            RegisteredId3Handler registeredHandler = RegisteredHandlers.GetHandler(tag.MajorVersion, tag.MinorVersion);
            bool writeSuccessful = registeredHandler.Handler.WriteTag(_stream, tag);

            if (writeSuccessful)
            {
                InvalidateExistingHandlers();
            }
            return(writeSuccessful);
        }
Beispiel #6
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                Logger.Trace($"Disposing {GetType().Name}");
                if (disposing)
                {
                    // NOTE: dispose managed state (managed objects).
                    RegisteredHandlers.Clear();
                    RegisteredFactories.Clear();
                }

                // NOTE: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // NOTE: set large fields to null.

                _disposedValue = true;
            }
        }
Beispiel #7
0
        protected override void FillContent()
        {
            Table     table = new Table();
            TableRow  row   = null;
            TableCell cell;

            InnerQuickFormatting.EnsureChildControls();

            Collection <StyleItem> items = new Collection <StyleItem>();

            foreach (Control control in InnerQuickFormatting.Controls[1].Controls)
            {
                StyleItem item = control as StyleItem;
                items.Add(item);
            }

            int n = 0;

            foreach (StyleItem item in items)
            {
                row = new TableRow();
                table.Rows.Add(row);
                cell = new TableCell();
                cell.Attributes["class"] = "oae_quickformatting";
                ButtonInPopup popupButton = new ButtonInPopup(item);
                RegisteredHandlers.Add(new Obout.Ajax.UI.HTMLEditor.Popups.RegisteredField("button_" + n.ToString(), popupButton));
                n++;
                cell.Controls.Add(popupButton);
                cell.Style[HtmlTextWriterStyle.BackgroundColor] = "Transparent";
                cell.Style[HtmlTextWriterStyle.FontSize]        = "10pt";
                cell.Style[HtmlTextWriterStyle.Padding]         = "0px";
                cell.Style[HtmlTextWriterStyle.FontFamily]      = "Verdana";
                cell.Style[HtmlTextWriterStyle.Color]           = "Blue";
                cell.Style[HtmlTextWriterStyle.Cursor]          = "pointer";
                row.Cells.Add(cell);
            }

            table.Attributes.Add("border", "0");
            table.Attributes.Add("cellspacing", "0");
            table.Attributes.Add("cellpadding", "0");
            table.Style["background-color"] = "transparent";

            Content.Add(table);
        }
Beispiel #8
0
        protected void AddMessageHandler <T, TResponse>(Func <IMessage <T>, TResponse> processMessageFn, Action <IMessage <T>, Exception> processExceptionEx, TQueueHandlerConfiguration queueHandlerConfiguration, MessageHandlerConfiguration messageHandlerConfiguration)
        {
            if (RegisteredHandlers.ContainsKey(typeof(T)))
            {
                throw new ArgumentException("Message handler has already been registered for type: " + typeof(T).Name);
            }

            var wrappedTypedResponseFn = WrapTypedResponseHandler(processMessageFn);

            this.AddMessageHandler <T>(wrappedTypedResponseFn, processExceptionEx, queueHandlerConfiguration, messageHandlerConfiguration);
            // this.RegisteredHandlers.Add(typeof(T), RegisterHandler(wrappedTypedResponseFn, processExceptionEx, noOfThreads));

            if (typeof(TResponse) == typeof(object))
            {
                return;
            }

            this.ResponseMessageTypes.Add(typeof(TResponse)); //// Need to enable queue creation
        }
Beispiel #9
0
        // override the base method
        protected override void DescribeComponent(ScriptComponentDescriptor descriptor)
        {
            // Register fields and handlers for use in client-side

            if (FieldsetWidth != null)
            {
                if (FieldsetWidth.ClientID.Length > 0)
                {
                    RegisteredFields.Add(new RegisteredField("width", FieldsetWidth));
                }
            }
            if (FieldsetHeight != null)
            {
                if (FieldsetHeight.ClientID.Length > 0)
                {
                    RegisteredFields.Add(new RegisteredField("height", FieldsetHeight));
                }
            }
            if (WidthUnitToggle != null)
            {
                RegisteredHandlers.Add(new RegisteredField("widthUnitToggle", WidthUnitToggle));
            }
            if (HeightUnitToggle != null)
            {
                RegisteredHandlers.Add(new RegisteredField("heightUnitToggle", HeightUnitToggle));
            }
            if (Padding != null)
            {
                if (Padding.ClientID.Length > 0)
                {
                    RegisteredFields.Add(new RegisteredField("padding", Padding));
                }
            }
            if (Margin != null)
            {
                if (Margin.ClientID.Length > 0)
                {
                    RegisteredFields.Add(new RegisteredField("margin", Margin));
                }
            }

            base.DescribeComponent(descriptor);
        }
        protected override void CreateChildControls()
        {
            var ok = new PopupBGIButton();

            ok.Text      = GetButton("OK");
            ok.Name      = "OK";
            ok.CssClass += " " + "ajax__htmleditor_popup_confirmbutton ";

            var cancel = new PopupBGIButton();

            cancel.Text      = GetButton("Cancel");
            cancel.Name      = "Cancel";
            cancel.CssClass += " " + "ajax__htmleditor_popup_confirmbutton";

            var table = new Table();

            table.Attributes.Add("border", "0");
            table.Attributes.Add("cellspacing", "0");
            table.Attributes.Add("cellpadding", "0");
            table.Style["width"] = "100%";

            var row = new TableRow();

            table.Rows.Add(row);

            var cell = new TableCell();

            row.Cells.Add(cell);
            cell.HorizontalAlign = HorizontalAlign.Right;
            cell.Controls.Add(ok);
            cell.Controls.Add(cancel);
            Content.Add(table);

            RegisteredHandlers.Add(new RegisteredField("OK", ok));
            RegisteredHandlers.Add(new RegisteredField("Cancel", cancel));
            base.CreateChildControls();
        }
 // ovveride the base method
 protected override void DescribeComponent(ScriptComponentDescriptor descriptor)
 {
     // register client-side handler for our custom button
     RegisteredHandlers.Add(new Obout.Ajax.UI.HTMLEditor.Popups.RegisteredField("customaction1", CButton));
     base.DescribeComponent(descriptor);
 }