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
//http://stackoverflow.com/questions/852181/c-printing-all-properties-of-an-object | |
foreach(PropertyDescriptor descriptor in TypeDescriptor.GetProperties(obj)) | |
{ | |
string name=descriptor.Name; | |
object value=descriptor.GetValue(obj); | |
Console.WriteLine("{0}={1}",name,value); | |
} |
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 FileHelper | |
{ | |
/// <summary> | |
/// 返回文件扩展名 | |
/// </summary> | |
public static string GetExtension(string path) | |
{ | |
return Path.GetExtension(path); | |
} |
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.ComponentModel; | |
using System.IO; | |
using Newtonsoft.Json; | |
namespace Liulx.Util | |
{ | |
public class Config: INotifyPropertyChanged | |
{ |
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.Concurrent; | |
using System.IO; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Liulx.Util | |
{ | |
public class Log |
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.IO; | |
using System.Linq; | |
using Nancy; | |
using Nancy.Responses; | |
using Nancy.Responses.Negotiation; | |
namespace ByteArrayDemo | |
{ |
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; | |
namespace MimeTypes | |
{ | |
public static class MimeTypeMap | |
{ | |
private static readonly IDictionary<string, string> _mappings = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) { | |
#region Big freaking list of mime types |
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.Security.Cryptography; | |
using System.Text; | |
namespace MD5Sample | |
{ | |
class Program | |
{ | |
static void Main(string[] 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
//It's very simple: | |
using (var md5 = MD5.Create()) | |
{ | |
using (var stream = File.OpenRead(filename)) | |
{ | |
return md5.ComputeHash(stream); | |
} | |
} | |
//(I believe that actually the MD5 implementation used doesn't need to be disposed, but I'd probably still do so anyway.) |
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 HttpResponseMessage Post(string version, string environment, string filetype) | |
{ | |
var path = @"C:\Temp\test.exe"; | |
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); | |
var stream = new FileStream(path, FileMode.Open); | |
result.Content = new StreamContent(stream); | |
result.Content.Headers.ContentType = | |
new MediaTypeHeaderValue("application/octet-stream"); | |
return result; | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>items</key> | |
<array> | |
<dict> | |
<key>assets</key> | |
<array> | |
<dict> |
OlderNewer