public override int GetHashCode() { unchecked { var hashCode = (AppName != null ? AppName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AppLocation != null ? AppLocation.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AppArguments != null ? AppArguments.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AppIcon != null ? AppIcon.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (EnabledMods != null ? EnabledMods.GetHashCode() : 0); return(hashCode); } }
public virtual void TearDown() { try { this.Session.Rollback(); this.Session = null; } finally { try { // Bumb web.config to new date, causing a restart var webConfig = Enumerable.First <FileInfo>(AppLocation.GetFiles(), v => v.Name.ToLowerInvariant().Equals("web.config")); File.SetLastWriteTimeUtc(webConfig.FullName, DateTime.UtcNow); } finally { this.TearDownWebdriver(); } } }
public EnvironmentDetail(bool loadDetails) { if (!loadDetails) { return; } bool isWebRequest = false; #if NET451 || NET45 || NET40 try { isWebRequest = AppDomain.CurrentDomain.FriendlyName.Contains("W3SVC"); if (isWebRequest) { //regex test cases /* * /LM/W3SVC/1/ROOT/OpsManager-1-130294385752072113 * /LM/W3SVC/1/ROOT/Apps/StackifyAPI-3-130294479694571305 * /LM/W3SVC/1/ROOT/Apps/Num bers-3-4-130294481053328340 */ //var match = Regex.Match(AppDomain.CurrentDomain.FriendlyName, "/LM/W3SVC/(?<siteid>[\\d]+)/ROOT/(?<appname>[^\\/-]+)-"); var match = Regex.Match(AppDomain.CurrentDomain.FriendlyName, "/LM/W3SVC/(?<siteid>[\\d]+)/ROOT/(?<appname>.+)-[0-9]{1,3}-[\\d]{2,}$"); if (match.Success) { WebAppID = string.Format("W3SVC_{0}_ROOT_{1}", match.Groups["siteid"].Value, match.Groups["appname"].Value.Replace("/", "_")); } match = Regex.Match(AppDomain.CurrentDomain.FriendlyName, "/LM/W3SVC/(?<siteid>[\\d]+)/ROOT-[0-9]{1,3}-[\\d]{2,}$"); if (match.Success) { WebAppID = string.Format("W3SVC_{0}_ROOT", match.Groups["siteid"].Value); } if (WebAppID == null) { //just putting it here so we can get some visibility to it WebAppID = AppDomain.CurrentDomain.FriendlyName; } } } catch (Exception ex) { StackifyLib.Utils.StackifyAPILogger.Log("Error figuring out app environment details\r\n" + ex.ToString(), true); } #endif try { this.IsAzureWorkerRole = false; //Logger global properties would override everything if (!string.IsNullOrEmpty(Config.AppName)) { ConfiguredAppName = Config.AppName; } else { ConfiguredAppName = Config.Get("Stackify.AppName"); } if (!string.IsNullOrEmpty(Config.Environment)) { ConfiguredEnvironmentName = Config.Environment; } else { ConfiguredEnvironmentName = Config.Get("Stackify.Environment"); } //might be azure server. If it is, get the AppName from that GetAzureInfo(); #if NET451 || NET45 || NET40 //Not a web app, check for windows service if (!Environment.UserInteractive && !AppDomain.CurrentDomain.FriendlyName.Contains("W3SVC")) { IsWindowService(); } #endif DeviceName = GetDeviceName(); #if NET451 || NET45 || NET40 if (string.IsNullOrEmpty(AppName) && !isWebRequest) { AppName = AppDomain.CurrentDomain.FriendlyName; } AppLocation = AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\'); //is it in azure worker role? If so tweak the location if (AppDomain.CurrentDomain.FriendlyName.Equals("RdRuntime", StringComparison.OrdinalIgnoreCase) && AppLocation.IndexOf("approot", StringComparison.OrdinalIgnoreCase) > 0) { this.IsAzureWorkerRole = true; AppLocation = AppLocation.Replace("RdRuntime", "").TrimEnd('\\'); } else if (!isWebRequest) { AppLocation += "\\" + AppDomain.CurrentDomain.FriendlyName; //add the file name on the end } #else AppLocation = AppContext.BaseDirectory; #endif } catch (Exception ex) { StackifyLib.Utils.StackifyAPILogger.Log("Error figuring out app environment details\r\n" + ex.ToString(), true); } #if NET451 || NET45 || NET40 try { //if we do not have an appname still, use the app path or folder name if (string.IsNullOrEmpty(AppName) && isWebRequest && HostingEnvironment.ApplicationVirtualPath != null) { if (string.IsNullOrWhiteSpace(HostingEnvironment.ApplicationVirtualPath) || HostingEnvironment.ApplicationVirtualPath == "/") { if (AppLocation != null) { AppName = AppLocation.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).Last(); } } else { string[] paths = HostingEnvironment.ApplicationVirtualPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); AppName = paths.Last(); } } } catch (Exception ex) { StackifyLib.Utils.StackifyAPILogger.Log("Error figuring out app environment details\r\n" + ex.ToString(), true); } #endif }
public MainPageViewModel() { AppLocation = new AppLocation(); geo = new Geolocator(); }
// // Manipulates the MSFT_SIPApplicationPriorityList. Moves the uri // to the start or end of the list, depending on the value of loc. // public void ConfigAppOrder(string uri, AppLocation loc) { try { ManagementClass appSettingClass; ManagementClass appPriorityClass; ManagementObject thisApp = null; string thisId = null; ArrayList appList = null; appSettingClass = new ManagementClass("root/cimv2", "MSFT_SIPApplicationSetting", new ObjectGetOptions()); appPriorityClass = new ManagementClass("root/cimv2", "MSFT_SIPApplicationPriorityList", new ObjectGetOptions()); // // Look up the URI // foreach (ManagementObject obj in appSettingClass.GetInstances()) { if ((string)obj["URI"] == uri) { thisApp = obj; thisId = (string)obj["InstanceID"]; break; } } if (thisApp == null) { return; } // // Get the InstanceID list, which is a literal "{GUID}","{GUID}",... // foreach (ManagementObject priList in appPriorityClass.GetInstances()) { appList = new ArrayList(((string[])priList["InstanceIDList"])); // // Move the URI // int listlen = appList.Count; appList.Remove(thisId); switch (loc) { case AppLocation.FirstApp: appList.Insert(0, thisId); break; case AppLocation.LastApp: appList.Add(thisId); break; default: appList.Add(thisId); break; } // // Commit // string[] newIdList = new string[appList.Count]; appList.CopyTo(newIdList); priList["InstanceIDList"] = newIdList; priList.Put(); break; } } catch (Exception x) { Console.WriteLine("Error inside ConfigApp: " + x.Message); throw; } }