[csmaild-cvs] csmaild/src/Common/MailstoreProviders IMailstoreProvider.cs,NONE,1.1 XmlMailstoreProvi
Brought to you by:
tamc
From: <ta...@us...> - 2003-07-24 04:32:27
|
Update of /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders In directory sc8-pr-cvs1:/tmp/cvs-serv32149/src/Common/MailstoreProviders Added Files: IMailstoreProvider.cs XmlMailstoreProvider.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track --- NEW FILE: IMailstoreProvider.cs --- using System; namespace Common.MailstoreProviders { /// <summary> /// Defines an interface for implementing a mailstore provider /// </summary> public interface IMailstoreProvider { /// <summary> /// Gets the mailbox with the specified absolute path /// </summary> /// <param name="absoluteHiearchicalName">The absolute path of the mailbox to retreive</param> /// <returns>The mailbox or null if not found</returns> Mailbox GetMailbox(string absoluteHiearchicalName); /// <summary> /// Gets all the mailboxes that are in the mail store /// </summary> /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Mailbox[] GetMailboxes(); /// <summary> /// Gets the mailboxes that are immediate children /// </summary> /// <param name="parent">The parent mailbox to gather children for</param> /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Mailbox[] GetMailboxes(Mailbox parent); /// <summary> /// Gets the message /// </summary> /// <param name="box">The mailbox the message is located in</param> /// <param name="uniqueId">The unique identifier of the message</param> /// <returns>The message found, or null if none found</returns> Message GetMessage(Mailbox box, int uniqueId); /// <summary> /// Gets all the messages contained in a mailbox /// </summary> /// <param name="box">The mailbox to gather messages for</param> /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Message[] GetMessages(Mailbox box); } } --- NEW FILE: XmlMailstoreProvider.cs --- using System; using System.Data; namespace Common.MailstoreProviders { public class XmlMailstoreProvider : IMailstoreProvider { private string mFolderPath; public XmlMailstoreProvider(string folderPath) { mFolderPath = folderPath; if(!mFolderPath.EndsWith(@"\")) mFolderPath += @"\"; } public Mailbox GetMailbox(string absoluteHiearchicalName) { DataSet ds = new DataSet(); ds.ReadXml(mFolderPath + "Mailboxes.xml"); DataRow[] boxes = ds.Tables[0].Select("FullName = '" + absoluteHiearchicalName + "'"); if(boxes.Length == 0) return null; DataRow box = boxes[0]; return new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string)); } public Mailbox[] GetMailboxes() { DataSet ds = new DataSet(); ds.ReadXml(mFolderPath + "Mailboxes.xml"); Mailbox[] boxes = new Mailbox[ds.Tables[0].Rows.Count]; for(int idx = 0; idx < boxes.Length; ++idx) { DataRow box = ds.Tables[0].Rows[idx]; boxes[idx] = new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string)); } return boxes; } public Mailbox[] GetMailboxes(Mailbox parent) { return null; } public Message GetMessage(Mailbox box, int uniqueId) { return null; } public Message[] GetMessages(Mailbox box) { return null; } } } |