Skip to content

Commit

Permalink
cleanup ColorPicker
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed May 31, 2017
1 parent 2279f13 commit ea44be1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
32 changes: 10 additions & 22 deletions ConfigGUI/ColorPicker.cs
Original file line number Diff line number Diff line change
@@ -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 ) {
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
}
Expand Down
1 change: 0 additions & 1 deletion fCraft/Network/HttpUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit ea44be1

Please sign in to comment.