Skip to content

Instantly share code, notes, and snippets.

@SirJson
Created Oct 16, 2020
Embed
What would you like to do?
Prints all special folder on the current platform
using System;
using System.Reflection;
using static System.Console;
using static JSPrint;
public static class JSPrint {
private static int groupLevel = 0;
public static void Group()
{
groupLevel++;
}
public static void GroupEnd()
{
groupLevel--;
}
public static void Log(params object[] data)
{
var tabs = new string('\t', groupLevel);
var dashes = new string('-', groupLevel);
var msg = string.Format("[{0}] {1} {2} {3}", DateTime.Now, tabs, dashes, string.Join(", ", data));
WriteLine(msg);
}
}
class Dummy {
public string dummydata = "silly";
}
var doh = new Dummy();
Log("OS",Environment.OSVersion);
Group();
var specialFolder = Enum.GetValues(typeof(Environment.SpecialFolder));
foreach(var dir in specialFolder) {
Log(Enum.Parse<Environment.SpecialFolder>(dir.ToString()),Environment.GetFolderPath((Environment.SpecialFolder)dir));
}
Group();
Log("AssemblyLocation",typeof(Dummy).Assembly.Location);
GroupEnd();
GroupEnd();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment