コード例 #1
0
ファイル: DayExtra.cs プロジェクト: vnextcoder/dasblog-core
        internal void LoadDayExtra(string fullPath)
        {
            FileStream fileStream = FileUtils.OpenForRead(fullPath);

            if (fileStream != null)
            {
                try
                {
                    XmlSerializer ser = new XmlSerializer(typeof(DayExtra), Data.NamespaceURI);
                    using (StreamReader reader = new StreamReader(fileStream))
                    {
                        //XmlNamespaceUpgradeReader upg = new XmlNamespaceUpgradeReader(reader, "", Data.NamespaceURI);
                        DayExtra e = (DayExtra)ser.Deserialize(reader);
                        this._comments  = e.Comments;
                        this._trackings = e.Trackings;
                    }
                }
                catch (Exception e)
                {
                    ErrorTrace.Trace(TraceLevel.Error, e);
                }
                finally
                {
                    fileStream.Close();
                }

                //RepairComments();
            }
        }
コード例 #2
0
ファイル: DayExtraOld.cs プロジェクト: steveisok/dasblog
        internal void LoadDayExtra(string fullPath)
        {
            FileStream fileStream = FileUtils.OpenForRead(fullPath);

            if (fileStream != null)
            {
                try
                {
                    XmlSerializer ser = new XmlSerializer(typeof(DayExtraOld), "urn:newtelligence-com:dasblog:runtime:data");
                    using (StreamReader reader = new StreamReader(fileStream))
                    {
                        //TODO: SDH: We need to have a better namespace upgrading solution for Medium Trust for folks with the OLD XML format
                        //XmlNamespaceUpgradeReader upg = new XmlNamespaceUpgradeReader(reader, "", "urn:newtelligence-com:dasblog:runtime:data");
                        DayExtraOld e = (DayExtraOld)ser.Deserialize(reader);
                        this._date      = e.DateLocalTime;
                        this._comments  = e.Comments;
                        this._trackings = e.Trackings;
                    }
                }
                catch (Exception e)
                {
                    ErrorTrace.Trace(TraceLevel.Error, e);
                }
                finally
                {
                    fileStream.Close();
                }
            }
        }
コード例 #3
0
 public void Rebuild()
 {
     // get the lock
     fileLock.AcquireWriterLock(100);
     try
     {
         XmlSerializer     x = new XmlSerializer(typeof(DayExtra));
         CommentCollection rebuiltCollection = new CommentCollection();
         DirectoryInfo     di = new DirectoryInfo(this.contentBaseDirectory);
         foreach (FileInfo file in di.GetFiles("*dayfeedback.xml"))
         {
             using (FileStream fs = file.OpenRead())
             {
                 DayExtra de = (DayExtra)x.Deserialize(fs);
                 rebuiltCollection.AddRange(de.Comments);
             }
         }
         _commentCache = rebuiltCollection;
     }
     catch (Exception e)
     {
         // report error
         ErrorTrace.Trace(TraceLevel.Error, e);
     }
     finally
     {
         // release the lock
         fileLock.ReleaseWriterLock();
     }
 }
コード例 #4
0
ファイル: DayExtra.cs プロジェクト: vnextcoder/dasblog-core
        internal CommentCollection GetCommentsFor(string entryId, DataManager data)
        {
            Load(data);
            CommentCollection filtered = new CommentCollection();

            foreach (Comment c in Comments)
            {
                if (c.TargetEntryId.ToUpper() == entryId.ToUpper())
                {
                    filtered.Add(c);
                }
            }
            return(filtered);
        }
コード例 #5
0
        /// <summary>
        /// Creates a shallow copy of the <see cref="CommentCollection"/>.
        /// </summary>
        /// <returns>A shallow copy of the <see cref="CommentCollection"/>.</returns>
        /// <remarks>Please refer to <see cref="ICloneable.Clone"/> for details.</remarks>

        public virtual object Clone()
        {
            CommentCollection collection = new CommentCollection(this.ToArray());

            return(collection);
        }
コード例 #6
0
 public void SaveComments(CommentCollection comments)
 {
 }