Skip to content
Permalink
Browse files

cleanup ColorPicker

  • Loading branch information...
UnknownShadow200 committed May 31, 2017
1 parent 2279f13 commit ea44be1c925fb1b7dc7fa0aaee4412590a10920d
Showing with 10 additions and 23 deletions.
  1. +10 −22 ConfigGUI/ColorPicker.cs
  2. +0 −1 fCraft/Network/HttpUtil.cs
@@ -1,11 +1,9 @@
// Part of fCraft | Copyright 2009-2015 Matvei Stefarov <me@matvei.org> | BSD-3 | See LICENSE.txt //Copyright (c) 2011-2013 Jon Baker, Glenn Marien and Lao Tszy <Jonty800@gmail.com> //Copyright (c) <2012-2014> <LeChosenOne, DingusBungus> | ProCraft Copyright 2014-2016 Joseph Beauvais <123DMWM@gmail.com>
using System.Collections.Generic;
using System.Windows.Forms;
using SysCol = System.Drawing.Color;
using fCraft;
// Part of fCraft | Copyright 2009-2015 Matvei Stefarov <me@matvei.org> | BSD-3 | See LICENSE.txt | ProCraft Copyright 2014-2016 Joseph Beauvais <123DMWM@gmail.com>
using System.Windows.Forms;
using SysCol = System.Drawing.Color;

namespace fCraft.ConfigGUI {
internal sealed partial class ColorPicker : Form {
internal sealed class ColorPicker : Form {
public char ColorCode;

internal static SysCol LookupColor( char colCode, out SysCol textCol ) {
@@ -36,31 +34,21 @@ internal sealed partial class ColorPicker : Form {
return System.Math.Pow( (c + 0.055) / 1.055, 2.4 );
}


internal struct ColorPair {
public ColorPair( SysCol foreground, SysCol background ) {
Foreground = foreground;
Background = background;
}
public System.Drawing.Color Foreground;
public System.Drawing.Color Background;
}


public ColorPicker( string title, char oldColorCode ) {
ColorCode = oldColorCode;
StartPosition = FormStartPosition.CenterParent;

SuspendLayout();
for( char code = '0'; code <= '9'; code++ )
MakeButton(code);
MakeButton( code );
for( char code = 'a'; code <= 'f'; code++ )
MakeButton(code);

MakeButton( code );
for( int i = 0; i < Color.ExtColors.Length; i++ ) {
if( Color.ExtColors[i].Undefined ) continue;
MakeButton(Color.ExtColors[i].Code);
MakeButton( Color.ExtColors[i].Code );
}

MakeCancelButton();
MakeWindow( title );
ResumeLayout( false );
@@ -130,8 +118,8 @@ internal struct ColorPair {
}


static string ColorName(char colCode) {
char[] a = Color.GetName(colCode).ToCharArray();
static string ColorName( char colCode ) {
char[] a = Color.GetName( colCode ).ToCharArray();
a[0] = char.ToUpper( a[0] );
return new string( a );
}
@@ -42,7 +42,6 @@ public static class HttpUtil {
Logger.Log(LogType.Warning, "HttpUtil.LookupIPv4: {0} does not have an IPv4 address!", uri.Host);
} catch (UriFormatException) {
Logger.Log(LogType.Warning, "Invalid URI: The hostname could not be parsed.");

}

lock (dnsLock) { cache[hostName] = ip; }

0 comments on commit ea44be1

Please sign in to comment.
You can’t perform that action at this time.