public HTTPBase(RenderingEngine RenderingEngine)
        {
            try
            {
                switch (RenderingEngine)
                {
                    case RenderingEngine.Gecko:
                        this.Control = new MiniGeckoBrowser.MiniGeckoBrowser();
                        (this.Control as MiniGeckoBrowser.MiniGeckoBrowser).XULrunnerPath =
                            Settings.Default.XULRunnerPath;
                        break;
                    case RenderingEngine.IE:
                        this.Control = new WebBrowser();
                        break;
                    case RenderingEngine.GeckoFX:
                        Control = new Gecko.GeckoWebBrowser();
                        Gecko.Xpcom.Initialize(Settings.Default.XULRunnerPath);
                        break;
                }

                NewExtended();
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                    Language.strHttpConnectionFailed + Constants.vbNewLine +
                                                    ex.Message, true);
            }
        }
Example #2
0
        public override void DrawText(Graphics g, RenderingEngine e, DrawableBase parent)
        {
            var data = GetData(1);

            if (data != null)
            {
                DrawDescriptionText(g, e, parent, data.Value.ToString());
            }

            base.DrawText(g, e, parent);
        }
        public ExecuteRequestHandler(IKernel kernel)
        {
            _kernel          = kernel;
            _renderingEngine = new RenderingEngine(new DefaultRenderer(), new PlainTextRendering("<null>"));
            _renderingEngine.RegisterRenderer <string>(new DefaultRenderer());
            _renderingEngine.RegisterRenderer(typeof(IDictionary), new DictionaryRenderer());
            _renderingEngine.RegisterRenderer(typeof(IList), new ListRenderer());
            _renderingEngine.RegisterRenderer(typeof(IEnumerable), new SequenceRenderer());

            _kernel.KernelEvents.Subscribe(this);
        }
Example #4
0
        public HelpEditor(RenderingEngine renderingEngine)
        {
            RenderingEngine = renderingEngine;
            InitializeComponent();
            treeView.AllowDrop = true;

            _editors = new Control[] {
                textBoxEditor,// for all columns
                textBoxEditor,
                textBoxEditor
            };
        }
Example #5
0
        public override void UpdateMouseUp(RenderingEngine e, DrawableBase parent, DrawableBase previous)
        {
            HasFocus = false;
            if (IsMouseOver)
            {
                HasFocus = true;
                Value    = !Value;
                OnClick();
            }

            base.UpdateMouseUp(e, parent, previous);
        }
Example #6
0
        public override Brush GetMainBrush(RectangleF rectangle, RenderingEngine e)
        {
            var brush = new LinearGradientBrush(rectangle, Color.Black, Color.Black, 90, true);

            ColorBlend cb = new ColorBlend();

            cb.Positions = new[] { 0, 0.2f, 0.5f, 1 };
            cb.Colors    = new Color[] { Color.FromArgb(120, 0, 0, 0), Color.FromArgb(150, 180, 0, 0), Color.FromArgb(150, 200, 0, 0), Color.FromArgb(200, 200, 0, 0) };

            brush.InterpolationColors = cb;

            return(brush);
        }
Example #7
0
        private SiteConfig LoadConfiguration(CommandLine commandLine)
        {
            using (var capture = Statistics.Current.Start(StatisticTiming.LoadedConfiguration))
            {
                this.Engines = RenderingEngine.Load();

                var config = SiteConfig.Load(Path.Combine(commandLine.SitePath, "site.config"));

                config.OutputPath = String.IsNullOrEmpty(commandLine.OutputPath) ? Path.GetFullPath(config.OutputPath) : Path.GetFullPath(commandLine.OutputPath);

                return(config);
            }
        }
Example #8
0
        public override void UpdateMouseUp(RenderingEngine e, DrawableBase parent, DrawableBase previous)
        {
            if (e.MouseService.LeftMouseDown)
            {
                HasFocus = false;
                if (IsMouseOver)
                {
                    HasFocus = true;
                }
            }

            base.UpdateMouseUp(e, parent, previous);
        }
