Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yetanotherchris's full-sized avatar
🔏
;ÿÿÿÿrules

Chris S. yetanotherchris

🔏
;ÿÿÿÿrules
View GitHub Profile
/// <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);
/// <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);
/* 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;
}
///
/// 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));
class Program
{
static void Main(string[] args)
{
var list = MimeType.Load();
MimeType mimetype = list.FirstOrDefault(m =&gt; m.Extension == "jpg");
}
}
public class MimeType
{
public string Extension { get; set; }
public string Value { get; set; }
public MimeType()
{
Extension = "";
Value = "";
}
@yetanotherchris
yetanotherchris / Install.txt.ini
Created July 25, 2012 19:27
Installer localization file
; Note: any line starting with ; is a comment!
; This file contains Roadkill Install page localization strings.
;
; Shared buttons and labels
Shared_Stage1=Welcome
Shared_Stage2=Database
Shared_Stage3=Security
Shared_Stage4=Extras
Shared_Stage5=Finished
@yetanotherchris
yetanotherchris / Site.txt.ini
Created July 25, 2012 19:28
Site wide strings for localization
; Note: any line starting with ; is a comment!
; This file contains Roadkill site-wide localization strings.
Navigation_Login=Login
Navigation_Logout=Logout
Navigation_LoggedInAs=Logged in as
Navigation_MainPage=Main Page
Navigation_Categories=Categories
Navigation_All pages=All pages
Navigation_NewPage=New page
<system.diagnostics>
<!-- Add multiple sources for varying levels of tracing -->
<sources>
<source name="debugSource" switchName="defaultSwitch" switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="eventLogListener" type="System.Diagnostics.EventLogTraceListener" initializeData="ASP.NET 2.0.50727.0" />
</listeners>
</source>
</sources>
<switches>
private TraceSource _traceSource = new TraceSource("defaultSource");
public void LogInformation(string message,object params args)
{
if ((_traceSource.Switch.Level & SourceLevels.Information) == SourceLevels.Information)
{
...
}
}