Advertisement
Guest User

Untitled

a guest
Feb 24th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 1.40 KB | None | 0 0
  1.  
  2.     let serializeSlot (s:Slot) =  
  3.       node "Slot"
  4.       |> attr "Id" s.Id
  5.       |> attr "TypeId" s.TypeId
  6.       |> attr "Name" s.Name
  7.       |> attr "Mode" (SlotMode.GetName s.Mode)
  8.  
  9.     let context =
  10.       node "Context"
  11.         |> attr "Id" x.Id
  12.         |> attr "Name" x.Name
  13.         |> child "DataTypeList"
  14.           |> children x.DataTypes (fun kvp ->
  15.             let dt = kvp.Value
  16.             node "DataType"
  17.               |> attr "Id" dt.Id
  18.               |> attr "Name" dt.Name
  19.               |> attr "Color" (Utils.ColorToString dt.Color))
  20.           |> parent
  21.         |> child "NodeTypeList"
  22.           |> children x.NodeTypes (fun kvp ->
  23.             let nt = kvp.Value
  24.             node "NodeType"
  25.               |> attr "Id" nt.Id
  26.               |> attr "Name" nt.Name
  27.               |> attr "Color" (Utils.ColorToString nt.Color)
  28.               |> child "SlotsIn"
  29.                 |> children nt.SlotsIn serializeSlot
  30.                 |> parent
  31.               |> child "SlotsOut"
  32.                 |> children nt.SlotsOut serializeSlot
  33.                 |> parent)
  34.           |> parent
  35.         |> child "LinkTypeList"
  36.           |> children x.LinkTypes (fun kvp ->
  37.             let lt = kvp.Value
  38.             node "LinkType"
  39.               |> attr "Id" lt.Id
  40.               |> attr "Name" lt.Name
  41.               |> attr "Color" (Utils.ColorToString lt.Color)
  42.         )
  43.         |> parent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement