This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Security.Permissions; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace TplTest | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationHostParser | |
{ | |
public void GetSites() | |
{ | |
string xml = File.ReadAllText("applicationHost.config"); | |
XDocument doc = XDocument.Load(new StringReader(xml)); | |
IEnumerable<XElement> siteNode = doc.Document.Descendants().FirstOrDefault(x => x.Name.LocalName == "system.applicationHost").Descendants().Where(x => x.Name.LocalName == "sites"); | |
IEnumerable<XElement> sites = siteNode.Elements().Where(x => x.Name.LocalName == "site"); | |
Console.WriteLine("Found {0} sites", sites.Count()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nuget pack .\src\IisConfiguration\IisConfiguration.csproj -build -Properties Configuration=Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Writes the args to the default logging output using the format provided. | |
/// </summary> | |
public static void WriteLine(LoggingLevel level,string format, params object[] args) | |
{ | |
var name = new StackFrame(2,false).GetMethod().Name; | |
string prefix = string.Format("[{0} - {1}] ",level,name); | |
string message = string.Format(prefix + format, args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Options.cs | |
// | |
// Authors: | |
// Jonathan Pryor <jpryor@novell.com> | |
// | |
// Copyright (C) 2008 Novell (http://www.novell.com) | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining | |
// a copy of this software and associated documentation files (the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Returns the original summary for a member inherited from a specified type. | |
/// </summary> | |
/// <param name="memberID">The member ID to lookup.</param> | |
/// <param name="declaringType">The type that declares that member.</param> | |
/// <returns>The summary xml. If not found, returns an zero length string.</returns> | |
public string GetSummary(string memberID, Type declaringType) { | |
//extract member type (T:, P:, etc.) | |
string memberType = memberID.Substring(0, 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Open | |
C:\Users\username\AppData\Local\Google\Chrome\User Data\Default\User StyleSheets\Custom.css | |
and pasted this into it | |
*/ | |
.even { | |
padding: 10px !important; | |
font-family: Segoe UI !important; | |
border-bottom: 1px solid #EEE !important; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// Formats the provided XML so it's indented and humanly-readable. | |
/// | |
/// <param name="inputXml" />The input XML to format. | |
/// | |
public static string FormatXml(string inputXml) | |
{ | |
XmlDocument document = new XmlDocument(); | |
document.Load(new StringReader(inputXml)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var list = MimeType.Load(); | |
MimeType mimetype = list.FirstOrDefault(m => m.Extension == "jpg"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MimeType | |
{ | |
public string Extension { get; set; } | |
public string Value { get; set; } | |
public MimeType() | |
{ | |
Extension = ""; | |
Value = ""; | |
} |