Example #9
0
 public override void DrawBody(Graphics g, RenderingEngine e, DrawableBase parent)
 {
     if (_active)
     {
         var r = new RectangleF(Position, Size);
         g.FillRectangle(ActiveBrush, r);
         DrawRectangleF(g, Pen, r);
     }
     else
     {
         base.DrawBody(g, e, parent);
     }
 }
Example #10
0
        public void DrawOutput(Graphics g, SwitchBase sw, int index, RenderingEngine e)
        {
            const float maxHelpHeight = 400;
            const float offsetWidth   = 5;
            const float offsetTextX   = 24;
            const float radius        = 4;

            var io = sw.OutputsSet[index];

            if (io.IsMouseOver)
            {
                var r        = io.DescriptionBounds;
                var swBounds = sw.DescriptionBounds;
                swBounds.Height = maxHelpHeight;
                StringFormat format = new StringFormat();

                var textBounds     = g.MeasureString(this.Title, FontTitle, swBounds.Size, format);
                var swSizeDesc     = new SizeF(240, swBounds.Height);
                var textDescBounds = g.MeasureString(this.Description, FontDescription, swSizeDesc, format);
                textDescBounds.Height = Math.Max(textDescBounds.Height, 8);

                var rText = new RectangleF(r.X + offsetTextX + swBounds.Width, r.Y, textBounds.Width + offsetWidth, textBounds.Height);
                var rDesc = new RectangleF(r.X + offsetTextX + swBounds.Width, r.Y + textBounds.Height + 2, textDescBounds.Width + offsetWidth, textDescBounds.Height);

                ExtendedGraphics extendedGraphics = new ExtendedGraphics(g, e);

                var brush     = GetMainBrush(rText);
                var brushDesc = GetMainBrush(rDesc);

                extendedGraphics.FillRoundRectangle(brush, rText.X, rText.Y, rText.Width, rText.Height, radius);
                extendedGraphics.DrawRoundRectangle(Pen, rText.X, rText.Y, rText.Width, rText.Height, radius);

                extendedGraphics.FillRoundRectangle(brushDesc, rDesc.X, rDesc.Y, rDesc.Width, rDesc.Height, radius);
                extendedGraphics.DrawRoundRectangle(Pen, rDesc.X, rDesc.Y, rDesc.Width, rDesc.Height, radius);

                rText = new RectangleF(rText.X + 4, rText.Y, rText.Width, rText.Height);
                rDesc = new RectangleF(rDesc.X + 4, rDesc.Y, rDesc.Width, rDesc.Height);

                var r1 = new RectangleF(rText.X - 1 + 0.5f, rText.Y + 0.5f, rText.Width, rText.Height);
                var r2 = new RectangleF(rText.X - 1, rText.Y, rText.Width, rText.Height);

                var r3 = new RectangleF(rDesc.X - 1 + 0.5f, rDesc.Y + 0.5f, rDesc.Width, rDesc.Height);
                var r4 = new RectangleF(rDesc.X - 1, rDesc.Y, rDesc.Width, rDesc.Height);

                g.DrawString(Title, FontTitle, Brushes.Black, r1, format);
                g.DrawString(Title, FontTitle, Brushes.White, r2, format);

                g.DrawString(Description, FontDescription, Brushes.Black, r3, format);
                g.DrawString(Description, FontDescription, Brushes.White, r4, format);
            }
        }
