public static void SetUsage(this ICollection <UsageInfo> usages, DateTime date, int total, int blocked, int tooBig, int limit, TimeSpan?maxUsageAge = null) { var usageInfo = usages.FirstOrDefault(o => o.Date == date); if (usageInfo == null) { usageInfo = new UsageInfo { Date = date, Total = total, Blocked = blocked, Limit = limit, TooBig = tooBig }; usages.Add(usageInfo); } else { usageInfo.Limit = limit; usageInfo.Total = total; usageInfo.Blocked = blocked; usageInfo.TooBig = tooBig; } if (!maxUsageAge.HasValue) { return; } // remove old usage entries foreach (var usage in usages.Where(u => u.Date < SystemClock.UtcNow.Subtract(maxUsageAge.Value)).ToList()) { usages.Remove(usage); } }
public r0 method_19(UsageInfo usageInfo_0) { if (!this.method_4()) { return(new d0 { Success = false, Body = "Invalid Session" }); } object[] objArray2 = new object[] { this.String_2, usageInfo_0 }; r0 r = this.method_3(Enum4.UsageInfo, objArray2); if (!string.IsNullOrEmpty(r.Body) && (r.Body == "TRIPWIRE")) { if (eventHandler_1 != null) { EventHandler expressionStack_66_0 = eventHandler_1; expressionStack_66_0(null, null); return(r); } else { EventHandler expressionStack_63_0 = eventHandler_1; } } return(r); }
/// <summary> /// usage时时数据读取 /// </summary> /// <returns></returns> /// 测试数据 usage/getusage public string GetUsage() { UsageInfo usageInfo = new UsageInfo(); string str = usageInfo.GetUsage(); return(str); }
public void AddObject(FacilityValue.FacilityInfo Info) { if (Info.ObjectActCall.Info.Type == "EnergyStorage") { StoreObject newObject = new StoreObject(); newObject.FacilityInfo = Info; newObject.EnergyStoreActCall = Info.Object.GetComponent <EnergyStorageAct>(); StoreList.Add(newObject); TotalStorableAmount += newObject.EnergyStoreActCall.StorableElectricity; StoreObjectCount++; } else { UsageInfo newUsage = new UsageInfo(); newUsage.FacilityInfo = Info; UsageList.Add(newUsage); } BlackOutTimer = BlackOutTimeLimit; if (CompanyValueCall.CompanyName == CompanyManagerCall.PlayerCompanyName) { PanelControllerCall.UpdateFactoryInfo("Electricity", TotalUsage, AvailableElectricityAmount); } }
private List <string> GetFilteredUsedBy(bool showProgress) { //XDebug.Log("No FilteredUsedBy found for {0}. Populating....", m_Obj.name); HashSet <string> filteredUsedBy = new HashSet <string>(); for (int i = 0; i < UsedBy.Count; i++) { string path = UsedBy[i]; UsageInfo info = GetUsageInfo(path); if (showProgress && EditorUtility.DisplayCancelableProgressBar("Gathering Parent File References for " + FileName, path, i * 1f / UsedBy.Count)) { EditorUtility.ClearProgressBar(); return(new List <string>()); } if (info.FilteredUsing.Any(subPath => subPath == Path)) { filteredUsedBy.Add(path); } } if (showProgress) { EditorUtility.ClearProgressBar(); } return(filteredUsedBy.ToList()); }
private void UpdateMouseInfo() { mouse_pos_world = new Vector2(Mathf.Floor(Camera.main.ScreenToWorldPoint(Input.mousePosition).x), Mathf.Floor(Camera.main.ScreenToWorldPoint(Input.mousePosition).y)); mouse_pos_screen = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y); grid_info = FindObjectOfType <MapGenerator>().usage_chart.Info(mouse_pos_world); }
protected void AddUsage(IExpression expr, bool isWrite) { bool anyIndexIsPartitioned = (expr is IArrayIndexerExpression) && Recognizer.GetIndices(expr).Any(bracket => bracket.Any(index => Recognizer.GetVariables(index).Any(context.InputAttributes.Has <Partitioned>))); object decl = Recognizer.GetDeclaration(expr); if (decl == null || (!anyIndexIsPartitioned && context.InputAttributes.Has <LocalTransform.DoNotUseLocal>(decl))) { return; } if (containerInfos.Count == 0) { return; } ContainerInfo containerInfo = containerInfos.Peek(); UsageInfo usageInfo; if (!containerInfo.usageInfoOfVariable.TryGetValue(decl, out usageInfo)) { usageInfo = new UsageInfo(); containerInfo.usageInfoOfVariable[decl] = usageInfo; } LocalInfo info; if (!usageInfo.localInfos.TryGetValue(expr, out info)) { info = new LocalInfo(); info.minWriteDepth = int.MaxValue; info.minReadBeforeWriteDepth = int.MaxValue; // this assignment is not needed since we must have depth < info.minWriteDepth //info.hasReadBeforeWrite = !isWrite; usageInfo.localInfos[expr] = info; } int depth = Recognizer.GetIndexingDepth(expr); if (isWrite) { info.hasWrite = true; info.minWriteDepth = System.Math.Min(info.minWriteDepth, depth); } else if (depth < info.minWriteDepth) { info.hasReadBeforeWrite = true; info.minReadBeforeWriteDepth = System.Math.Min(info.minReadBeforeWriteDepth, depth); } info.count++; if (info.containingStatements == null) { info.containingStatements = new HashSet <IStatement>(openContainers, ReferenceEqualityComparer <IStatement> .Instance); info.containers = GetContainers(); } else { info.containingStatements.IntersectWith(openContainers); info.containers = Containers.Intersect(info.containers, GetContainers(), allowBrokenLoops: true, ignoreLoopDirection: true); } }
/// <summary> /// This method gathers the information from the current client context towards the host web /// </summary> private void GetSiteInformation() { string usageData = string.Empty; string siteCollectionUrl = string.Empty; var spContext = SharePointContextProvider.Current.GetSharePointContext(Context); //some information is gathered from an app-only token to the site collection using (var clientContext = spContext.CreateAppOnlyClientContextForSPHost()) { //load data clientContext.Load(clientContext.Web, w => w.Title); clientContext.Load(clientContext.Site, s => s.Usage, s => s.ReadOnly, s => s.Owner, s => s.ShareByEmailEnabled, s => s.ShareByLinkEnabled, s => s.Url ); clientContext.ExecuteQuery(); Site site = clientContext.Site; Web web = clientContext.Web; siteCollectionUrl = site.Url; //Basic Info & binding to form UsageInfo usageInfo = site.Usage; lblStorageQuota.Text = FormatBytes(usageInfo.Storage); lblUsedStorage.Text = usageInfo.StoragePercentageUsed.ToString("P"); lblTitle.Text = web.Title; lblReadOnly.Text = site.ReadOnly == true ? "Yes" : "No"; lblExternalSharingByEmail.Text = site.ShareByEmailEnabled == true ? "Yes" : "No"; lblExternalSharingByLink.Text = site.ShareByLinkEnabled == true ? "Yes" : "No"; lblLastModified.Text = //Site Collection Admins: lblOwner.Text = site.Owner.Title + " (" + site.Owner.Email + ")"; //get site collection administrators var siteCollectionAdministrators = web.GetAdministrators(); StringBuilder listOfAdmins = new StringBuilder(); foreach (var admin in siteCollectionAdministrators) { listOfAdmins.Append(admin.Title); listOfAdmins.Append(" ("); listOfAdmins.Append(string.IsNullOrWhiteSpace(admin.Email) ? admin.LoginName : admin.Email); listOfAdmins.Append("); "); } lblSiteCollectionAdmins.Text = listOfAdmins.ToString(); } //proceed with data from the tenant object GetTenantInformation(siteCollectionUrl); }
public UsageChart(int dimension_x, int dimension_y) { chart = new UsageInfo[(int)dimension_x][]; for (int x = 0; x < dimension_x; x++) { chart[x] = new UsageInfo[(int)dimension_y]; } ClearChart(); total = chart.Length * chart[0].Length; }
public void DeleteObject(FacilityValue.FacilityInfo Info) { if (Info.ObjectActCall.Info.Type == "EnergyStorage") { StoreObject Target = null; foreach (var Supply in StoreList) { if (Supply.FacilityInfo == Info) { Target = Supply; break; } } if (Target != null) { StoreList.Remove(Target); } else { Debug.Log("Cannot Find " + Info.Object.name); } } else { UsageInfo Target = null; foreach (var Usage in UsageList) { if (Usage.FacilityInfo == Info) { Target = Usage; break; } } if (Target != null) { UsageList.Remove(Target); } else { Debug.Log("Cannot Find " + Info.Object.name); } } BlackOutTimer = BlackOutTimeLimit; if (CompanyValueCall.CompanyName == CompanyManagerCall.PlayerCompanyName) { PanelControllerCall.UpdateFactoryInfo("Electricity", TotalUsage, AvailableElectricityAmount); } }
public UsageChart(Vector2 dimensions) { chart = new UsageInfo[(int)dimensions.x][]; for (int x = 0; x < dimensions.x; x++) { chart[x] = new UsageInfo[(int)dimensions.y]; } ClearChart(); total = chart.Length * chart[0].Length; }
protected override IStatement ConvertFor(IForStatement ifs) { // convert the initializer, condition, and increment outside of the container. context.SetPrimaryOutput(ifs); ConvertStatement(ifs.Initializer); ConvertExpression(ifs.Condition); ConvertStatement(ifs.Increment); // convert the body inside of a new ContainerInfo. bool wasPartitioned = this.InPartitionedLoop; IVariableDeclaration loopVar = Recognizer.LoopVariable(ifs); bool isPartitioned = InPartitionedLoop || context.InputAttributes.Has <Partitioned>(loopVar) || (this.compiler.UseLocals && this.compiler.OptimiseInferenceCode); if (isPartitioned) { this.InPartitionedLoop = true; containerInfos.Push(new ContainerInfo()); } openContainers.Push(ifs); ConvertBlock(ifs.Body); openContainers.Pop(); if (isPartitioned) { ContainerInfo containerInfo = containerInfos.Pop(); var localInfos = new Dictionary <IExpression, LocalInfo>(); localInfoOfStmt[ifs] = localInfos; // find the longest common prefix of each variable's expressions foreach (var entry in containerInfo.usageInfoOfVariable) { object decl = entry.Key; UsageInfo usageInfo = entry.Value; CombineLocalInfos(usageInfo.localInfos); foreach (var pair in usageInfo.localInfos) { IExpression expr = pair.Key; LocalInfo localInfo = pair.Value; IExpression prefix = GetPrefixInParent(expr, loopVar); if (!ReferenceEquals(prefix, expr)) { // expr refers to this loop variable IArrayIndexerExpression iaie = (IArrayIndexerExpression)expr; if (usageInfo.localInfos.Count == 1) { localInfos.Add(expr, localInfo); } } // add the prefix to the parent containerInfo var info = AddLocalInfo(decl, prefix, localInfo, ifs); } } this.InPartitionedLoop = wasPartitioned; } return(ifs); }
/// 测试数据:Reports/GetMonQuality?startYear=2018&startMonth=5&endYear=2018&endMonth=5 public string GetMonUsage(string startYear, string startMonth, string endYear, string endMonth) { UsageInfo usageServer = new UsageInfo(); string startdatestr = startYear + "-" + startMonth + "-" + "01"; DateTime starttime = Convert.ToDateTime(startdatestr); string StartDate = starttime.ToString("yyyy-MM-dd HH:mm:ss"); string enddatestr = endYear + "-" + endMonth + "-" + "01"; DateTime endtime = Convert.ToDateTime(enddatestr); string EndDate = endtime.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss"); return(usageServer.GetMonthUsage(StartDate, EndDate)); }
/// <summary> /// Compute the use number and attach it to the current statement /// </summary> /// <param name="info"></param> /// <param name="expr"></param> protected void RegisterUse(UsageInfo info, IExpression expr) { int useNumber = GetUseNumber(info, expr); IStatement st = context.FindAncestorNotSelf <IStatement>(); Queue <int> queue; if (!info.useNumberOfStatement.TryGetValue(st, out queue)) { queue = new Queue <int>(); info.useNumberOfStatement[st] = queue; } queue.Enqueue(useNumber); }
protected int GetUseNumber(UsageInfo info, IExpression expr) { // package the expr with its conditionContext, // so that uses in disjoint deterministic conditions can get the same number. Set <ConditionBinding> bindings = new Set <ConditionBinding>(); bindings.AddRange(conditionContext); ExpressionWithBinding eb = new ExpressionWithBinding(); eb.Expression = expr; eb.Binding = bindings; return(info.GetUseNumber(eb, loopVars)); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { UsageInfo i = value as UsageInfo; if (i != null) { Usage u = new Usage(); TypeConverter c = TypeDescriptor.GetConverter(typeof(Example)); u.Examples = new FreezableCollection <Example>(i.Examples.ToList() .ConvertAll <Example>(input => (Example)c.ConvertFrom(input))); return(u); } return(base.ConvertFrom(context, culture, value)); }
/// <summary> /// Serializes the object to JSON. /// </summary> /// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param> /// <param name="obj">The object to serialize to JSON.</param> internal static void Serialize(JsonWriter writer, UsageInfo obj) { // Required properties are always serialized, optional properties are serialized when not null. writer.WriteStartObject(); if (obj.UsedSpace != null) { writer.WriteProperty(obj.UsedSpace, "UsedSpace", JsonWriterExtensions.WriteStringValue); } if (obj.FileCount != null) { writer.WriteProperty(obj.FileCount, "FileCount", JsonWriterExtensions.WriteStringValue); } writer.WriteEndObject(); }
public Vector2[] GetAll(UsageInfo look_for) { List <Vector2> to_return = new List <Vector2>(); for (int x = 0; x < chart.Length; x++) { for (int y = 0; y < chart[0].Length; y++) { if (Info(x, y) == look_for) { to_return.Add(new Vector2(x, y)); } } } return(to_return.ToArray()); }
public int Count(Vector2 position, Vector2 dimensions, UsageInfo look_for) { int to_return = 0; for (int x = (int)position.x; x < (int)(position.x + dimensions.x); x++) { for (int y = (int)position.y; y < (int)(position.y + dimensions.y); y++) { if (Info(x, y) == look_for) { to_return++; } } } return(to_return); }
protected override IExpression ConvertVariableDeclExpr(IVariableDeclarationExpression ivde) { IVariableDeclaration ivd = Recognizer.GetVariableDeclaration(ivde); VariableInformation vi = VariableInformation.GetVariableInformation(context, ivd); if (vi.IsStochastic) { UsageInfo info = new UsageInfo(); info.containers = new Containers(context); usageInfo[ivd] = info; } if (Recognizer.GetAncestorIndexOfLoopBeingInitialized(context) != -1) { loopVars.Add(ivd); } return(base.ConvertVariableDeclExpr(ivde)); }
private List <string> GetFilteredUsing(bool showProgress) { // Grab all the references. HashSet <string> childPaths = new HashSet <string>(Using); for (int i = 0; i < Using.Count; i++) { string path = Using[i]; // Avoid infinite loops where assets reference each other. if (UsedBy.Contains(path)) { if (childPaths.Contains(path)) { childPaths.Remove(path); } continue; } UsageInfo info = GetUsageInfo(path); // Only show progress if there is a significant number of sub-paths to search through. if (showProgress && (info.Using.Count > 20) && EditorUtility.DisplayCancelableProgressBar("Gathering Child File References for " + FileName, path, i * 1f / Using.Count)) { EditorUtility.ClearProgressBar(); return(new List <string>()); } // Go through each sub path and remove any found in childPaths. foreach (string subPath in info.Using) { if (childPaths.Contains(subPath)) { childPaths.Remove(subPath); } } } if (showProgress) { EditorUtility.ClearProgressBar(); } // Return final child paths as an ordered list. return(childPaths.ToList()); }
private void OnGUI() { GUILayout.BeginHorizontal(); GUI.enabled = m_GoBackStack.Any(); if (GUILayout.Button("<")) { GoBack(); } GUI.enabled = m_GoForwardStack.Any(); if (GUILayout.Button(">")) { GoForward(); } GUI.enabled = true; m_ShowIndirectReferences = GUILayout.Toggle(m_ShowIndirectReferences, "Show Indirect References"); m_LockSelection = GUILayout.Toggle(m_LockSelection, "Lock Current Selection"); if (m_LastShowIndirectReferences != m_ShowIndirectReferences) { m_LastShowIndirectReferences = m_ShowIndirectReferences; EditorPrefs.SetBool(kShowIndirectReferencesPrefKey, m_ShowIndirectReferences); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); try { Object obj = Selection.activeObject; if (!obj) { return; } UsageInfo info = GetUsageInfo(obj); if ((info != m_LastInfo) && !m_LockSelection) { info.Refresh(); Go(obj); m_LastInfo = info; } m_LastInfo.OnGUI(); } catch (Exception e) { Debug.LogException(e); } }
/// <summary> /// Extracts the Site Usage /// </summary> /// <remarks> /// If the Usage property has not be instantiated it will load the property into memory; /// Note: This will slow the processing /// </remarks> /// <param name="site"></param> /// <returns></returns> public static SPSiteUsageModel GetSiteUsageMetric(this Site site) { if (!site.IsPropertyAvailable(sctx => sctx.Usage)) { site.EnsureProperty(sctx => sctx.Usage); } var byteAddressSpace = 1024; var mbAddressSpace = 1048576; UsageInfo _usageInfo = site.Usage; Double _storageBytes = _usageInfo.Storage; var _storage = (_storageBytes / mbAddressSpace); Double _storageQuotaBytes = (_usageInfo.StoragePercentageUsed > 0) ? _storageBytes / _usageInfo.StoragePercentageUsed : 0; var _storageQuota = (_storageQuotaBytes / mbAddressSpace); var _storageUsageMB = Math.Round(_storage, 4); var _storageAllocatedMB = Math.Round(_storageQuota, 4); var _storageUsageGB = Math.Round((_storage / byteAddressSpace), 4); var _storageAllocatedGB = Math.Round((_storageQuota / byteAddressSpace), 4); var _storagePercentUsed = Math.Round(_usageInfo.StoragePercentageUsed, 4); var storageModel = new SPSiteUsageModel() { Bandwidth = _usageInfo.Bandwidth, DiscussionStorage = _usageInfo.DiscussionStorage, Hits = _usageInfo.Hits, Visits = _usageInfo.Visits, StorageQuotaBytes = _storageQuotaBytes, AllocatedGb = _storageAllocatedGB, AllocatedGbDecimal = _storageAllocatedGB.TryParseDecimal(0), UsageGb = _storageUsageGB, UsageGbDecimal = _storageUsageGB.TryParseDecimal(0), AllocatedMb = _storageAllocatedMB, AllocatedMbDecimal = _storageAllocatedMB.TryParseDecimal(0), UsageMb = _storageUsageMB, UsageMbDecimal = _storageUsageMB.TryParseDecimal(0), StorageUsedPercentage = _storagePercentUsed, StorageUsedPercentageDecimal = _storagePercentUsed.TryParseDecimal(0) }; return(storageModel); }
private static void Go(string path, Object obj) { Object prev = Instance.m_GoBackStack.LastOrDefault(); Object next = Instance.m_GoForwardStack.LastOrDefault(); if (prev && (prev == obj)) { GoBack(); return; } if (next && (next == obj)) { GoForward(); return; } Object oldObj = Selection.activeObject; UsageInfo oldInfo = GetUsageInfo(oldObj); if (oldInfo.Path == path) { return; } if (oldInfo.HasUsing(path)) { Instance.m_GoBackStack.Add(oldObj); Instance.m_GoForwardStack.Clear(); } else if (oldInfo.HasUsedBy(path)) { Instance.m_GoForwardStack.Add(oldObj); Instance.m_GoBackStack.Clear(); } else { Instance.m_GoForwardStack.Clear(); Instance.m_GoBackStack.Clear(); } Selection.activeObject = obj; EditorGUIUtility.PingObject(Selection.activeObject); }
public void DumpObjectMemoryToConsole() { List<UsageInfo> items = new List<UsageInfo>(); Object[] allObjects = Resources.FindObjectsOfTypeAll<Object>() as Object[]; System.Text.StringBuilder stringBuilder; foreach (Object obj in allObjects) { int bytes = UnityEngine.Profiling.Profiler.GetRuntimeMemorySize(obj); if (bytes >= MIN_SIGNIFICANT_BYTES) { string strDescriptor; // hrrm. Some objects don't have name. Object type is better than nothing? strDescriptor = string.IsNullOrEmpty(obj.name)? obj.GetType().ToString() : obj.name; stringBuilder = new System.Text.StringBuilder("ID: " + strDescriptor + " " + GameUtils.FormatBytes(bytes)); UsageInfo info = new UsageInfo(); info.display = stringBuilder.ToString(); info.bytes = bytes; items.Add(info); } } items.Sort((i1, i2) => i1.bytes.CompareTo(i2.bytes)); items.Reverse(); DebugSystem.Log("**** Object Memory Dump Start ****"); for (int i = 0; i < items.Count; i++) { DebugSystem.Log(items[i].display); } DebugSystem.Log("**** Object Memory Dump End ****"); }
public static void SetUsage(this ICollection <UsageInfo> usages, DateTime date, int total, int accepted, int limit) { var usageInfo = usages.FirstOrDefault(o => o.Date == date); if (usageInfo == null) { usageInfo = new UsageInfo { Date = date, Total = total, Accepted = accepted, Limit = limit }; usages.Add(usageInfo); } else { usageInfo.Limit = limit; usageInfo.Total = total; usageInfo.Accepted = accepted; } }
public Vector2 GetRandom(UsageInfo look_for) { Vector2[] list_all = GetAll(look_for); return(list_all[(int)Random.Range(0, list_all.Length - 1)]); }
bool RenameUrlInScript(UsageInfo match, string from, string to) => RenameUrlInScript(match.ScriptName, from, to);
/// <summary> /// Add localInfo for expr to the current containerInfo. /// </summary> /// <param name="decl"></param> /// <param name="expr"></param> /// <param name="localInfo"></param> /// <param name="closedContainer"></param> protected LocalInfo AddLocalInfo(object decl, IExpression expr, LocalInfo localInfo, IForStatement closedContainer) { if (containerInfos.Count == 0) { return(localInfo); } ContainerInfo containerInfo = containerInfos.Peek(); UsageInfo usageInfo; if (!containerInfo.usageInfoOfVariable.TryGetValue(decl, out usageInfo)) { usageInfo = new UsageInfo(); containerInfo.usageInfoOfVariable[decl] = usageInfo; } LocalInfo info; if (!usageInfo.localInfos.TryGetValue(expr, out info)) { info = localInfo.Clone(); info.containingStatements.IntersectWith(openContainers); IVariableDeclaration loopVar = Recognizer.LoopVariable(closedContainer); int index = info.containers.inputs.FindIndex(container => Containers.ContainersAreEqual(container, closedContainer, allowBrokenLoops: true, ignoreLoopDirection: true)); bool conditionsContainLoopVar = info.containers.inputs.Skip(index + 1).Any(container => Recognizer.GetVariables(GetContainerExpression(container)).Contains(loopVar)); IStatement replacement = null; if (conditionsContainLoopVar) { replacement = Builder.BrokenForStatement(closedContainer); info.containingStatements.Add(replacement); } else { var loopSize = Recognizer.LoopSizeExpression(closedContainer); bool loopMustExecute = false; if (loopSize is ILiteralExpression ile) { int loopSizeAsInt = (int)ile.Value; if (loopSizeAsInt > 0) { loopMustExecute = true; } } if (!loopMustExecute) { var condition = Builder.BinaryExpr(loopSize, BinaryOperator.GreaterThan, Builder.LiteralExpr(0)); replacement = Builder.CondStmt(condition, Builder.BlockStmt()); } } if (info.containers.inputs.Contains(replacement)) { replacement = null; } if (replacement == null) { info.containers = info.containers.Where(container => !Containers.ContainersAreEqual(container, closedContainer, true, true)); } else { // this only replaces containers.inputs info.containers = info.containers.Replace(container => !Containers.ContainersAreEqual(container, closedContainer, true, true) ? container : replacement); } int previousCount = info.containers.Count; info.containers = Containers.RemoveInvalidConditions(info.containers, context); if (info.containers.Count != previousCount && expr is IArrayIndexerExpression) { // when dropping conditionals, we need to show that if the indices were valid inside the conditionals, they remain valid outside the conditionals. // This is automatically true if the indices match the indexVars. expr = GetPrefixIndexedByIndexVars(expr); } usageInfo.localInfos[expr] = info; } else { info.Add(localInfo); } info.appearsInNestedLoop = true; return(info); }
/// <summary> /// Capture Reporting Data starting at this site url /// </summary> /// <param name="_siteUrl"></param> internal virtual void ProcessSite(string _siteUrl) { try { WebCollection subWebs = null; using (var ctx = this.ClientContext.Clone(_siteUrl)) { Web _web = ctx.Web; ctx.Load(_web); ctx.ExecuteQuery(); Site _site = ctx.Site; subWebs = _web.Webs; ctx.Load(_web, s => s.UIVersion, s => s.LastItemModifiedDate, s => s.Created, s => s.AssociatedOwnerGroup, s => s.Lists.Include(i => i.Id, i => i.Title, i => i.BaseType, i => i.ItemCount)); ctx.Load(subWebs); ctx.Load(_site, s => s.Usage, cts => cts.Id, ctxs => ctxs.AllowMasterPageEditing); ctx.ExecuteQueryRetry(); var siteOwner = string.Empty; try { var _user = _site.Owner; ctx.Load(_user, iu => iu.Email); ctx.ExecuteQueryRetry(); siteOwner = _user.Email; } catch (Exception e) { LogError(e, "Failed to retrieve owner from site {0}", _siteUrl); } var totalListCount = _web.Lists.Count(); var totalListItemCount = _web.Lists.Sum(l => l.ItemCount); // ---> Site Usage Properties UsageInfo _usageInfo = _site.Usage; var _usageProcessed = _site.GetSiteUsageMetric(); DateTime _createdDate = (DateTime)ctx.Web.Created; var model = new SPWebDefinitionModel() { SiteUrl = _siteUrl, SiteOwner = siteOwner, UIVersion = _web.UIVersion, Created = _web.Created, UsageInfo = _usageInfo, LastItemModifiedDate = _web.LastItemModifiedDate, ListCount = totalListCount, ListItemCount = totalListItemCount }; WebModels.Add(model); } if (subWebs != null && subWebs.Count() > 0) { foreach (var subWeb in subWebs) { ProcessSite(subWeb.Url); } } } catch (Exception e) { LogError(e, "Failed in ProcessSite({0})", _siteUrl); } }