Пример #1
0
        void TraverseOpml(EditorOutline outline, Outline ot)
        {
            if (outline != null)
            {
                ot.Attributes.Add("text", outline.Data);
                foreach (var a in outline.Attr)
                {
                    ot.Attributes.Add(a.Key, a.Value);
                }

                foreach (var x in outline.Children)
                {
                    var o = new Outline();
                    ot.Outlines.Add(o);

                    TraverseOpml(x, o);
                }
            }
        }
Пример #2
0
 public void FromOpml(string id, Opml opmlFile)
 {
     this.Id = id;
     this.Title = opmlFile.Title;
     if(opmlFile.OwnerId != null)
         this.OwnerId = opmlFile.OwnerId.ToString();
     this.OwnerName = opmlFile.OwnerName;
     this.OwnerEmail = opmlFile.OwnerEmail;
     this.DateCreated = opmlFile.DateCreated.HasValue ? opmlFile.DateCreated.Value.ToString("R") : DateTime.UtcNow.ToString("R");
     this.DateModified = opmlFile.DateModified.HasValue ? opmlFile.DateModified.Value.ToString("R") : DateTime.UtcNow.ToString("R");
     Body = new List<EditorOutline>();
     foreach (var outline in opmlFile.Outlines)
     {
         var editorOutline = new EditorOutline();
         Body.Add(editorOutline);
         TraverseEditor(outline, editorOutline);
     }
 }
Пример #3
0
        private void TraverseEditor(Outline outline, EditorOutline editorOutline)
        {
            if (outline != null)
            {
                foreach (var a in outline.Attributes)
                {
                    if (a.Key == "text")
                        editorOutline.Data = a.Value;
                    else
                        editorOutline.Attr.Add(a.Key, a.Value);

                    foreach (var x in outline.Outlines)
                    {
                        var o = new EditorOutline();
                        editorOutline.Children.Add(o);
                        TraverseEditor(x, o);
                    }
                }
            }
        }