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.Diagnostics.CodeAnalysis; | |
using Windows.Foundation; | |
using Windows.UI.Xaml; | |
using Windows.UI.Xaml.Controls; | |
using Windows.UI.Xaml.Media; | |
namespace Common | |
{ | |
/// <summary> |
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 UnixConvert : JsonConverter | |
{ | |
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | |
{ | |
var time = ToUnixTimestamp((DateTime) value); | |
writer.WriteValue(time); | |
} | |
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | |
{ |
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 GitControl | |
{ | |
public GitControl(string fileDirectory) | |
{ | |
FileDirectory = fileDirectory; | |
} | |
/// <summary> | |
/// git的文件夹 | |
/// </summary> |
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 static class WildcardRegexString | |
{ | |
/// <summary> | |
/// 通配符转正则 | |
/// </summary> | |
/// <param name="wildcardStr"></param> | |
/// <returns></returns> | |
public static string GetWildcardRegexString(string wildcardStr) | |
{ | |
Regex replace = //new Regex("[.$^{\\[(|)*+?\\\\]"); |
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> | |
/// 获取csproj 所有文件,并获取文件生成选项 | |
/// Get all the files in the *.csproj | |
/// </summary> | |
/// <param name="doc">csproj 文件的XDocument</param> | |
/// <returns> | |
/// 文件路径和文件生成选项列表 | |
/// The List that include the file path and it's compile options | |
/// </returns> | |
public static List<PrjFile> GetPrjFile(XDocument doc) |
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 static class PasswordBoxHelper | |
{ | |
public static readonly DependencyProperty PasswordProperty = DependencyProperty.RegisterAttached( | |
"Password", typeof(string), typeof(PasswordBoxHelper), new PropertyMetadata(default(string),OnPasswordPropertyChanged)); | |
public static void SetPassword(DependencyObject element, string value) | |
{ | |
element.SetValue(PasswordProperty, 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
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, | |
() => | |
{ | |
}); |
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> | |
/// 判断私有ip | |
/// </summary> | |
/// <param name="myIPAddress"></param> | |
/// <returns></returns> | |
public static bool IsPrivateIP(IPAddress myIPAddress) | |
{ | |
if (IPAddress.IsLoopback(myIPAddress)) | |
{ |
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 static string Md5(string str) | |
{ | |
HashAlgorithmProvider hashAlgorithm = | |
HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Md5); | |
CryptographicHash cryptographic = hashAlgorithm.CreateHash(); | |
IBuffer buffer = CryptographicBuffer.ConvertStringToBinary(str, BinaryStringEncoding.Utf8); | |
cryptographic.Append(buffer); |
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 static class ImageStorage | |
{ | |
/// <summary> | |
/// 获取图片 | |
/// 如果本地存在,就获取本地 | |
/// 如果本地不存在,获取网络 | |
/// </summary> | |
/// <param name="uri"></param> | |
/// <returns></returns> | |
public static async Task<BitmapImage> GetImage(Uri uri) |