Advertisement
Guest User

Untitled

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