Another general .NET expansion library for stuff I find useful.
static string SendWebRequest(string url, bool quick = false, string postData = null, string userAgent = null, string referrer = null)
Send a WebRequest (with a timeout of 1000ms). Returns an empty string on timeout.
Read a file without locking it.
Writes a file in another thread.
Writes a file to the specified path.
Generate a random string. Not cryptographically secure.
void RunThread(Action func, Action exceptionCallback = null, ThreadPriority threadPriority = ThreadPriority.Normal)
Performs an action in a threadsafe environment.
Pause the current thread while all other threads finish.
The number of currently running threads.
Concatenates the members of a collection, using the specified separator between each member. This is a wrapper for the String.Join function.
Adds a directory separator char to the end of a path if there is not one already.
Returns the string with all invalid path characters filtered.
Returns the string with all invalid filename characters filtered.
Returns the next value from the System.Security.Cryptography.RandomNumberGenerator.
Returns the next value from the System.Security.Cryptography.RandomNumberGenerator.
Generate a random string. Not cryptographically secure.
Generate a cryptographically secure random string.
Represents a strongly typed list of objects that can be indexed by index. The list appears to repeat infinitely (e.g. for a list of length 2, the zero-based index '2' will return the first value).
var looped = new BExpansion.Collections.LoopedList<string>();
looped.Add("test1");
looped.Add("test2");
looped.Add("test3");
Assert.AreEqual("test1", looped[0]);
Assert.AreEqual("test2", looped[1]);
Assert.AreEqual("test3", looped[2]);
Assert.AreEqual("test1", looped[3]);
Assert.AreEqual("test2", looped[4]);
Assert.AreEqual("test3", looped[5]);