Skip to content

Instantly share code, notes, and snippets.

View Bronzite's full-sized avatar

John Brewer Bronzite

  • HaystackID
  • Boston, MA
View GitHub Profile
@Bronzite
Bronzite / SplitString.cs
Created February 18, 2019 21:22
Short C# function to handle splitting strings with quotations and escapes without LINQ.
private static string[] SplitString (string sInput, char[] cDelimiters, char[] cQuotes, char cEscape)
{
List<string> retval = new List<string>();
bool bInQuotes = false;
bool bEscape = false;
char[] caInput = sInput.ToCharArray();
string sCurString = "";
for(int i=0;i<caInput.Length;i++)
{
@Bronzite
Bronzite / TSVFile.cs
Created November 17, 2018 18:32
Simple TSV File Reader
using System;
using System.Collections.Generic;
using System.IO;
namespace TSVFile
{
public class TSVFile:IDisposable
{
public string[] ColumnHeaders { get; set; }
public string[][] Values { get; set; }
### Keybase proof
I hereby claim:
* I am bronzite on github.
* I am bronzite (https://keybase.io/bronzite) on keybase.
* I have a public key ASCGsmO99vjL8ZxML66W1aAYNIfVdm1cCnzwqLmO1eBahAo
To claim this, I am signing this object:
@Bronzite
Bronzite / ObjectToColorHasher.cs
Created July 13, 2016 19:27
C# Hashing An Object Into a Color
private Color HashToColor(object o)
{
uint iHash = (uint)o.GetHashCode();
uint iR = (iHash & 0x000000FF);
uint iG = (iHash & 0x0000FF00)>> 8;
uint iB = (iHash & 0x00FF0000) >> 16;
return Color.FromArgb((int)iR, (int)iG, (int)iB);
}
@Bronzite
Bronzite / Logger.cs
Created April 21, 2016 13:59
An example Logger class that writes to a set of TextWriters that are put in its Outputs collection.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
namespace LoggerTest
{
public static class Logger
{