<commit_before>﻿using System;
using System.Drawing;
using System.Windows.Forms;

using BeerViewer.Framework;
using BeerViewer.Models;
using BeerViewer.Models.Raw;

namespace BeerViewer.Forms.Controls
{
	internal class ExpeditionBar : FrameworkControl
	{
		public Fleet Fleet { get; private set; }

		public ExpeditionBar() : base()
		{
			this.Initialize();
		}
		public ExpeditionBar(int X, int Y) : base(X, Y)
		{
			this.Initialize();
		}
		public ExpeditionBar(int X, int Y, int Width, int Height) : base(X, Y, Width, Height)
		{
			this.Initialize();
		}

		private void Initialize()
		{
			this.Paint += this.OnPaint;
		}

		private void DrawBitmapNumber(Graphics g, string Text, Point pos, bool OnCenter, bool UseWhite)
		{
			int p = 4, h = 7;
			int p2 = p + 1, hh = h / 2;
			var table = "0123456789[]:";
			int x = -p2 + pos.X - (OnCenter ? Text.Length * p2 / 2 : 0);
			int y = pos.Y - (OnCenter ? hh : 0);

			foreach(var c in Text)
			{
				x += (c==' ' ? 2 : p2);

				int offset = table.IndexOf(c);
				if (offset< 0) continue;

				g.DrawImage(
					Constants.BitmapNumber,
					new Rectangle(x, y, p, h),
					new Rectangle(offset * p, UseWhite ? h : 0, p, h),
					GraphicsUnit.Pixel
				);
			}
		}
		private void OnPaint(object sender, PaintEventArgs e)
		{
			var g = e.Graphics;

			if (this.Fleet != null)
			{
				var expedition = this.Fleet.Expedition;
				var progress = expedition.Progress;

<<<<<<< HEAD
				if (expedition.IsInExecution && progress.Maximum > 0)
				{
					g.FillRectangle(Constants.brushActiveFace, this.ClientBound);

					g.FillRectangle(
						Constants.brushBlueAccent,
						new Rectangle(0, 0, this.ClientBound.Width * progress.Current / progress.Maximum, this.ClientBound.Height)
					);
					/*
					g.DrawString(
						string.Format("[{0}] {1}", expedition.Id, expedition.RemainingText),
						new Font(Constants.fontDefault.FontFamily, 8),
						Brushes.White,
						new Point(this.ClientBound.Width / 2, -1),
						new StringFormat { Alignment = StringAlignment.Center }
					);
					*/
					this.DrawBitmapNumber(
						g,
						string.Format("[{0}] {1}", expedition.Id, expedition.RemainingText),
						new Point(this.ClientBound.Width / 2, this.ClientBound.Height / 2),
						true, true
					);
				}
				else
				{
					g.FillRectangle(Constants.brushHoverFace, this.ClientBound);
=======
						g.FillRectangle(
							Constants.brushBlueAccent,
							new Rectangle(0, 0, this.ClientBound.Width * progress.Current / progress.Maximum, this.ClientBound.Height)
						);
						g.DrawString(
							string.Format("[{0}] {1}", expedition.Id, expedition.RemainingText),
							Constants.fontSmall,
							Brushes.White,
							new Point(this.ClientBound.Width / 2, -1),
							new StringFormat { Alignment = StringAlignment.Center }
						);
					}
					else
					{
						g.FillRectangle(Constants.brushHoverFace, this.ClientBound);
					}
>>>>>>> f8ec3fc9bb783c87a2a6b44ffe6a028601d34eca
				}
			}
		}

		public void SetFleet(Fleet Fleet)
		{
			this.Fleet = Fleet;
			if (this.Fleet != null)
				this.Fleet.Expedition.PropertyEvent(nameof(this.Fleet.Expedition.Progress), () => this.Invalidate());

			this.Visible = this.Fleet != null;
			this.Invalidate();
		}
	}
}<commit_msg>Conflict fix<commit_after>﻿using System;
using System.Drawing;
using System.Windows.Forms;

using BeerViewer.Framework;
using BeerViewer.Models;
using BeerViewer.Models.Raw;

namespace BeerViewer.Forms.Controls
{
	internal class ExpeditionBar : FrameworkControl
	{
		public Fleet Fleet { get; private set; }

		public ExpeditionBar() : base()
		{
			this.Initialize();
		}
		public ExpeditionBar(int X, int Y) : base(X, Y)
		{
			this.Initialize();
		}
		public ExpeditionBar(int X, int Y, int Width, int Height) : base(X, Y, Width, Height)
		{
			this.Initialize();
		}

		private void Initialize()
		{
			this.Paint += this.OnPaint;
		}

		private void DrawBitmapNumber(Graphics g, string Text, Point pos, bool OnCenter, bool UseWhite)
		{
			int p = 4, h = 7;
			int p2 = p + 1, hh = h / 2;
			var table = "0123456789[]:";
			int x = -p2 + pos.X - (OnCenter ? Text.Length * p2 / 2 : 0);
			int y = pos.Y - (OnCenter ? hh : 0);

			foreach(var c in Text)
			{
				x += (c==' ' ? 2 : p2);

				int offset = table.IndexOf(c);
				if (offset< 0) continue;

				g.DrawImage(
					Constants.BitmapNumber,
					new Rectangle(x, y, p, h),
					new Rectangle(offset * p, UseWhite ? h : 0, p, h),
					GraphicsUnit.Pixel
				);
			}
		}
		private void OnPaint(object sender, PaintEventArgs e)
		{
			var g = e.Graphics;

			if (this.Fleet != null)
			{
				var expedition = this.Fleet.Expedition;
				var progress = expedition.Progress;

				if (expedition.IsInExecution && progress.Maximum > 0)
				{
					g.FillRectangle(Constants.brushActiveFace, this.ClientBound);

					g.FillRectangle(
						Constants.brushBlueAccent,
						new Rectangle(0, 0, this.ClientBound.Width * progress.Current / progress.Maximum, this.ClientBound.Height)
					);
					this.DrawBitmapNumber(
						g,
						string.Format("[{0}] {1}", expedition.Id, expedition.RemainingText),
						new Point(this.ClientBound.Width / 2, this.ClientBound.Height / 2),
						true, true
					);
				}
				else
				{
					g.FillRectangle(Constants.brushHoverFace, this.ClientBound);
				}
			}
		}

		public void SetFleet(Fleet Fleet)
		{
			this.Fleet = Fleet;
			if (this.Fleet != null)
				this.Fleet.Expedition.PropertyEvent(nameof(this.Fleet.Expedition.Progress), () => this.Invalidate());

			this.Visible = this.Fleet != null;
			this.Invalidate();
		}
	}
}
{'fraction_non_alphanumeric': 0.13462922966162708, 'fraction_numerical': 0.016918646508279338, 'mean_word_length': 2.8140013726835966, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5989356', 'n_tokens_mistral': 2485, 'n_tokens_neox': 1894, 'n_words': 431}