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
private static (string output, int exitCode) Control(string str) | |
{ | |
Process p = new Process(); | |
p.StartInfo.FileName = "cmd.exe"; | |
p.StartInfo.UseShellExecute = false; //是否使用操作系统shell启动 | |
p.StartInfo.RedirectStandardInput = true; //接受来自调用程序的输入信息 | |
p.StartInfo.RedirectStandardOutput = true; //由调用程序获取输出信息 | |
p.StartInfo.RedirectStandardError = true; //重定向标准错误输出 | |
p.StartInfo.CreateNoWindow = true; //不显示程序窗口 | |
p.StartInfo.StandardOutputEncoding = Encoding.UTF8;//Encoding.GetEncoding("GBK");//乱码 |
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
private static int TryParseProject(DTE dte, List<string> project) | |
{ | |
int noLoadProjectCount = 0; | |
foreach (var temp in dte.Solution.Projects) | |
{ | |
try | |
{ | |
if (temp is Project) | |
{ |
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.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
namespace lindexi.wpf.Solution | |
{ | |
public class Solution |
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) |