public QueryAccumulator() { Object = new ProxyAccumulator(false, (k, v) => pairs.Add(new KeyValuePair <string, string>(k, v)), (k, v) => pairs.Insert(0, new KeyValuePair <string, string>(k, v)), () => pairs); }
public static void Add(this IInfoAccumulator a, IEnumerable <KeyValuePair <string, string> > items) { foreach (var pair in items) { a.AddString(pair.Key, pair.Value); } }
public static string ToQueryString(this IInfoAccumulator a, int characterLimit) { const string truncated = "truncated=true"; var limit = characterLimit - truncated.Length; var pairs = a.GetInfo().Where(pair => pair.Value != null && pair.Key != null) .Select(pair => Uri.EscapeDataString(pair.Key) + "=" + Uri.EscapeDataString(pair.Value)); var sb = new StringBuilder(1000); sb.Append("?"); foreach (var s in pairs) { if (sb[sb.Length - 1] != '?') { sb.Append("&"); } if (sb.Length + s.Length > limit) { sb.Append(truncated); return(sb.ToString()); } sb.Append(s); } return(sb.ToString()); }
public void Add(IInfoAccumulator q) { foreach (var s in GetPluginsUsedShorthand()) { q.Add("p", s); } }
public void Add(IInfoAccumulator query) { var q = query.WithPrefix("proc_"); q.Add("64", Process64Bit); q.Add("guid", ProcessGuid); q.Add("id_hash", Utilities.Sha256TruncatedBase64(ProcessId.ToString(), 6)); q.Add("working_set_mb", Environment.WorkingSet / 1000000); // TODO: check for mismatched assemblies? }
public void Add(IInfoAccumulator accumulator) { accumulator.Add("diskcache_subfolders", options.Subfolders); accumulator.Add("diskcache_autoclean", options.AutoClean); accumulator.Add("diskcache_asyncwrites", options.AsyncWrites); /* * diskcache_virtualpath /imagecache * diskcache_drive_total 161059172352 * diskcache_drive_avail 38921302016 * diskcache_filesystem NTFS * diskcache_network_drive 0 * diskcache_subfolders 8192 */ }
public void Add(IInfoAccumulator query) { var q = query.WithPrefix("proc_"); if (iisVersion != null) { q.Add("iis", iisVersion); } q.Add("default_commands", PathHelpers.SerializeCommandString(options.CommandDefaults)); var a = Assembly.GetAssembly(this.GetType()).GetInformationalVersion(); if (a.LastIndexOf('+') >= 0) { q.Add("git_commit", a.Substring(a.LastIndexOf('+') + 1)); } q.Add("info_version", Assembly.GetAssembly(this.GetType()).GetInformationalVersion()); q.Add("file_version", Assembly.GetAssembly(this.GetType()).GetFileVersion()); if (env.ContentRootPath != null) { // ReSharper disable once StringLiteralTypo q.Add("apppath_hash", Utilities.Sha256TruncatedBase64(env.ContentRootPath, 6)); } query.Add("imageflow", 1); query.AddString("enabled_cache", options.ActiveCacheBackend.ToString()); if (streamCache != null) { query.AddString("stream_cache", streamCache.GetType().Name); } query.Add("map_web_root", options.MapWebRoot); query.Add("use_presets_exclusively", options.UsePresetsExclusively); query.Add("request_signing_default", options.RequestSignatureOptions?.DefaultRequirement.ToString() ?? "never"); query.Add("default_cache_control", options.DefaultCacheControlString); foreach (var s in pluginNames) { query.Add("p", s); } foreach (var p in infoProviders) { p?.Add(query); } }
public void Add(IInfoAccumulator query) { var q = query.WithPrefix("h_"); // Excludes other processor groups that aren't available to the CLR q.Add("logical_cores", LogicalCores.ToString()); q.Add("mac_digest", this.MachineDigest); q.Add("os64", OperatingSystem64Bit); q.Add("network_drives_count", NetworkDrives); q.Add("other_drives_count", OtherDrives); q.Add("fixed_drives_count", FixedDrives.Count()); foreach (var drive in FixedDrives) { q.Add("fixed_drive", $"{drive.Filesystem},{drive.AvailableBytes / 1000000000},{drive.TotalBytes / 1000000000}"); } }
public void Add(IInfoAccumulator query) { var q = query.WithPrefix("proc_"); q.Add("64", Process64Bit); q.Add("guid", ProcessGuid); q.Add("sys_dotnet", DotNetVersionInstalled); q.Add("iis", IisVer); q.Add("integrated_pipeline", IntegratedPipeline); q.Add("id_hash", Utilities.Sha256TruncatedBase64(ProcessId.ToString(), 6)); q.Add("asyncmodule", Config.Current.Pipeline.UsingAsyncMode); q.Add("default_commands", Config.Current.get("pipeline.defaultCommands", null)); q.Add("working_set_mb", Environment.WorkingSet / 1000000); q.Add("git_commit", Assembly.GetAssembly(this.GetType()).GetShortCommit()); q.Add("info_version", Assembly.GetAssembly(this.GetType()).GetInformationalVersion()); q.Add("file_version", Assembly.GetAssembly(this.GetType()).GetFileVersion()); if (HostingEnvironment.ApplicationPhysicalPath != null) { q.Add("apppath_hash", Utilities.Sha256TruncatedBase64(HostingEnvironment.ApplicationPhysicalPath, 6)); } // Add HttpModule class names without prefixing SetModules(HttpContext.Current?.ApplicationInstance?.Modules); if (HttpModules != null) { foreach (var name in HttpModules) { query.Add("mod", name); } } // TODO: check for mismatched assemblies? }
public static void Add(this IInfoAccumulator a, string key, string value) { a.AddString(key, value); }
public static void Add(this IInfoAccumulator a, string key, long?value) { a.AddString(key, value?.ToString()); }
public static void Add(this IInfoAccumulator a, string key, Guid value) { a.AddString(key, EncodingUtils.ToBase64U(value.ToByteArray())); }