/// <summary> /// Gets the number of pointers that need to be read from the request, taking /// into account any pre-cached binary data. /// </summary> /// <returns>The number of pointers that need to be read</returns> private int GetNumberOfPointers() { /* check to see if we have already cached the data for * all pointers. if so, we can skip reading the binary sections. * (unfortunately, if we have cached some of the sections but not all, * we will probably have to read it all in again, depending on the order * they are included) * */ int c = 0; foreach (Header header in this.headers.Pointers) { Pointer pointer = new Pointer(this.headers); this.pointers.Add(pointer); if (ResourceCache.IsCached(this.applicationName, header.GrowlResourcePointerID)) { BinaryData data = ResourceCache.Get(this.applicationName, header.GrowlResourcePointerID); pointer.Identifier = header.GrowlResourcePointerID; pointer.ByteArray = data.Data; c++; } } foreach (HeaderCollection notification in this.notificationsToBeRegistered) { foreach (Header header in notification.Pointers) { Pointer pointer = new Pointer(notification); this.pointers.Add(pointer); if (ResourceCache.IsCached(this.applicationName, header.GrowlResourcePointerID)) { BinaryData data = ResourceCache.Get(this.applicationName, header.GrowlResourcePointerID); pointer.Identifier = header.GrowlResourcePointerID; pointer.ByteArray = data.Data; c++; } } } int p = this.pointers.Count; // TODO: this effectively causes no cached resources to ever be used //c = int.MaxValue; // check to see if all pointers were already cached if (p == c) p = 0; // if #cached == total#, we dont need to read any else { // not all of the items are cached, so we have to re-read all of them. // to do so, we have to clear any pointer data we may have set foreach (Pointer pointer in this.pointers) { pointer.Clear(); } } if (c > 0 && p == 0) { requestInfo.SaveHandlingInfo("ALL BINARY RESOURCES ALREADY CACHED"); } return p; }