Skip to content

Instantly share code, notes, and snippets.

@SirJson
Created October 16, 2020 03:51
Show Gist options
  • Save SirJson/027a19afd755d82453752762a40b92f0 to your computer and use it in GitHub Desktop.
Save SirJson/027a19afd755d82453752762a40b92f0 to your computer and use it in GitHub Desktop.
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