Example #11
0
        public void updateAnimation(RenderingEngine renderingEngine)
        {
            //System.Console.WriteLine("Updating this animation: " + currentAnimation);
            ((Animation)(animationList[currentAnimation])).updateAnimation();
            if (((Animation)(animationList[currentAnimation])).isTerminated() == true && statusIsLocked == true && ((Animation)(animationList[currentAnimation])).isCycleAnimation() == false)
            {
                statusIsLocked = false;
            }
            if (((Animation)(animationList[currentAnimation])).isTerminated() == true && ((Animation)(animationList[currentAnimation])).getAnimationId().Equals(GameConstants.PLAYER_INITIAL_JUMP_ANIMATION))

            {
                statusIsLocked = false;

                changeStatus(GameConstants.PLAYER_CYCLE_JUMP_MSG);
            }

            if (((Animation)(animationList[currentAnimation])).isTerminated() == true && ((Animation)(animationList[currentAnimation])).getAnimationId().Equals(GameConstants.PLAYER_INITIAL_JUMP_LEFT_ANIMATION))
            {
                statusIsLocked = false;

                changeStatus(GameConstants.PLAYER_CYCLE_JUMP_MSG);
            }
            if (((Animation)(animationList[currentAnimation])).isTerminated() == true && ((Animation)(animationList[currentAnimation])).getAnimationId().Equals(GameConstants.PLAYER_FALL_ANIMATION))
            {
                //System.Console.WriteLine("Unlocking status, falling animation terminated.");

                statusIsLocked = false;
            }
            if (((Animation)(animationList[currentAnimation])).isTerminated() == true && ((Animation)(animationList[currentAnimation])).getAnimationId().Equals(GameConstants.PLAYER_FALL_LEFT_ANIMATION))
            {
                //System.Console.WriteLine("Unlocking status, falling animation terminated.");

                statusIsLocked = false;
            }
            if (((Animation)(animationList[currentAnimation])).isTerminated() == true && ((Animation)(animationList[currentAnimation])).getAnimationId().Equals(GameConstants.PLAYER_ATTACK_ANIMATION))
            {
                //System.Console.WriteLine("Unlocking status, falling animation terminated.");

                statusIsLocked = false;
                attackIsLocked = false;
            }
            if (((Animation)(animationList[currentAnimation])).isTerminated() == true && ((Animation)(animationList[currentAnimation])).getAnimationId().Equals(GameConstants.PLAYER_ATTACK_LEFT_ANIMATION))
            {
                //System.Console.WriteLine("Unlocking status, falling animation terminated.");

                statusIsLocked = false;
                attackIsLocked = false;
            }
        }
