C#判断VS是否处于设计模式
public class CheckDesingModel { public static bool IsDesingMode() { bool ReturnFlag = false; if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) ReturnFlag = true; else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv") ReturnFlag = true; //if (ReturnFlag) // Msg.Warning("设计模式"); //else Msg.Warning("非设计模式!"); return ReturnFlag; } }
public static bool isDebug(HttpRequestMessage request) { if (request == null) { return System.Diagnostics.Process.GetCurrentProcess().ProcessName == "iisexpress"; } else { string sign = request.Headers.Contains("sign") ? request.Headers.GetValues("sign").FirstOrDefault() : ""; bool result = (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "iisexpress") && (sign == "GarsonZhang2017"); //bool result = sign == "GarsonZhang2017"; return result; } }
慎于行,敏于思!GGGGGG