Beispiel #1
0
 // =============================================================================
 // xtor
 // =============================================================================
 public CacheData(ZIMapApplication application)
     : base(application.Parent)
 {
     this.application = application;
     connection = application.Connection;
     server     = application.Server;
     factory    = connection.CommandLayer;
     progress   = connection.ProgressReporting;
     // At least deliver Info level messages ...
     MonitorLevel = application.MonitorLevel;
     if(MonitorLevel > ZIMapConnection.Monitor.Info)
         MonitorLevel = ZIMapConnection.Monitor.Info;
     Data = data = new DataRefImp(this);
 }
Beispiel #2
0
            /// <summary>Iterator to enumerate a mailbox and it's descendents.</summary>
            /// <param name="position">
            /// Set on return, must initially be <see cref="MBoxRef.Nothing"/>.
            /// </param>
            /// <param name="server">
            /// Used for namespace support <see cref="ZIMapServer.FriendlyName"/>.
            /// </param>
            /// <returns>On success <c>true</c> is returned.</returns>
            /// <remarks>
            /// The returned <paramref name="position"/> should be used to access the
            /// data.<para/>
            /// <example><code lang="C#">
            /// uint udel = 0;
            /// CacheData.MBoxRef root = ...;
            /// CacheData.MBoxRef position = CacheData.MBoxRef.Nothing;
            /// while(umbx.Recurse(ref positioin, Server))
            /// {    if(position.Messages > 0) udel++
            /// }
            /// </code></example> 
            /// </remarks>
            public bool Recurse(ref MBoxRef position, ZIMapServer server)
            {
                if(!IsValid) return false;
                if(!position.IsValid)                       // start the iteration
                {   position = this;
                    return true;
                }

                // get the friendly root name and append a hierarchie delimiter
                uint rnsi;
                string root = boxes[index].Name;
                root = server.FriendlyName(root, out rnsi);
                root += server[rnsi].Delimiter;

                // now scan the list of mailboxes ...
                while(position.Next())
                {   if(position.index == index) continue;   // Reset() called?
                    uint cnsi;
                    string name = server.FriendlyName(position.Name, out cnsi);
                    if(rnsi == cnsi && name.StartsWith(root)) return true;
                }
                position = MBoxRef.Nothing;
                return false;
            }