Example #12
0
        private void UpdateRenderingEngine(RenderingEngine engine)
        {
            //Local variables

            // C:\\inetpub\\wwwroot\\UmbracoWebsite5\\UmbracoWebsite5
            var rootFolder = umbracoSitePath;

            // C:\\inetpub\\wwwroot\\UmbracoWebsite5\\UmbracoWebsite5\\config\
            var path = rootFolder + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar;

            // C:\\inetpub\\wwwroot\\UmbracoWebsite5\\UmbracoWebsite5\\config\umbracoSettings.config
            var filePath = path + "umbracoSettings.config";

            //Template mode (Mvc or WebForms)
            var value = engine;

            //Load the config file as xml
            var xml = new XmlDocument();

            try
            {
                using (XmlReader reader = XmlReader.Create(filePath))
                {
                    //Load XML
                    xml.Load(reader);
                }

                //Find the correct node for the 'defaultRenderingEngine' and update the value
                if (xml.DocumentElement != null)
                {
                    //Get the defaultRendering engine XML node, so we can update it's value
                    var node = xml.DocumentElement.SelectSingleNode("/settings/templates/defaultRenderingEngine");

                    if (node != null)
                    {
                        //Update the value in the XML
                        node.InnerText = value.ToString();
                    }
                }

                //Save file
                xml.Save(filePath);
            }
            catch (Exception ex)
            {
                //Otherwise disable the button & show error message
                MessageBox.Show("Exception: " + ex.Message, "Update Rendering Engine Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #13
0
        public void Move(RenderingEngine e, DrawableBase parent, DrawableBase previous, bool snapToGrid)
        {
            var p = Position;
            var m = e.TranslatedMousePosition;

            PointF shift       = new PointF(p.X - e.SelectionService.MouseLeftDownMovePositionLast.X, p.Y - e.SelectionService.MouseLeftDownMovePositionLast.Y);
            var    newPosition = new PointF(m.X + shift.X, m.Y + shift.Y);

            Position = newPosition;

            if (snapToGrid && e.Settings.SnapToGridEnabled)
            {
                Position = SnapToGrid(newPosition, e.Settings.SnapToGridWidth);
            }

            Cursor.Current = Cursors.SizeAll;
        }
Example #14
0
        public VariableEditor(RenderingEngine renderingEngine)
        {
            RenderingEngine = renderingEngine;
            RenderingEngine.ProjectLoaded += RenderingEngineOnProjectLoaded;
            RenderingEngine.BeforeLoading += RenderingEngineOnBeforeLoading;
            InitializeComponent();

            Editors = new Control[] {
                comboBoxEditor, // for column 0
                textBoxEditor,  // for column 1
            };

            var items = Enum.GetNames(typeof(BlueSwitch.Base.IO.ValueType));

            comboBoxEditor.Items.AddRange(items);
            comboBoxEditor.SelectedIndexChanged += new EventHandler(control_SelectedValueChanged);
        }
Example #15
0
        public override void UpdateMouseUp(RenderingEngine e, DrawableBase parent, DrawableBase previous)
        {
            UIComponent lastUiComponent = null;

            foreach (var uiComponent in Components)
            {
                uiComponent.UpdateMouseUp(e, this, lastUiComponent);
                lastUiComponent = uiComponent;
            }

            InputOutputBase lastIo = null;

            foreach (var input in Inputs)
            {
                input.UpdateMouseUp(e, this, lastIo);
                lastIo = input;
            }

            lastIo = null;
            foreach (var output in Outputs)
            {
                output.UpdateMouseUp(e, this, lastIo);
                lastIo = output;
            }

            if (HasVariableInputs)
            {
                _addInputPin.UpdateMouseUp(e, this, lastIo);
            }

            if (HasActionOutput)
            {
                _addOutputPin.UpdateMouseUp(e, this, _addInputPin);
            }

            if (e.SelectionService.Input == null && e.SelectionService.Output == null && !e.SelectionService.StartSelectionRectangle)
            {
                if (IsSelected && e.MouseService.LeftMouseDown)
                {
                    Move(e, parent, previous, true);
                }
            }

            base.UpdateMouseUp(e, parent, previous);
        }
Example #16
0
        public virtual void DrawInputOutputs(Graphics g, RenderingEngine e, DrawableBase parent)
        {
            InputOutputBase lastInput = null;

            foreach (var input in Inputs)
            {
                input.Draw(g, e, this, lastInput);
                lastInput = input;
            }

            InputOutputBase lastOutput = null;

            foreach (var output in Outputs)
            {
                output.Draw(g, e, this, lastOutput);
                lastOutput = output;
            }
        }
Example #17
0
        static void Main()
        {
            var window = new RenderWindow(new VideoMode(1024, 768), "Chaser", Styles.Default, new ContextSettings());

            _inputProcessor  = new UserInputProcessor(new UserInputConfiguration(), window);
            _renderingEngine = new RenderingEngine(window, new DefaultSpriteFactory());

            var loopEngine = new GameLoopEngine();

            loopEngine.RegisterComponent(new UserInputProcessorAdapter(_inputProcessor));
            loopEngine.RegisterComponent(new GameStateMutatorAdapter());
            loopEngine.RegisterComponent(new RenderingEngineAdapter(_renderingEngine));

            while (_renderingEngine.Window.IsOpen)
            {
                loopEngine.Loop();
            }
        }
Example #18
0
        public virtual Brush GetDebugBrush(RectangleF rectangle, RenderingEngine e)
        {
            if (e.Settings.PerformanceMode == PerformanceMode.HighQuality)
            {
                var brush = new LinearGradientBrush(rectangle, Color.Black, Color.Black, 90, true);

                ColorBlend cb = new ColorBlend();

                cb.Positions = new[] { 0, 0.2f, 0.5f, 1 };
                cb.Colors    = new Color[] { Color.FromArgb(120, 0, 0, 0), Color.FromArgb(150, 255, 0, 0), Color.FromArgb(150, 255, 0, 0), Color.FromArgb(60, 30, 160, 255) };

                brush.InterpolationColors = cb;

                return(brush);
            }

            return(Brushes.IndianRed);
        }
Example #19
0
        public void Draw(Graphics g, SwitchBase sw, DrawableBase parent, RenderingEngine e)
        {
            MainEntry.Draw(g, sw, parent, e);
            for (int i = 0; i < sw.InputsSet.Count; i++)
            {
                if (Inputs.ContainsKey(i))
                {
                    Inputs[i].DrawInput(g, sw, i, e);
                }
            }

            for (int i = 0; i < sw.OutputsSet.Count; i++)
            {
                if (Outputs.ContainsKey(i))
                {
                    Outputs[i].DrawOutput(g, sw, i, e);
                }
            }
        }
Example #20
0
        public virtual void DrawDescriptionText(Graphics g, RenderingEngine e, DrawableBase parent, String text)
        {
            var r = DescriptionBounds;

            StringFormat format = new StringFormat(StringFormatFlags.NoClip);

            r = new RectangleF(r.X + 2, r.Y + 2, r.Width, r.Height);

            var r1 = new RectangleF(r.X + 0.5f, r.Y + 0.5f, r.Width, r.Height);
            var r2 = new RectangleF(r.X, r.Y, r.Width, r.Height);

            var renderingHint = g.TextRenderingHint;

            g.TextRenderingHint = TextRenderingHint.AntiAlias;

            g.DrawString(text, FontVerySmall, Brushes.Black, r1, format);
            g.DrawString(text, FontVerySmall, Brushes.White, r2, format);

            g.TextRenderingHint = renderingHint;
        }
Example #21
0
        public virtual void DrawText(Graphics g, RenderingEngine e, DrawableBase parent)
        {
            var transform = g.Transform;

            float compactOffset  = DescriptionOffsetLeftCompact;
            float compactOffset2 = DescriptionOffsetLeftCompact + DescriptionOffsetRightCompact;

            g.TranslateTransform(Position.X + compactOffset, Position.Y + 1);

            var renderingHint = g.TextRenderingHint;

            g.TextRenderingHint = TextRenderingHint.AntiAlias;

            g.DrawString(DisplayName + " " + Extension, FontSmall, Brushes.Black, new PointF(0, 2));
            g.DrawString(DisplayName + " " + Extension, FontSmall, Brushes.White, new PointF(0.5f, 1.5f));

            g.TextRenderingHint = renderingHint;

            g.Transform = transform;
        }
Example #22
0
        public void loadBackgroundTiles(RenderingEngine renderingEngine)
        {
            //foreach...
            //read file data and convert to background tiles
            String tileType = "TEST_TILE"; //change to loaded type


            //actually assign position according to loaded values


            Vector2 screenPosition = new Vector2();

            screenPosition.X = (float)renderingEngine.getViewportUpperX();
            screenPosition.Y = (float)renderingEngine.getViewportUpperY();


            //System.Console.WriteLine(screenPosition.X + " " + screenPosition.Y);


            BackgroundTileMap backgroundTileMap = new BackgroundTileMap(tileType);


            backgroundTileMap.setObjectPosition(screenPosition);

            int ImageXSize = 320;
            int ImageYSize = 240;

            //will actually be loaded from file
            Vector2 scale = new Vector2();

            scale.Y = (screenPosition.Y + ImageYSize + renderingEngine.getViewportHeight()) / (screenPosition.Y + ImageYSize) - 1;
            scale.X = (screenPosition.X + ImageXSize + renderingEngine.getViewportWidth()) / (screenPosition.X + ImageXSize) - 1;


            //System.Console.WriteLine("SCALE: " + scale.X + " " + scale.Y);

            backgroundTileMap.setScale(scale);


            backgroundTileList.Add(backgroundTileMap);
        }
Example #23
0
        // --------------------------------------------------------------------------------

        public override void Update(RenderingEngine e, DrawableBase parent, DrawableBase previous)
        {
            InputOutputBase lastInput = null;

            foreach (var input in Inputs)
            {
                input.Update(e, this, lastInput);
                input.UpdateMouseService(e);
                lastInput = input;
            }

            InputOutputBase lastOutput = null;

            foreach (var output in Outputs)
            {
                output.Update(e, this, lastOutput);
                output.UpdateMouseService(e);
                lastOutput = output;
            }

            UIComponent lastUiComponent = null;

            foreach (var uiComponent in Components)
            {
                uiComponent.Update(e, this, lastUiComponent);
                uiComponent.UpdateMouseService(e);
                lastUiComponent = uiComponent;
            }

            if (HasVariableInputs)
            {
                _addInputPin.Update(e, this, lastUiComponent);
                _addInputPin.UpdateMouseService(e);
            }

            if (HasVariableOutputs)
            {
                _addOutputPin.Update(e, this, lastUiComponent);
                _addOutputPin.UpdateMouseService(e);
            }
        }
Example #24
0
        public virtual void DrawDescription(Graphics g, RenderingEngine e, DrawableBase parent)
        {
            ExtendedGraphics extendedGraphics = new ExtendedGraphics(g, e);

            var rect = Rectangle;

            const float offset  = 2f;
            const float offset2 = 4f;

            float compactOffset  = DescriptionOffsetLeftCompact;
            float compactOffset2 = DescriptionOffsetLeftCompact + DescriptionOffsetRightCompact;

            var r = new RectangleF(rect.X + compactOffset, rect.Y + offset, rect.Width - compactOffset2, DescriptionHeight - offset2);

            float radius = 2;

            var brush = new SolidBrush(Color.FromArgb(80, 0, 0, 0));

            extendedGraphics.FillRoundRectangle(brush, r.X, r.Y, r.Width, r.Height, radius);
            extendedGraphics.DrawRoundRectangle(DescriptionPen, r.X, r.Y, r.Width, r.Height, radius);
        }
Example #25
0
        public IRendering Render(object source, RenderingEngine engine = null)
        {
            switch (source)
            {
            case IDictionary dictionary:
                var sourceType   = RendererUtilities.GetSequenceElementTypeOrKeyValuePairValueType(dictionary);
                var accessors    = RendererUtilities.GetAccessors(sourceType).ToList();
                var keyValueList = dictionary.Keys.OfType <object>()
                                   .Select(k => new KeyValuePair <object, object>(k, dictionary[k]));
                var headers = RendererUtilities.CreateTableHeaders(accessors, true);
                var rows    = RendererUtilities.CreateTableRowsFromValues(accessors, keyValueList, engine);
                var table   = $@"<table>
{headers}
{rows}
</table>";
                return(new HtmlRendering(table));

            default:
                throw new ArgumentOutOfRangeException($"Sequence type {source.GetType()} not supported ");
            }
        }
Example #26
0
        public void draw(RenderingEngine renderingEngine, Player c)
        {
            //System.Console.WriteLine("Flip Horizontally: " + isFlipHorizontally);
            if (isFlipHorizontally)
            {
                //System.Console.WriteLine("Drawing flip horizontal model");
                renderingEngine.DrawScaledHorizontallyFlipped2DModel(c, (Texture2D)texture2DList.GetByIndex(frameCounter));
            }
            else
            {
                renderingEngine.DrawScaled2DModel(c, (Texture2D)texture2DList.GetByIndex(frameCounter));
            }

            if (texture2DList.Count == 0)
            {
                System.Console.WriteLine("Texture 2D List is empty");
            }
            //System.Console.WriteLine("Max Frames is " + maxFrames);
            //System.Console.WriteLine("Frame Counter is " + frameCounter);

            //System.Console.WriteLine("Count is " + texture2DList.Count);
        }
Example #27
0
        private static void CreateTableRow(IEnumerable <MemberInfo> memberInfos, RenderingEngine engine, object element,
                                           IRendering defaultRendering, StringBuilder rowsBuffer)
        {
            if (memberInfos?.Any() != false)
            {
                foreach (var memberInfo in memberInfos)
                {
                    IRendering childRendering = null;
                    switch (memberInfo)
                    {
                    case PropertyInfo propertyInfo:
                    {
                        var childRenderer = engine.GetRendererForType(propertyInfo.PropertyType);
                        var childValue    = propertyInfo.GetValue(element);
                        childRendering = childValue == null ? defaultRendering : childRenderer.Render(childValue, engine);
                    }
                    break;

                    case FieldInfo fieldInfo:
                    {
                        var childRenderer = engine.GetRendererForType(fieldInfo.FieldType);
                        var childValue    = fieldInfo.GetValue(element);
                        childRendering = childValue == null ? defaultRendering : childRenderer.Render(childValue, engine);
                    }
                    break;
                    }

                    var row = $"\t\t<td>{childRendering?.Content ?? string.Empty}</td>";
                    rowsBuffer.AppendLine(row);
                }
            }
            else
            {
                var childRenderer  = engine.GetRendererForType(element.GetType());
                var childRendering = childRenderer.Render(element, engine);
                rowsBuffer.AppendLine($"\t\t<td>{childRendering.Content}</td>");
            }
        }
Example #28
0
        public override Brush GetMainSelectionBrush(RectangleF rectangle, RenderingEngine e)
        {
            if (_active)
            {
                var brush = new LinearGradientBrush(rectangle, Color.Black, Color.Black, 90, true);

                ColorBlend cb = new ColorBlend();

                cb.Positions = new[] { 0, 0.2f, 0.5f, 1 };
                cb.Colors    = new Color[]
                {
                    Color.FromArgb(120, 30, 144, 255), Color.FromArgb(80, 30, 144, 255), Color.FromArgb(80, 255, 144, 0), Color.FromArgb(60, 30, 160, 255)
                };

                brush.InterpolationColors = cb;

                return(brush);
            }
            else
            {
                return(base.GetMainBrush(rectangle, e));
            }
        }
        public HTTPBase(RenderingEngine RenderingEngine)
        {
            try
            {
                if (RenderingEngine == RenderingEngine.Gecko)
                {
                    if(!Xpcom.IsInitialized)
                        Xpcom.Initialize("Firefox");

                    Control = new GeckoWebBrowser();
                }
                else
                {
                    Control = new WebBrowser();
                }

                NewExtended();
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpConnectionFailed, ex);
            }
        }
Example #30
0
        protected HTTPBase(RenderingEngine RenderingEngine)
        {
            try
            {
                if (RenderingEngine == RenderingEngine.Gecko)
                {
                    if (!Xpcom.IsInitialized)
                    {
                        Xpcom.Initialize("Firefox");
                    }

                    Control = new GeckoWebBrowser();
                }
                else
                {
                    Control = new WebBrowser();
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpConnectionFailed, ex);
            }
        }
Example #31
0
        public IRendering Render(object source, RenderingEngine engine = null)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            switch (source)
            {
            case IEnumerable sequence:
                var sourceType = RendererUtilities.GetSequenceElementTypeOrKeyValuePairValueType(sequence);
                var accessors  = RendererUtilities.GetAccessors(sourceType).ToList();
                var headers    = RendererUtilities.CreateTableHeaders(accessors, false);
                var rows       = RendererUtilities.CreateTableRowsFromValues(accessors, sequence, engine);
                var table      = $@"<table>
{headers}
{rows}
</table>";
                return(new HtmlRendering(table));

            default:
                throw new ArgumentOutOfRangeException($"Sequence type {source.GetType()} not supported ");
            }
        }
Example #32
0
        public ITemplateSetSyntax Add(string alias, string name, RenderingEngine engine)
        {
            Argument.NotNullOrEmpty("alias", alias);
            Argument.NotNullOrEmpty("name", name);

            var fileSystem = GetFileSystem(engine);
            var fileName   = GetFileName(alias, engine);
            var filePath   = fileSystem.GetFullPath(fileName);

            if (!fileSystem.FileExists(fileName))
            {
                throw new NotSupportedException($"Cannot add a template: file '{filePath}' does not exist. Migration can only create templates from existing files.");
            }

            var content = fileSystem.ReadAllText(fileName);

            var template = Services.FileService.GetTemplate(alias);

            if (template == null)
            {
                template = new Template(filePath, name, alias);
            }
            else if (template.Name != name)
            {
                template = new Template(filePath, name, alias)
                {
                    Id         = template.Id,
                    CreateDate = template.CreateDate
                };
            }

            template.Content = content;
            Services.FileService.SaveTemplate(template);
            Logger.Log($"Template: added '{name}' (alias: '{alias}', {engine}).");
            return(NewSet(template));
        }
 public DesktopPlayerControl()
 {
     parser = new RdapMessageParser(parserStream);
     engine = new RenderingEngine(RenderBitmap);
     InitializeComponent();
 }
 public ProtocolHTTPS(RenderingEngine RenderingEngine)
     : base(RenderingEngine)
 {
 }
Example #35
0
		/// <summary>
		/// Rewrites to the correct Umbraco handler, either WebForms or Mvc
		/// </summary>		
		/// <param name="context"></param>
		/// <param name="currentQuery"></param>
		/// <param name="engine"> </param>
		private void RewriteToUmbracoHandler(HttpContext context, string currentQuery, RenderingEngine engine)
		{

			//NOTE: We do not want to use TransferRequest even though many docs say it is better with IIS7, turns out this is
			//not what we need. The purpose of TransferRequest is to ensure that .net processes all of the rules for the newly
			//rewritten url, but this is not what we want!
			// http://forums.iis.net/t/1146511.aspx

			string rewritePath;
			switch (engine)
			{
				case RenderingEngine.Mvc:
					//the Path is normally ~/umbraco but we need to remove the start ~/ of it and if someone modifies this
					//then we should be rendering the MVC stuff in that location.
					rewritePath = "~/"
						+ GlobalSettings.Path.TrimStart(new[] { '~', '/' }).TrimEnd(new[] { '/' })
						+ "/RenderMvc";
					// we rewrite the path to the path of the handler (i.e. default.aspx or /umbraco/RenderMvc )
					context.RewritePath(rewritePath, "", currentQuery.TrimStart(new[] { '?' }), false);

					//if it is MVC we need to do something special, we are not using TransferRequest as this will 
					//require us to rewrite the path with query strings and then reparse the query strings, this would 
					//also mean that we need to handle IIS 7 vs pre-IIS 7 differently. Instead we are just going to create
					//an instance of the UrlRoutingModule and call it's PostResolveRequestCache method. This does:
					// * Looks up the route based on the new rewritten URL
					// * Creates the RequestContext with all route parameters and then executes the correct handler that matches the route
					//we also cannot re-create this functionality because the setter for the HttpContext.Request.RequestContext is internal
					//so really, this is pretty much the only way without using Server.TransferRequest and if we did that, we'd have to rethink
					//a bunch of things!

					var urlRouting = new UrlRoutingModule();
					urlRouting.PostResolveRequestCache(new HttpContextWrapper(context));

					break;
				case RenderingEngine.WebForms:
				default:
					rewritePath = "~/default.aspx";
					// rewrite the path to the path of the handler (i.e. default.aspx or /umbraco/RenderMvc )
					context.RewritePath(rewritePath, "", currentQuery.TrimStart(new[] { '?' }), false);

					break;
			}

		}
 public HTTPS(RenderingEngine RenderingEngine)
     : base(RenderingEngine)
 {
 }
        private void UpdateRenderingEngine(RenderingEngine engine)
        {
            //Local variables

            // C:\\inetpub\\wwwroot\\UmbracoWebsite5\\UmbracoWebsite5
            var rootFolder = umbracoSitePath;

            // C:\\inetpub\\wwwroot\\UmbracoWebsite5\\UmbracoWebsite5\\config\
            var path = rootFolder + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar;

            // C:\\inetpub\\wwwroot\\UmbracoWebsite5\\UmbracoWebsite5\\config\umbracoSettings.config
            var filePath = path + "umbracoSettings.config";

            //Template mode (Mvc or WebForms)
            var value = engine;

            //Load the config file as xml
            var xml = new XmlDocument();

            try
            {
                using (XmlReader reader = XmlReader.Create(filePath))
                {
                    //Load XML
                    xml.Load(reader);
                }

                //Find the correct node for the 'defaultRenderingEngine' and update the value
                if (xml.DocumentElement != null)
                {
                    //Get the defaultRendering engine XML node, so we can update it's value
                    var node = xml.DocumentElement.SelectSingleNode("/settings/templates/defaultRenderingEngine");

                    if (node != null)
                    {
                        //Update the value in the XML
                        node.InnerText = value.ToString();
                    }
                }

                //Save file
                xml.Save(filePath);

            }
            catch (Exception ex)
            {
                //Otherwise disable the button & show error message
                MessageBox.Show("Exception: " + ex.Message, "Update Rendering Engine Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }