Exemple #1
0
 /// <summary>
 /// Adds the elements of an array to the end of this LayoutCollection.
 /// </summary>
 /// <param name="items">
 /// The array whose elements are to be added to the end of this LayoutCollection.
 /// </param>
 public virtual void AddRange(ILayout[]items)
 {
     foreach (ILayout item in items)
     {
         this.List.Add(item);
     }
 }
 /// Apply a layout to a set of game objects
 public static void ApplyLayout(ILayout layout, IEnumerable<GameObject> objects)
 {
     foreach (var lp in layout.Layout(objects))
     {
         ApplyLayout(lp);
     }
 }
		/// <summary>
		/// Initializes the target as normal, except with a layout built-into the target
		/// </summary>
		/// <param name="targetConfig">The target config to build this target from</param>
		/// <param name="dispatcher">The dispatcher this target is attached to</param>
		/// <param name="synchronous">An override to the synchronous setting in the target config</param>
		public override void Initialize(TargetConfig targetConfig, LogEventDispatcher dispatcher = null, bool? synchronous = null)
		{
			// Initialize the base target as normal
			//  Add logic for initializing the layout as well
			base.Initialize(targetConfig, dispatcher, synchronous);
			if (targetConfig != null)
			{
				lock (_configLock)
				{
					// Check to see if the target configuration passed in is already a layout target configuration and initialize
					//  depending on this

					LayoutConfig layoutConfig = null;
					if (typeof(LayoutTargetConfig).IsAssignableFrom(targetConfig.GetType()))
					{
						layoutConfig = ((LayoutTargetConfig)targetConfig).LayoutConfig;
					}
					else
					{
						var layoutConfigToken = targetConfig.Config[LayoutTokenName];
						layoutConfig = new LayoutConfig(layoutConfigToken);
					}

					Layout = LayoutFactory.BuildLayout(layoutConfig);
				}
			}
			else
			{
				Name = DefaultTargetName;
				Layout = new StandardLayout();
			}
		}
		public bool CanAccept(ILayout layout, IView view)
		{
			IEnumerable<string> acceptableViewNames = (IEnumerable<string>)acceptableViewNamesPerLayout[layout.Name];
			if (acceptableViewNames == null)
				return layout.Name == view.Name;
			return acceptableViewNames.Contains(view.Name);
		}
        public LayoutSettingsControl(LiveSplit.UI.LayoutSettings settings, ILayout layout)
        {
            InitializeComponent();
            Settings = settings;
            Layout = layout;
            chkBestSegments.DataBindings.Add("Checked", Settings, "ShowBestSegments", false, DataSourceUpdateMode.OnPropertyChanged);
            chkAlwaysOnTop.DataBindings.Add("Checked", Settings, "AlwaysOnTop", false, DataSourceUpdateMode.OnPropertyChanged);
            chkAntiAliasing.DataBindings.Add("Checked", Settings, "AntiAliasing", false, DataSourceUpdateMode.OnPropertyChanged);
            chkDropShadows.DataBindings.Add("Checked", Settings, "DropShadows", false, DataSourceUpdateMode.OnPropertyChanged);
            chkRainbow.DataBindings.Add("Checked", Settings, "UseRainbowColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnTextColor.DataBindings.Add("BackColor", Settings, "TextColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnBackground.DataBindings.Add("BackColor", Settings, "BackgroundColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnBackground2.DataBindings.Add("BackColor", Settings, "BackgroundColor2", false, DataSourceUpdateMode.OnPropertyChanged);
            btnThinSep.DataBindings.Add("BackColor", Settings, "ThinSeparatorsColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnSeparators.DataBindings.Add("BackColor", Settings, "SeparatorsColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnPB.DataBindings.Add("BackColor", Settings, "PersonalBestColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnGlod.DataBindings.Add("BackColor", Settings, "BestSegmentColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnAheadGaining.DataBindings.Add("BackColor", Settings, "AheadGainingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnAheadLosing.DataBindings.Add("BackColor", Settings, "AheadLosingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnBehindGaining.DataBindings.Add("BackColor", Settings, "BehindGainingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnBehindLosing.DataBindings.Add("BackColor", Settings, "BehindLosingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnNotRunning.DataBindings.Add("BackColor", Settings, "NotRunningColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnPausedColor.DataBindings.Add("BackColor", Settings, "PausedColor", false, DataSourceUpdateMode.OnPropertyChanged);
            btnShadowsColor.DataBindings.Add("BackColor", Settings, "ShadowsColor", false, DataSourceUpdateMode.OnPropertyChanged);
            lblTimer.DataBindings.Add("Text", this, "TimerFont", false, DataSourceUpdateMode.OnPropertyChanged);
            lblText.DataBindings.Add("Text", this, "SplitNamesFont", false, DataSourceUpdateMode.OnPropertyChanged);
            lblTimes.DataBindings.Add("Text", this, "MainFont", false, DataSourceUpdateMode.OnPropertyChanged);
            trkOpacity.DataBindings.Add("Value", this, "Opacity", false, DataSourceUpdateMode.OnPropertyChanged);
            trkImageOpacity.DataBindings.Add("Value", this, "ImageOpacity", false, DataSourceUpdateMode.OnPropertyChanged);
            trkBlur.DataBindings.Add("Value", this, "ImageBlur", false, DataSourceUpdateMode.OnPropertyChanged);

            cmbBackgroundType.SelectedItem = GetBackgroundTypeString(Settings.BackgroundType);
            originalBackgroundImage = Settings.BackgroundImage;
        }
 public LayoutSettingsControl(Options.LayoutSettings settings, ILayout layout)
 {
     InitializeComponent();
     Settings = settings;
     Layout = layout;
     chkBestSegments.DataBindings.Add("Checked", this, "ShowBestSegments", false, DataSourceUpdateMode.OnPropertyChanged);
     chkAlwaysOnTop.DataBindings.Add("Checked", this, "AlwaysOnTop", false, DataSourceUpdateMode.OnPropertyChanged);
     chkAntiAliasing.DataBindings.Add("Checked", this, "AntiAliasing", false, DataSourceUpdateMode.OnPropertyChanged);
     chkDropShadows.DataBindings.Add("Checked", this, "DropShadows", false, DataSourceUpdateMode.OnPropertyChanged);
     btnTextColor.DataBindings.Add("BackColor", this, "TextColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnBackground.DataBindings.Add("BackColor", this, "BackgroundColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnBackground2.DataBindings.Add("BackColor", this, "BackgroundColor2", false, DataSourceUpdateMode.OnPropertyChanged);
     btnThinSep.DataBindings.Add("BackColor", this, "ThinSeparatorsColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnSeparators.DataBindings.Add("BackColor", this, "SeparatorsColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnPB.DataBindings.Add("BackColor", this, "PersonalBestColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnAheadGaining.DataBindings.Add("BackColor", this, "AheadGainingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnAheadLosing.DataBindings.Add("BackColor", this, "AheadLosingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnBehindGaining.DataBindings.Add("BackColor", this, "BehindGainingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnBehindLosing.DataBindings.Add("BackColor", this, "BehindLosingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnGlod.DataBindings.Add("BackColor", this, "BestSegmentColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnNotRunning.DataBindings.Add("BackColor", this, "NotRunningColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnPausedColor.DataBindings.Add("BackColor", this, "PausedColor", false, DataSourceUpdateMode.OnPropertyChanged);
     btnShadowsColor.DataBindings.Add("BackColor", this, "ShadowsColor", false, DataSourceUpdateMode.OnPropertyChanged);
     lblTimer.DataBindings.Add("Text", this, "TimerFont", false, DataSourceUpdateMode.OnPropertyChanged);
     lblText.DataBindings.Add("Text", this, "SplitNamesFont", false, DataSourceUpdateMode.OnPropertyChanged);
     lblTimes.DataBindings.Add("Text", this, "MainFont", false, DataSourceUpdateMode.OnPropertyChanged);
     trkOpacity.DataBindings.Add("Value", this, "Opacity", false, DataSourceUpdateMode.OnPropertyChanged);
     cmbGradientType.DataBindings.Add("SelectedItem", this, "GradientString", false, DataSourceUpdateMode.OnPropertyChanged);
     cmbGradientType.SelectedIndexChanged += cmbGradientType_SelectedIndexChanged;
 }
        public int CreateLayoutNode(XmlDocument document, XmlElement parent, ILayout layout)
        {
            XmlElement element = null, components = null;
            if (document != null)
            {
                element = document.CreateElement("Settings");
                components = document.CreateElement("Components");
            }

            var hashCode = SettingsHelper.CreateSetting(document, parent, "Mode", layout.Mode)
                ^ SettingsHelper.CreateSetting(document, parent, "X", layout.X)
                ^ SettingsHelper.CreateSetting(document, parent, "Y", layout.Y)
                ^ SettingsHelper.CreateSetting(document, parent, "VerticalWidth", layout.VerticalWidth)
                ^ SettingsHelper.CreateSetting(document, parent, "VerticalHeight", layout.VerticalHeight) * 1000
                ^ SettingsHelper.CreateSetting(document, parent, "HorizontalWidth", layout.HorizontalWidth)
                ^ SettingsHelper.CreateSetting(document, parent, "HorizontalHeight", layout.HorizontalHeight) * 1000
                ^ ToElement(document, element, layout.Settings);

            if (document != null)
            {
                parent.AppendChild(element);
                parent.AppendChild(components);
            }

            var layoutComponents = new List<ILayoutComponent>(layout.LayoutComponents);
            var count = 1;

            foreach (var component in layoutComponents)
            {
                try
                {
                    if (document != null)
                    {
                        var componentElement = document.CreateElement("Component");
                        components.AppendChild(componentElement);
                        SettingsHelper.CreateSetting(document, componentElement, "Path", component.Path);
                        var settings = document.CreateElement("Settings");

                        settings.InnerXml = component.Component.GetSettings(document).InnerXml;

                        componentElement.AppendChild(settings);
                    }
                    else
                    {
                        var type = component.Component.GetType();
                        if (type.GetMethod("GetSettingsHashCode") != null)
                            hashCode ^= ((dynamic)component.Component).GetSettingsHashCode() ^ component.GetHashCode() * count;
                        else
                            hashCode ^= component.Component.GetSettings(new XmlDocument()).InnerXml.GetHashCode() ^ component.GetHashCode() * count;
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
                count++;
            }

            return hashCode;
        }
		/// <summary>
		/// Constructs a group of objects to a layout
		/// </summary>
		/// <param name="layout">Layout used to print objects</param>
		/// <param name="obj">Object to print</param>
		/// <param name="times">Times to print</param>
		public RepeatedObject(ILayout layout, object obj, int times) : base(layout)
		{
			if (times < 0)
				throw new ArgumentException("Times cannot be negative!", "times");

			this.obj   = obj;
			this.times = times;
		}
        public TextBoxBaseAppender(ThreadSafeTextBoxWrapper textboxWrapper, ILayout layout)
        {
            if (textboxWrapper == null) throw new ArgumentNullException("textboxWrapper");
            controlWrapper = textboxWrapper;
            isRichTextBox = (controlWrapper is ThreadSafeRichTextBoxWrapper);

            base.Layout = layout ?? new PatternLayout(defaultLayout);
        }
Exemple #10
0
 public LayoutViewModel(ILayout entity)
 {
     HeadHtml = entity.HeadHtml;
     HeadStyles = entity.HeadStyles;
     HeadScripts = entity.HeadScripts;
     BodyHtmlPreContent = entity.BodyHtmlPreContent;
     BodyHtmlPostContent = entity.BodyHtmlPostContent;
     BodyScripts = entity.BodyScripts;
 }
Exemple #11
0
 public void SetLayout(ILayout newLayout)
 {
     _layout = newLayout;
     foreach (IWindow window in Windows)
     {
         _layout.AddWindowsWithoutTile(window);
     }
     _layout.Domain = Domain;
     _layout.Tile();
 }
Exemple #12
0
		private static void ArrangeLimit(ILayout limit, Action<Rect<double>> setPosition, Point<double> boxCompositionOrigin, Unit fs, List<Point<double>> positions, NonoverlappingRectangleCollectiοn resultLayout_fs)
		{
			Contract.Requires(limit != null);

			NonoverlappingRectangleCollectiοn limitLayout = limit.Layout;
			Rect<double> limitRect = limitLayout.Bounds.ToReferenceFramesRect(fs, positions.Count == 1 ? "lower limit" : "upper limit");
			setPosition(limitRect);
			Contract.Assert(limitRect.IsAssociatedWith(boxCompositionOrigin));
			positions.Add(limitRect.TopLeft);
			resultLayout_fs.Add(limitLayout, limitRect.HorizontalOrigin[boxCompositionOrigin.X][fs], limitRect.VerticalOrigin[boxCompositionOrigin.Y][fs]);
		}
Exemple #13
0
		protected Layout (Generator g, Container container, Type type, bool initialize = true)
			: base(g, type, false)
		{
			handler = (ILayout)Handler;
			this.container = container;
			if (initialize) {
				Initialize ();
				if (this.Container != null)
					this.Container.Layout = this;
			}
		}
Exemple #14
0
        public void Save(ILayout layout, Stream stream)
        {
            var document = new XmlDocument();

            XmlNode docNode = document.CreateXmlDeclaration("1.0", "UTF-8", null);
            document.AppendChild(docNode);

            document.AppendChild(GetLayoutNode(document, layout));

            document.Save(stream);
        }
        private void BuildLayout()
        {
            if (m_Words == null) { return; }

            using (Graphics graphics = this.CreateGraphics())
            {
                IGraphicEngine graphicEngine =
                    new GdiGraphicEngine(graphics, this.Font.FontFamily, FontStyle.Regular, m_Palette, MinFontSize, MaxFontSize, m_MinWordWeight, m_MaxWordWeight);
                m_Layout = LayoutFactory.CrateLayout(m_LayoutType, this.Size);
                m_Layout.Arrange(m_Words, graphicEngine);
            }
        }
        internal static string GetXmlString(this LoggingEvent loggingEvent, ILayout layout = null)
        {
            string message = loggingEvent.RenderedMessage + Environment.NewLine + loggingEvent.GetExceptionString();
            if (layout != null)
            {
                using (var w = new StringWriter())
                {
                    layout.Format(w, loggingEvent);
                    message = w.ToString();
                }
            }

            var logXml = new XElement(
                "LogEntry",
                new XElement("UserName", loggingEvent.UserName),
                new XElement("TimeStamp",
                    loggingEvent.TimeStamp.ToString(CultureInfo.InvariantCulture)),
                new XElement("ThreadName", loggingEvent.ThreadName),
                new XElement("LoggerName", loggingEvent.LoggerName),
                new XElement("Level", loggingEvent.Level),
                new XElement("Identity", loggingEvent.Identity),
                new XElement("Domain", loggingEvent.Domain),
                new XElement("CreatedOn", DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)),
                new XElement("RenderedMessage", message),
                new XElement("Location", loggingEvent.LocationInformation.FullInfo)
                );

            if (loggingEvent.Properties != null && loggingEvent.Properties.Count > 0)
            {
                var props = loggingEvent.Properties;
                if (props.Contains("AddPropertiesToXml"))
                {
                    foreach (var k in props.GetKeys())
                    {
                        var key = k.Replace(":", "_")
                                   .Replace("@", "_")
                                   .Replace(".", "_");
                        logXml.Add(new XElement(key, props[k].ToString()));
                    }
                }
            }

            if (loggingEvent.ExceptionObject != null)
            {
                logXml.Add(new XElement("Exception", loggingEvent.ExceptionObject.ToString()));
            }

            return logXml.ToString();
        }
Exemple #17
0
 public void Config(ILogConfig cfg)
 {
     if (cfg != null)
     {
         this._layout = cfg.Layout;
         this._writer = cfg.Writer;
         this._level = cfg.GetLogLevel(this._name);
     }
     else
     {
         this._layout = NullLayout.Instance;
         this._writer = NullWriter.Instance;
         this._level = LogLevel.None;
     }
 }
        public static ILog CreateLoggerWithJsonHttpAppender(Type loggerForType, string url, ILayout layout = null)
        {
            var hierarchy = (Hierarchy)LogManager.GetRepository();

            hierarchy.Root.AddAppender(new JsonHttpAppender
            {
                Url = url,
                Layout = layout ?? new SimpleLayout(),
            });
            hierarchy.Root.Level = Level.All;
            hierarchy.Configured = true;
            
            var logger = LogManager.GetLogger(loggerForType);
            return logger;
        }
        public AzureLayoutLoggingEventEntity(LoggingEvent e, PartitionKeyTypeEnum partitionKeyType, ILayout layout)
        {
            Level = e.Level.ToString();
            Message = e.RenderedMessage + Environment.NewLine + e.GetExceptionString();
            ThreadName = e.ThreadName;
            EventTimeStamp = e.TimeStamp;
            using (var w = new StringWriter())
            {
                layout.Format(w, e);
                Message = w.ToString();
            }

            PartitionKey = e.MakePartitionKey(partitionKeyType);
            RowKey = e.MakeRowKey();
        }
        /////////////////////////////////////////////////////////////////////////////
        public static Tag _AddLayout( this Tag toTag, ILayout layout )
        {
            //var properties = layout.GetType().GetRuntimeProperties().Where( pi => pi.PropertyType.;
            var type = layout.GetType();
            var properties = type.GetProperties( BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly );

            //
            // need to insert stuff in tag, but could be one or many
            //

            //toTag.AddChild()
            //   layout.Initialize( toTag );

            return toTag;
        }
Exemple #21
0
        public WindowManager(PositionMarkerWindow positionMarkerWindow, ILayout layout)
        {
            this.layout = layout;
            this.positionMarkerWindow = positionMarkerWindow;

            WinEventWatcher.WindowMoving += OnWindowMoving;
            WinEventWatcher.WindowMoveEnd += OnWindowMoveEnd;
            WinEventWatcher.WindowClosed += OnWindowClosed;
            WinEventWatcher.WindowMinimized += OnWindowMinimized;
            WinEventWatcher.WindowRestored += OnWindowRestored;

            WinEventWatcher.WindowSizing += OnWindowSizing;

            MouseHelper.MouseMoved += OnMouseMoved;
        }
        public LayoutEditorDialog(ILayout layout, LiveSplitState state, Form form)
        {
            InitializeComponent();
            Form = form;
            Layout = layout;
            BindingList = new BindingList<ILayoutComponent>(Layout.LayoutComponents);
            ComponentsToDispose = new List<UI.Components.IComponent>();
            lbxComponents.DataSource = BindingList;
            lbxComponents.DisplayMember = "Component.ComponentName";
            LoadAllComponentsAvailable();

            rdoVertical.Checked = IsVertical;
            rdoHorizontal.Checked = IsHorizontal;
            rdoVertical.CheckedChanged += rdoVertical_CheckedChanged;

            CurrentState = state;
            var itemDragger = new ListBoxItemDragger(lbxComponents, form);
            itemDragger.DragCursor = Cursors.SizeAll;
        }
Exemple #23
0
        /// <summary>
        /// The add console appender.
        /// </summary>
        /// <param name="hierarchy">
        /// The hierarchy.
        /// </param>
        /// <param name="layout">
        /// The layout.
        /// </param>
        private static void AddConsoleAppender(Hierarchy hierarchy, ILayout layout)
        {
            var consoleAppender = new ColoredConsoleAppender { Layout = layout };
            consoleAppender.AddMapping(
                new ColoredConsoleAppender.LevelColors
                    {
                        Level = Level.Fatal,
                        BackColor =
                            ColoredConsoleAppender.Colors.Purple | ColoredConsoleAppender.Colors.HighIntensity,
                        ForeColor = ColoredConsoleAppender.Colors.White
                    });

            consoleAppender.AddMapping(
                new ColoredConsoleAppender.LevelColors
                    {
                        Level = Level.Error,
                        ForeColor = ColoredConsoleAppender.Colors.Red | ColoredConsoleAppender.Colors.HighIntensity
                    });

            consoleAppender.AddMapping(
                new ColoredConsoleAppender.LevelColors
                    {
                        Level = Level.Warn,
                        ForeColor =
                            ColoredConsoleAppender.Colors.Yellow | ColoredConsoleAppender.Colors.HighIntensity
                    });

            consoleAppender.AddMapping(
                new ColoredConsoleAppender.LevelColors
                    {
                        Level = Level.Info,
                        ForeColor = ColoredConsoleAppender.Colors.White | ColoredConsoleAppender.Colors.HighIntensity
                    });

            consoleAppender.AddMapping(
                new ColoredConsoleAppender.LevelColors { Level = Level.Debug, ForeColor = ColoredConsoleAppender.Colors.White });

            consoleAppender.AddFilter(
                new LevelRangeFilter { AcceptOnMatch = true, LevelMin = AppUtil.IsDebugBuild ? Level.Debug : Level.Info, LevelMax = Level.Fatal });

            consoleAppender.ActivateOptions();
            hierarchy.Root.AddAppender(consoleAppender);
        }
Exemple #24
0
        public XmlNode GetLayoutNode(XmlDocument document, ILayout layout)
        {
            var parent = document.CreateElement("Layout");
            var version = document.CreateAttribute("version");
            version.Value = "1.3";
            parent.Attributes.Append(version);

            parent.AppendChild(SettingsHelper.ToElement(document, "Mode", layout.Mode));
            parent.AppendChild(SettingsHelper.ToElement(document, "X", layout.X));
            parent.AppendChild(SettingsHelper.ToElement(document, "Y", layout.Y));
            parent.AppendChild(SettingsHelper.ToElement(document, "VerticalWidth", layout.VerticalWidth));
            parent.AppendChild(SettingsHelper.ToElement(document, "VerticalHeight", layout.VerticalHeight));
            parent.AppendChild(SettingsHelper.ToElement(document, "HorizontalWidth", layout.HorizontalWidth));
            parent.AppendChild(SettingsHelper.ToElement(document, "HorizontalHeight", layout.HorizontalHeight));

            parent.AppendChild(ToElement(document, layout.Settings));

            var components = document.CreateElement("Components");
            parent.AppendChild(components);

            var layoutComponents = new List<ILayoutComponent>(layout.LayoutComponents);

            foreach (var component in layoutComponents)
            {
                var componentElement = document.CreateElement("Component");
                components.AppendChild(componentElement);
                componentElement.AppendChild(SettingsHelper.ToElement(document, "Path", component.Path));
                var settings = document.CreateElement("Settings");
                try
                {
                    settings.InnerXml = component.Component.GetSettings(document).InnerXml;
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
                componentElement.AppendChild(settings);
            }

            return parent;
        }
Exemple #25
0
        public Workspace(Monitor monitor, ILayout layout, IEnumerable<IBar> barsAtTop = null, IEnumerable<IBar> barsAtBottom = null,
			string name = null, bool showWindowsTaskbar = false, bool repositionOnSwitchedTo = false)
        {
            windows = new LinkedList<Window>();

            this.id = ++count;
            this.Monitor = monitor;
            this.Layout = layout;
            this.barsAtTop = Screen.AllScreens.Select(_ => new LinkedList<IBar>()).ToArray();
            this.barsAtBottom = Screen.AllScreens.Select(_ => new LinkedList<IBar>()).ToArray();
            if (barsAtTop != null)
            {
                barsAtTop.ForEach(bar => this.barsAtTop[bar.Monitor.monitorIndex].AddLast(bar));
            }
            if (barsAtBottom != null)
            {
                barsAtBottom.ForEach(bar => this.barsAtBottom[bar.Monitor.monitorIndex].AddLast(bar));
            }
            this.name = name;
            this.ShowWindowsTaskbar = showWindowsTaskbar;
            this.repositionOnSwitchedTo = repositionOnSwitchedTo;
            layout.Initialize(this);
        }
Exemple #26
0
 public TextWriterAppender(ILayout layout, TextWriter writer)
 {
     Layout = layout;
     Writer = writer;
 }
Exemple #27
0
 public EnumLayout(Type enumType, ILayout underlyingIntegralLayout) :
     base(enumType, underlyingIntegralLayout.Size, underlyingIntegralLayout.NaturalAlignment)
 {
     _underlyingIntegralLayout = underlyingIntegralLayout;
 }
Exemple #28
0
 protected Appender(ILayout layout)
 {
     this.Layout       = layout;
     this.MessageCount = 0;
 }
 public HorizontalLayout(ILayout parent, string text = null) :
     base(parent)
 {
     Argument.NotNull(() => parent);
     mText = text;
 }
 public ConsoleAppender(ILayout layout, Level level) : base(layout, level)
 {
     this.writer = new ConsoleWriter();
 }
Exemple #31
0
 public FileAppender(ILayout layout)
     : base(layout)
 {
 }
Exemple #32
0
        public int CreateLayoutNode(XmlDocument document, XmlElement parent, ILayout layout)
        {
            XmlElement element = null, components = null;

            if (document != null)
            {
                element    = document.CreateElement("Settings");
                components = document.CreateElement("Components");
            }

            var hashCode = SettingsHelper.CreateSetting(document, parent, "Mode", layout.Mode)
                           ^ SettingsHelper.CreateSetting(document, parent, "X", layout.X)
                           ^ SettingsHelper.CreateSetting(document, parent, "Y", layout.Y)
                           ^ SettingsHelper.CreateSetting(document, parent, "VerticalWidth", layout.VerticalWidth)
                           ^ SettingsHelper.CreateSetting(document, parent, "VerticalHeight", layout.VerticalHeight) * 1000
                           ^ SettingsHelper.CreateSetting(document, parent, "HorizontalWidth", layout.HorizontalWidth)
                           ^ SettingsHelper.CreateSetting(document, parent, "HorizontalHeight", layout.HorizontalHeight) * 1000
                           ^ ToElement(document, element, layout.Settings);

            if (document != null)
            {
                parent.AppendChild(element);
                parent.AppendChild(components);
            }

            var layoutComponents = new List <ILayoutComponent>(layout.LayoutComponents);
            var count            = 1;

            foreach (var component in layoutComponents)
            {
                try
                {
                    if (document != null)
                    {
                        var componentElement = document.CreateElement("Component");
                        components.AppendChild(componentElement);
                        SettingsHelper.CreateSetting(document, componentElement, "Path", component.Path);
                        var settings = document.CreateElement("Settings");

                        settings.InnerXml = component.Component.GetSettings(document).InnerXml;

                        componentElement.AppendChild(settings);
                    }
                    else
                    {
                        var type = component.Component.GetType();
                        if (type.GetMethod("GetSettingsHashCode") != null)
                        {
                            hashCode ^= ((dynamic)component.Component).GetSettingsHashCode() ^ component.GetHashCode() * count;
                        }
                        else
                        {
                            hashCode ^= component.Component.GetSettings(new XmlDocument()).InnerXml.GetHashCode() ^ component.GetHashCode() * count;
                        }
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
                count++;
            }

            return(hashCode);
        }
        /// <summary>
        /// Sets up a rolling file appender using defaults shared for all our rolling file appenders.
        /// </summary>
        /// <param name="config">The configuration for the appender.</param>
        /// <param name="fileName">The name of the file this appender will write to.</param>
        /// <param name="appenderName">The name of this appender.</param>
        /// <remarks>This does not call appender.ActivateOptions or add the appender to the logger.</remarks>
        private static RollingFileAppender SetupRollingFileAppender(ILogConfig config, string fileName, string appenderName, ILayout layout)
        {
            var log = log4net.LogManager.GetLogger(typeof(AgentManager));

            // check that the log file is accessible
            try
            {
                using (File.Open(fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write)) { }
            }
            catch (Exception exception)
            {
                log.ErrorFormat("Unable to write the {0} log to \"{1}\": {2}", appenderName, fileName, exception.Message);
                throw;
            }

            try
            {
                var appender = new RollingFileAppender();

                appender.LockingModel       = GetFileLockingModel(config);
                appender.Layout             = layout;
                appender.File               = fileName;
                appender.Encoding           = System.Text.Encoding.UTF8;
                appender.AppendToFile       = true;
                appender.RollingStyle       = RollingFileAppender.RollingMode.Size;
                appender.MaxSizeRollBackups = 4;
                appender.MaxFileSize        = 50 * 1024 * 1024; // 50MB
                appender.StaticLogFileName  = true;
                appender.ImmediateFlush     = true;

                return(appender);
            }
            catch (Exception exception)
            {
                log.ErrorFormat("Unable to configure the {0} log file appender for \"{1}\": {2}", appenderName, fileName, exception.Message);
                throw;
            }
        }
Exemple #34
0
 public FormattedLoggingEvent(LoggingEvent @event, ILayout layout)
 {
     _event  = @event;
     _layout = layout;
 }
 public FileAppender(ILayout layout, string filename) : this(layout, filename, true)
 {
 }
Exemple #36
0
 public ViceAppender(ILayout layout)
 {
     Layout = layout;
     _verifications = new Dictionary<string, Expectation>();
 }
Exemple #37
0
 internal void AddCachedLayoutValue(ILayout layout, string value)
 {
     if (_layoutCache == null)
         _layoutCache = new HybridDictionary();
     _layoutCache[layout] = value;
 }
 public FileAppender(ILayout layout, Level level, IFile file)
 {
     this.Layout = layout;
     this.Level  = level;
     this.File   = file;
 }
Exemple #39
0
 public TextWriterAppender(ILayout layout, Stream os) : this(layout, new StreamWriter(os))
 {
 }
Exemple #40
0
 public ConsoleAppender(ILayout layout, Level level)
     : this()
 {
     this.Layout = layout;
     this.Level  = level;
 }
        public ScrollPanelWidget(ModData modData)
        {
            modRules = modData.DefaultRules;

            Layout = new ListLayout(this);
        }
Exemple #42
0
 public DebugAppender(ILayout layout)
 {
     Layout = layout;
 }
Exemple #43
0
 public ConsoleAppender(ILayout layout, Level level = Level.INFO)
 {
     this.AppendedCount = 0;
     this.Layout        = layout;
     this.ReportLevel   = level;
 }
 protected virtual void ApplyAttributesOfLayout(ILayout layout)
 {
 }
 protected Appender(ILayout layout)
 {
     this.Layout = layout;
 }
Exemple #46
0
 public FileAppender(ILayout layout, Level level, IFile file) : this()
 {
     Layout = layout;
     Level  = level;
     File   = file;
 }
Exemple #47
0
 public FileAppender(ILayout layout, ILogger logger)
 {
     Layout = layout;
     Logger = logger;
 }
Exemple #48
0
 public Appender(ILayout layout)
 {
     Layout = layout;
 }
Exemple #49
0
 public LayoutManager(ILayout layout)
 {
     Layout = layout;
 }
Exemple #50
0
 public static ILayoutEvents Events(this ILayout This)
 {
     return(new ILayoutEvents(This));
 }
Exemple #51
0
 public ConsoleAppender(ILayout layout)
     : base(layout)
 {
 }
    public void Act(int countOfAppenders)
    {
        IAppender[] appenders = new IAppender[countOfAppenders];

        for (int i = 0; i < countOfAppenders; i++)
        {
            var input = Console.ReadLine().Split();

            ILayout layout = null;

            switch (input[1])
            {
            case nameof(SimpleLayout):
                layout = new SimpleLayout();
                break;

            case nameof(XmlLayout):
                layout = new XmlLayout();
                break;

            default:
                throw new ArgumentException();
            }

            IAppender appender = null;

            switch (input[0])
            {
            case nameof(ConsoleAppender):
                appender = new ConsoleAppender(layout);
                break;

            case nameof(FileAppender):
                appender = new FileAppender(layout);
                ((FileAppender)appender).File = new LogFile();
                break;
            }

            if (input.Length == 3)
            {
                ReportLevel level = (ReportLevel)Enum.Parse(typeof(ReportLevel), input[2]);
                appender.ReportLevel = level;
            }

            appenders[i] = appender;
        }

        var logger = new Logger(appenders);


        string command;

        while ((command = Console.ReadLine()) != "END")
        {
            var input = command.Split('|');

            string time    = input[1];
            string message = input[2];

            ReportLevel level = (ReportLevel)Enum.Parse(typeof(ReportLevel), input[0]);

            switch (level)
            {
            case ReportLevel.CRITICAL:
                logger.Critical(time, message);
                break;

            case ReportLevel.ERROR:
                logger.Error(time, message);
                break;

            case ReportLevel.FATAL:
                logger.Fatal(time, message);
                break;

            case ReportLevel.INFO:
                logger.Info(time, message);
                break;

            case ReportLevel.WARNING:
                logger.Warn(time, message);
                break;
            }
        }

        Console.WriteLine(logger);
    }
 public TrackLayoutRenderer(ILayout <Track> layout, IEnumerable <IRenderer <Track> > renderers, IImageFactory imageFactory, ITerrainMap terrainMap)
     : base(layout, renderers, imageFactory, terrainMap)
 {
     this.Name    = "Tracks";
     this.Enabled = true;
 }
Exemple #54
0
 public ILayoutEvents(ILayout This)
 {
     this.This = This;
 }
Exemple #55
0
 internal string GetCachedLayoutValue(ILayout layout)
 {
     if (_layoutCache == null)
         return null;
     string result = (string)_layoutCache[layout];
     return result;
 }
Exemple #56
0
 public ConsoleAppender(ILayout layout)
 {
     Layout = layout;
 }
 public ConsoleAppender(ILayout layout)
     : base(layout)
 {
 }
 /// <summary>
 /// Construct a new adapter
 /// </summary>
 /// <param name="layout">the layout to adapt</param>
 /// <remarks>
 /// <para>
 /// Create the adapter for the specified <paramref name="layout"/>.
 /// </para>
 /// </remarks>
 public Layout2RawLayoutAdapter(ILayout layout)
 {
     m_layout = layout;
 }
Exemple #59
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CsvLayout"/> class.
 /// </summary>
 public CsvLayout()
 {
     _thisHeader = new CsvHeaderLayout(this);
 }
Exemple #60
0
 public FileAppender(ILayout layout, ILogFile logFile)
     : base(layout)
 {
     this.logFile = logFile;
 }