Advertisement
Guest User

Untitled

a guest
Feb 27th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 1.23 KB | None | 0 0
  1.   let ContextSerialize (x:Context) =
  2.     let doc = new doc();
  3.     let tag = makeTag doc
  4.     let attr : string -> obj -> node -> node = makeAttr doc
  5.     let child = makeChild doc
  6.     let children = makeChildren
  7.  
  8.     tag "Context"
  9.       |> attr "Id" x.Id
  10.       |> attr "Name" x.Name
  11.       |> child "DataTypeList"
  12.         |> children x.DataTypes (fun kvp ->
  13.           let dt = kvp.Value
  14.           tag "DataType"
  15.             |> attr "Id" dt.Id
  16.             |> attr "Name" dt.Name
  17.             |> attr "Color" (clr2str dt.Color))
  18.         |> parent
  19.       |> child "NodeTypeList"
  20.         |> children x.NodeTypes (fun kvp ->
  21.           let nt = kvp.Value
  22.           tag "NodeType"
  23.             |> attr "Id" nt.Id
  24.             |> attr "Name" nt.Name
  25.             |> attr "Color" (clr2str nt.Color)
  26.             |> children nt.SlotsIn (serializeSlot tag attr)
  27.             |> children nt.SlotsOut (serializeSlot tag attr))
  28.         |> parent
  29.       |> child "LinkTypeList"
  30.         |> children x.LinkTypes (fun kvp ->
  31.           let lt = kvp.Value
  32.           tag "LinkType"
  33.             |> attr "Id" lt.Id
  34.             |> attr "Name" lt.Name
  35.             |> attr "Color" (clr2str lt.Color))
  36.       |> parent
  37.       |> doc.AppendChild
  38.       |> ignore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement