private static IPListElement ExportGroup(Omnigraffle.Group @group) { var dict = new PListDict(); dict.Add("Class", new PListString(@group.Class)); dict.Add("ID", new PListInteger(@group.ID)); var graphics_array = new PListArray(); foreach (var graphic in @group.Graphics) { graphics_array.Add(ExportGraphic(graphic)); } dict.Add("Graphics", graphics_array); if (@group.Magnets.Count > 0) { var d2 = new PListArray(); foreach (var m in @group.Magnets) { d2.Add(new PListString(string.Format("{{{0},{1}}}", m.X, m.Y))); } dict.Add("Magnets", d2); } if (@group.GroupConnect) { dict.Add("GroupConnect", new PListString("YES")); } return(dict); }
public void GetArray() { PListArray element = _basicPlist.Root["ArrayValue"] as PListArray; Assert.IsNotNull(element); Assert.AreEqual(element.Count, 6); //dont handle date or data var b = element.Where(e => (e as PListBoolean).Value == true); Assert.IsNotNull(b); var s = element.Where(e => (e as PListString).Value == "Array Element"); Assert.IsNotNull(s); var i = element.Where(e => (e as PListInteger).IntValue == 20); Assert.IsNotNull(i); var r = element.Where(e => (e as PListReal).FloatValue == 20.12f); Assert.IsNotNull(r); var date = element.Where(e => (e as PListDate).StringValue == "2014-03-08T13:31:13Z"); Assert.IsNotNull(date); var data = element.Where(e => (e as PListData).Value == "ASNFZw=="); Assert.IsNotNull(data); }
public void device_link_service_send_process_message(PListDict msg) { PListArray array = new PListArray(); array.Add(new PListString("DLMessageProcessMessage")); array.Add(msg); PropertyListService.Send(this.sd, array); }
public void device_link_service_send_ping(string msg) { PListArray array = new PListArray(); array.Add(new PListString("DLMessagePing")); array.Add(new PListString(msg)); PropertyListService.Send(this.sd, array); }
/// <summary> /// Loads from XML node. /// </summary> /// <param name="node">The node.</param> /// <returns>The PList data constructed from the xml node.</returns> public static IPListElement LoadFromXmlNode(XmlNode node) { switch (node.Name.ToLower()) { case "string": return new PListString(node.InnerText); case "real": return new PListReal(decimal.Parse(node.InnerText)); case "integer": return new PListInteger(int.Parse(node.InnerText)); case "true": return new PListBoolean(true); case "false": return new PListBoolean(false); case "date": return new PListDate(DateTime.Parse(node.InnerText)); case "data": return new PListData(Convert.FromBase64String(node.InnerText)); case "array": { var array = new PListArray(); foreach (XmlNode child in node.ChildNodes) { array.Add(LoadFromXmlNode(child)); } return array; } case "dict": { var dict = new PListDictionary(); for (int i = 0; i < node.ChildNodes.Count; i += 2) { var keyNode = node.ChildNodes[i]; var key = keyNode.InnerText; dict.Add(key, LoadFromXmlNode(node.ChildNodes[i + 1])); } return dict; } default: return null; } }
private static IPListElement ExportPoints(List <Omnigraffle.Point> points) { var array = new PListArray(); foreach (var point in points) { array.Add(ExportPoint(point)); } return(array); }
void DrawArrayContent(PListArray array) { _indentLevel++; for (int ii = 0; ii < array.Count; ++ii) { var element = array[ii]; Style.IndentedHorizontalLine(Styling.ROW_COLOR, _indentLevel * INDENT_AMOUNT); EditorGUILayout.BeginHorizontal(); GUILayout.Space(_indentLevel * INDENT_AMOUNT); bool open = DrawFoldout(element); string name = "Item " + ii; Style.FixedWidthLabel(name, KEY_WIDTH); TypeSelector(element); //draw the value if (element is PListDictionary) { GUILayout.FlexibleSpace(); var d = element as PListDictionary; Style.MinWidthLabel("(" + d.Count + (d.Count == 1 ? " item)" : " items)"), PADDING); EditorGUILayout.Space(); } else if (element is PListArray) { GUILayout.FlexibleSpace(); var a = element as PListArray; Style.MinWidthLabel("(" + a.Count + (a.Count == 1 ? " item)" : " items)"), PADDING); EditorGUILayout.Space(); } else { DrawElement(element); } EditorGUILayout.EndHorizontal(); if (!open) { continue; } //if element is a dictionary or an array, draw its entries if (element is PListDictionary) { DrawDictionaryCommon(element as PListDictionary); } else if (element is PListArray) { DrawArrayContent(element as PListArray); } } _indentLevel--; }
public void device_link_service_version_exchange(long major, long minor) { PListArray array; PListString msg; /* receive DLMessageVersionExchange from device */ array = PropertyListService.Receive(sd) as PListArray; msg = array[0] as PListString; if (msg.Value != "DLMessageVersionExchange") { throw new DeviceLinkServiceException("Did not receive DLMessageVersionExchange from device!"); } /* get major and minor version number */ if (array.Count < 3) { throw new DeviceLinkServiceException("DLMessageVersionExchange has unexpected format!"); } var value_major = (array[1] as PListInteger).Value; var value_minor = (array[2] as PListInteger).Value; if (value_major > major) { throw new DeviceLinkServiceException( String.Format("Version mismatch: device=({0},{1}) > expected=({2},{3})", value_major, value_minor, major, minor)); } else if (value_major == major && value_minor > minor) { throw new DeviceLinkServiceException( String.Format("WARNING: Version mismatch: device=(%lld,%lld) > expected=(%lld,%lld)", value_major, value_minor, major, minor)); } /* version is ok, send reply */ var relay_array = new PListArray(); relay_array.Add(new PListString("DLMessageVersionExchange")); relay_array.Add(new PListString("DLVersionsOk")); relay_array.Add(new PListInteger(minor)); PropertyListService.Send(sd, relay_array); /* receive DeviceReady message */ var ready_array = PropertyListService.Receive(sd) as PListArray; msg = ready_array[0] as PListString; if (msg.Value != "DLMessageDeviceReady") { throw new DeviceLinkServiceException("Did not get DLMessageDeviceReady!"); } }
public void TestPListReading005() { String content = ReadResource(Resources.Info_005); PListDocument document = PListDocument.LoadFromXml(content); CheckDocument(document); Assert.IsTrue(document.Root.Dict.ContainsKey("CFBundleDocumentTypes")); PListItemBase item = document.Root.Dict["CFBundleDocumentTypes"]; Assert.IsTrue(item is PListArray); PListArray array = (PListArray)item; Assert.AreEqual(1, array.Count); }
public void Create() { PList p = new PList(); var dict = p.Root; dict.Add("IntValue", new PListInteger(10)); dict.Add("RealValue", new PListReal(3.14f)); dict.Add("StringValue", new PListString("Foo")); dict.Add("BoolValueTrue", new PListBoolean(true)); dict.Add("BoolValueFalse", new PListBoolean(false)); dict.Add("DateValue", new PListDate("2014-03-07T13:28:45Z")); dict.Add("DataValue", new PListData("bXkgcGhvdG8=")); var array = new PListArray(); array.Add(new PListString("Array Element")); array.Add(new PListBoolean(true)); array.Add(new PListInteger(20)); array.Add(new PListReal(20.12f)); array.Add(new PListDate("2014-03-08T13:31:13Z")); array.Add(new PListData("ASNFZw==")); dict.Add("ArrayValue", array); var d = new PListDictionary(); d.Add("DicInt", new PListInteger(30)); d.Add("DicReal", new PListReal(30.12f)); d.Add("DicString", new PListString("Dictionary Element")); d.Add("DicBool", new PListBoolean(true)); d.Add("DicData", new PListData("ASNFZ4mrze8=")); d.Add("DicDate", new PListDate("2014-03-09T13:33:00Z")); dict.Add("DictionaryValue", d);; string path = Path.Combine(_sampleFilePath, "manual.plist"); if (File.Exists(path)) { File.Delete(path); } Assert.IsFalse(File.Exists(path)); bool ok = p.Save(path); Assert.IsTrue(ok); PList reload = new PList(); ok = reload.Load(path); Assert.IsTrue(ok); Assert.AreEqual(_basicPlist.ToString(), reload.ToString()); File.Delete(path); }
static IPListElement ExportShapeData(Omnigraffle.ShapeData data) { var dict = new PListDict(); if (data.UnitPoints != null && data.UnitPoints.Count > 0) { var unitPoints_array = new PListArray(); foreach (var point in data.UnitPoints) { unitPoints_array.Add(ExportPoint(point)); } dict.Add("UnitPoints", unitPoints_array); } return(dict); }
private void PopulateArray(PListArray pListArray, string space) { int lvl = 0; foreach (var p in pListArray) { ListViewItem itm = new ListViewItem(); itm.Tag = p; itm.Text = space + lvl++; itm.SubItems.Add(p.ToString()); plistList.Items.Add(itm); if (p is PListDict) PopulateRecurse(p as PListDict, space + " "); else if (p is PListArray) PopulateArray(p as PListArray, space + " "); } }
public void device_link_service_disconnect(string msg) { PListArray array = new PListArray(); array.Add(new PListString("DLMessageDisconnect")); if (msg != null) { array.Add(new PListString(msg)); } else { array.Add(new PListString("___EmptyParameterString___")); } PropertyListService.Send(this.sd, array); }
public PListRoot GetAppList() { lock (sync) { var send_plist = CreateBrowsePlist(); PropertyListService.Send(sd, send_plist); PListArray array = new PListArray(); bool browsing; do { browsing = false; var dic = PropertyListService.Receive(sd) as PListDict; var status = (dic["Status"] as PListString).Value; if (status == "BrowsingApplications") { browsing = true; var amount = dic["CurrentAmount"] as PListInteger; var current_list = dic["CurrentList"] as PListArray; array.AddRange(current_list); } else { //status == "Complete" Debug.WriteLine("Browse 完成"); } } while (browsing); return(new PListRoot() { Root = array }); } }
private void PopulateArray(PListArray pListArray, string space) { int lvl = 0; foreach (var p in pListArray) { ListViewItem itm = new ListViewItem(); itm.Tag = p; itm.Text = space + lvl++; itm.SubItems.Add(p.ToString()); plistList.Items.Add(itm); if (p is PListDict) { PopulateRecurse(p as PListDict, space + " "); } else if (p is PListArray) { PopulateArray(p as PListArray, space + " "); } } }
private PListDict CreateBrowsePlist() { PListArray attr = new PListArray(); attr.Add(new PListString("CFBundleIdentifier")); //attr.Add(new PListString("DynamicDiskUsage"));应用过大会导致installd计算严重耗时 attr.Add(new PListString("StaticDiskUsage")); attr.Add(new PListString("CFBundleDisplayName")); attr.Add(new PListString("CFBundleVersion")); attr.Add(new PListString("ApplicationType")); PListDict options = new PListDict(); options.Add("ReturnAttributes", attr); options.Add("ApplicationType", new PListString("Any"));//User|System|Any PListDict dict = new PListDict(); dict.Add("ClientOptions", options); dict.Add("Command", new PListString("Browse")); return(dict); }
protected abstract void DrawArray(PListArray array);
/// <summary> /// Compiles the specified XIB file. /// </summary> /// <param name = "xibFile">The XIB file.</param> /// <param name = "directory">The directory.</param> /// <returns><code>true</code> if the compilation is successful, <code>false</code> otherwise.</returns> public bool Compile(String xibFile, String directory) { // TODO: I18N this.Logger.LogDebug(String.Format(CultureInfo.CurrentCulture, "Compiling {0} into {1}", xibFile, directory)); PListDocument result = XibTool.Compile(xibFile, directory); if (result == null) { this.Logger.LogInfo(String.Format(CultureInfo.CurrentCulture, Resources.IBFileUpToDate, xibFile)); return(true); } PList root = result.Root; PListDict dict = root.Dict; if (dict == null) { this.Logger.LogError(Resources.NoDictionaryFound); return(false); } // Global errors if (dict.ContainsKey(XibTool.ERRORS)) { PListArray errors = (PListArray)dict[XibTool.ERRORS]; foreach (PListItemBase item in errors) { PListDict error = item as PListDict; if (error == null) { continue; } PListString description = error[XibTool.KEY_DESCRIPTION] as PListString; if (description != null) { this.Logger.LogError(description.Value); } } // If there was global errors, return if (errors.Count > 0) { return(false); } } // Document errors PListDict documentErrors = (PListDict)dict[XibTool.DOCUMENT_ERRORS]; foreach (String key in documentErrors.Keys) { PListArray elementErrors = documentErrors[key] as PListArray; if (elementErrors == null) { continue; } foreach (PListItemBase item in elementErrors) { PListDict error = item as PListDict; PListString type = error[XibTool.KEY_TYPE] as PListString; PListString message = error[XibTool.KEY_MESSAGE] as PListString; if (type != null && message != null) { this.Logger.LogError(String.Format(CultureInfo.CurrentCulture, Resources.ValueDescriptionFormat, type.Value, message.Value)); } } } // If there was document errors, return if (documentErrors.Count > 0) { return(false); } // Document warnings PListDict documentWarnings = (PListDict)dict[XibTool.DOCUMENT_WARNINGS]; foreach (String key in documentWarnings.Keys) { PListArray elementWarnings = documentWarnings[key] as PListArray; if (elementWarnings == null) { continue; } foreach (PListItemBase item in elementWarnings) { PListDict error = item as PListDict; PListString type = error[XibTool.KEY_TYPE] as PListString; PListString message = error[XibTool.KEY_MESSAGE] as PListString; if (type != null && message != null) { this.Logger.LogWarning(String.Format(CultureInfo.CurrentCulture, Resources.ValueDescriptionFormat, type.Value, message.Value)); } } } // Document notices PListDict documentNotices = (PListDict)dict[XibTool.DOCUMENT_NOTICES]; foreach (String key in documentNotices.Keys) { PListArray elementNotices = documentNotices[key] as PListArray; if (elementNotices == null) { continue; } foreach (PListItemBase item in elementNotices) { PListDict error = item as PListDict; PListString type = error[XibTool.KEY_TYPE] as PListString; PListString message = error[XibTool.KEY_MESSAGE] as PListString; if (type != null && message != null) { this.Logger.LogInfo(String.Format(CultureInfo.CurrentCulture, Resources.ValueDescriptionFormat, type.Value, message.Value)); } } } return(true); }
private static PListRoot ExportDocument(Omnigraffle.Document doc) { var root = new PListRoot(); root.Format = PListFormat.Xml; var dict = new PListDict(); var applicationVersion = new PListArray(); applicationVersion.Add(new PListString(doc.ApplicationVersion.Name)); applicationVersion.Add(new PListString(doc.ApplicationVersion.Version)); dict.Add("ApplicationVersion", applicationVersion); var sheets = new PListArray(); foreach (var sheet in doc.Canvas) { var sheet_dict = new PListDict(); sheet_dict.Add("ActiveLayerIndex", new PListInteger(sheet.ActiveLayerIndex)); sheet_dict.Add("AutoAdjust", new PListBool(sheet.AutoAdjust)); var backgroundGraphic = new PListDict(); backgroundGraphic.Add("Bounds", ExportBounds(sheet.BackgroundGraphic.Bounds)); backgroundGraphic.Add("Class", ExportBackgroundGraphicClass(sheet.BackgroundGraphic.Class)); backgroundGraphic.Add("ID", new PListInteger(sheet.BackgroundGraphic.ID)); var style = new PListDict(); var shadow = ExportShadow(sheet.BackgroundGraphic.Shadow); var stroke = new PListDict(); stroke.Add("Draws", new PListString(sheet.BackgroundGraphic.DrawStroke ? "YES" : "NO")); style.Add("shadow", shadow); style.Add("stroke", stroke); backgroundGraphic.Add("Style", style); sheet_dict.Add("BackgroundGraphic", backgroundGraphic); sheet_dict.Add("BaseZoom", new PListInteger(sheet.BaseZoom)); sheet_dict.Add("CanvasOrigin", new PListString(sheet.CanvasOrigin)); sheet_dict.Add("ColumnAlign", new PListInteger(sheet.ColumnAlign)); sheet_dict.Add("ColumnSpacing", new PListReal(sheet.ColumnSpacing)); sheet_dict.Add("DisplayScale", new PListString(sheet.DisplayScale)); sheet_dict.Add("HPages", new PListInteger(sheet.HPages)); var layers = new PListArray(); if (sheet.Layers.Count > 1) { foreach (var layer in sheet.Layers) { layers.Add(ExportLayer(layer)); } } else { layers.Add(ExportLayer(new Omnigraffle.Layer())); } sheet_dict.Add("Layers", layers); var layoutInfo = new PListDict(); layoutInfo.Add("Animate", new PListString(sheet.LayoutInfo.Animate ? "YES" : "NO")); if (sheet.LayoutInfo.AutoLayout) { layoutInfo.Add("AutoLayout", new PListInteger(1)); } if (sheet.LayoutInfo.HierarchicalOrientation == Omnigraffle.HierarchicalOrientation.LeftRight) { layoutInfo.Add("HierarchicalOrientation", new PListInteger(0)); } else if (sheet.LayoutInfo.HierarchicalOrientation == Omnigraffle.HierarchicalOrientation.TopBottom) { layoutInfo.Add("HierarchicalOrientation", new PListInteger(1)); } else if (sheet.LayoutInfo.HierarchicalOrientation == Omnigraffle.HierarchicalOrientation.RightLeft) { layoutInfo.Add("HierarchicalOrientation", new PListInteger(2)); } else if (sheet.LayoutInfo.HierarchicalOrientation == Omnigraffle.HierarchicalOrientation.BottomTop) { layoutInfo.Add("HierarchicalOrientation", new PListInteger(3)); } if (sheet.LayoutInfo.LayoutEngine == Omnigraffle.LayoutEngine.Circo) { layoutInfo.Add("layoutEngine", new PListString("circo")); } else if (sheet.LayoutInfo.LayoutEngine == Omnigraffle.LayoutEngine.Dot) { layoutInfo.Add("layoutEngine", new PListString("dot")); } else if (sheet.LayoutInfo.LayoutEngine == Omnigraffle.LayoutEngine.Neato) { layoutInfo.Add("layoutEngine", new PListString("neato")); } else if (sheet.LayoutInfo.LayoutEngine == Omnigraffle.LayoutEngine.Twopi) { layoutInfo.Add("layoutEngine", new PListString("twopi")); } layoutInfo.Add("circoMinDist", new PListReal(sheet.LayoutInfo.CircoMinDist)); layoutInfo.Add("circoSeparation", new PListReal(sheet.LayoutInfo.CircoSeparation)); layoutInfo.Add("dotRankSep", new PListReal(sheet.LayoutInfo.DotRankSep)); layoutInfo.Add("neatoSeparation", new PListReal(sheet.LayoutInfo.NeatoSeparation)); layoutInfo.Add("neatoLineLength", new PListReal(sheet.LayoutInfo.NeatoLineLength)); layoutInfo.Add("neatoOverlap", new PListBool(sheet.LayoutInfo.NeatoOverlap)); layoutInfo.Add("twopiOverlap", new PListBool(sheet.LayoutInfo.TwopiOverlap)); layoutInfo.Add("twopiSeparation", new PListReal(sheet.LayoutInfo.TwopiSeparation)); layoutInfo.Add("twopiRankSep", new PListReal(sheet.LayoutInfo.TwopiRankSep)); sheet_dict.Add("LayoutInfo", layoutInfo); if (sheet.Orientation == Omnigraffle.Orientation.Portrait) { sheet_dict.Add("Orientation", new PListInteger(0)); } else if (sheet.Orientation == Omnigraffle.Orientation.Landscape) { sheet_dict.Add("Orientation", new PListInteger(1)); } else if (sheet.Orientation == Omnigraffle.Orientation.PageSetup) { sheet_dict.Add("Orientation", new PListInteger(2)); } sheet_dict.Add("PrintOnePage", new PListBool(sheet.PrintOnePage)); sheet_dict.Add("RowAlign", new PListInteger(sheet.RowAlign)); sheet_dict.Add("RowSpacing", new PListReal(sheet.RowSpacing)); sheet_dict.Add("SheetTitle", new PListString(sheet.Title)); sheet_dict.Add("UniqueID", new PListInteger(sheet.UniqueId)); sheet_dict.Add("VPages", new PListInteger(sheet.VPages)); var graphics_array = new PListArray(); foreach (var graphic in sheet.GraphicsList) { graphics_array.Add(ExportGraphic(graphic)); } sheet_dict.Add("GraphicsList", graphics_array); sheet_dict.Add("GridInfo", new PListDict()); sheets.Add(sheet_dict); } dict.Add("Sheets", sheets); dict.Add("CreationDate", new PListString(doc.CreationDate.ToString("yyyy-MM-dd hh:mm:ss +0000"))); dict.Add("ModificationDate", new PListString(doc.ModificationDate.ToString("yyyy-MM-dd hh:mm:ss +0000"))); dict.Add("Creator", new PListString(doc.Creator)); dict.Add("GraphDocumentVersion", new PListInteger(doc.GraphDocumentVersion)); dict.Add("GuidesLocked", new PListString(doc.GuidesLocked ? "YES" : "NO")); dict.Add("GuidesVisible", new PListString(doc.GuidesVisible ? "YES" : "NO")); dict.Add("ImageCounter", new PListInteger(doc.ImageCounter)); dict.Add("KeepToScale", new PListBool()); dict.Add("LinksVisible", new PListString(doc.LinksVisible ? "YES" : "NO")); dict.Add("MagnetsVisible", new PListString(doc.MagnetsVisible ? "YES" : "NO")); dict.Add("NotesVisible", new PListString(doc.NotesVisible ? "YES" : "NO")); dict.Add("OriginVisible", new PListString(doc.OriginVisible ? "YES" : "NO")); dict.Add("PageBreaks", new PListString(doc.PageBreaks ? "YES" : "NO")); dict.Add("MasterSheets", new PListArray()); dict.Add("Modifier", new PListString()); var printInfo = new PListDict(); var bottomMargin = new PListArray(); bottomMargin.Add(new PListString("float")); bottomMargin.Add(new PListString(doc.PrintInfo.BottomMargin.ToString())); printInfo.Add("NSBottomMargin", bottomMargin); var leftMargin = new PListArray(); leftMargin.Add(new PListString("float")); leftMargin.Add(new PListString(doc.PrintInfo.LeftMargin.ToString())); printInfo.Add("NSLeftMargin", leftMargin); var rightMargin = new PListArray(); rightMargin.Add(new PListString("float")); rightMargin.Add(new PListString(doc.PrintInfo.RightMargin.ToString())); printInfo.Add("NSRightMargin", rightMargin); var topMargin = new PListArray(); topMargin.Add(new PListString("float")); topMargin.Add(new PListString(doc.PrintInfo.TopMargin.ToString())); printInfo.Add("NSTopMargin", topMargin); var horizonalPagination = new PListArray(); horizonalPagination.Add(new PListString("coded")); horizonalPagination.Add(new PListString(doc.PrintInfo.HorizonalPagination)); printInfo.Add("NSHorizonalPagination", horizonalPagination); var paperSize = new PListArray(); paperSize.Add(new PListString("size")); paperSize.Add(new PListString(doc.PrintInfo.PaperSize)); printInfo.Add("NSPaperSize", paperSize); var printReverseOrientation = new PListArray(); printReverseOrientation.Add(new PListString("int")); printReverseOrientation.Add(new PListString(doc.PrintInfo.PrintReverseOrientation ? "1" : "0")); printInfo.Add("NSPrintReverseOrientation", printReverseOrientation); dict.Add("PrintInfo", printInfo); dict.Add("ReadOnly", new PListString(doc.ReadOnly ? "YES" : "NO")); dict.Add("SmartAlignmentGuidesActive", new PListString(doc.SmartAlignmentGuidesActive ? "YES" : "NO")); dict.Add("SmartDistanceGuidesActive", new PListString(doc.SmartDistanceGuidesActive ? "YES" : "NO")); dict.Add("UseEntirePage", new PListBool(doc.UseEntirePage)); var windowInfo = new PListDict(); windowInfo.Add("CurrentSheet", new PListInteger(doc.WindowInfo.CurrentSheet)); var expanded_canvases = new PListArray(); foreach (var sheet in doc.Canvas.Where(s => s.Expanded)) { var canvas_dict = new PListDict(); canvas_dict.Add("name", new PListString(sheet.Title)); expanded_canvases.Add(canvas_dict); } windowInfo.Add("ExpandedCanvases", expanded_canvases); windowInfo.Add("Frame", new PListString(doc.WindowInfo.Frame)); windowInfo.Add("ListView", new PListBool(doc.WindowInfo.ListView)); windowInfo.Add("RightSidebar", new PListBool(doc.WindowInfo.RightSidebar)); windowInfo.Add("ShowRuler", new PListBool(doc.WindowInfo.ShowRuler)); windowInfo.Add("Sidebar", new PListBool(doc.WindowInfo.Sidebar)); windowInfo.Add("SidebarWidth", new PListInteger(doc.WindowInfo.SidebarWidth)); windowInfo.Add("OutlineWidth", new PListInteger(doc.WindowInfo.OutlineWidth)); windowInfo.Add("VisibleRegion", new PListString("{{0, 0}, {558, 720}}")); windowInfo.Add("Zoom", new PListReal(doc.WindowInfo.Zoom)); var zoom_values = new PListArray(); foreach (var sheet in doc.Canvas) { var zoom_array = new PListArray(); zoom_array.Add(new PListString(sheet.Title)); zoom_array.Add(new PListReal(sheet.Zoom)); zoom_array.Add(new PListReal(1)); } windowInfo.Add("ZoomValues", zoom_values); dict.Add("WindowInfo", windowInfo); root.Root = dict; return(root); }
public void SetUp() { _element = new PListArray(); }
private static IPListElement ExportShapedGraphic(Omnigraffle.ShapedGraphic graphic) { var dict = new PListDict(); dict.Add("Bounds", ExportBounds(graphic.Bounds)); dict.Add("Class", new PListString(graphic.Class)); dict.Add("ID", new PListInteger(graphic.ID)); var shape = new PListString(); if (graphic.Shape == Omnigraffle.Shape.Bezier) { shape.Value = "Bezier"; } else if (graphic.Shape == Omnigraffle.Shape.Rectangle) { shape.Value = "Rectangle"; } else if (graphic.Shape == Omnigraffle.Shape.Circle) { shape.Value = "Circle"; } else if (graphic.Shape == Omnigraffle.Shape.Cloud) { shape.Value = "Cloud"; } else { throw new NotImplementedException(); } dict.Add("Shape", shape); var fit_text = new PListString(); if (graphic.FitText == Omnigraffle.FitText.Vertical) { fit_text.Value = "Vertical"; } if (graphic.FitText == Omnigraffle.FitText.Clip) { fit_text.Value = "Clip"; } if (graphic.FitText == Omnigraffle.FitText.Yes) { fit_text.Value = "Clip"; } dict.Add("FitText", fit_text); var flow = new PListString(); if (graphic.Flow == Omnigraffle.Flow.Resize) { flow.Value = "Resize"; } if (graphic.Flow == Omnigraffle.Flow.Clip) { flow.Value = "Clip"; } dict.Add("Flow", flow); var wrap = new PListString(); if (!graphic.Wrap) { wrap.Value = "NO"; dict.Add("Wrap", wrap); } if (graphic.FontInfo != default(Omnigraffle.FontInfo)) { dict.Add("Font", ExportFont(graphic.FontInfo)); } if (graphic.ShapeData != default(Omnigraffle.ShapeData)) { dict.Add("ShapeData", ExportShapeData(graphic.ShapeData)); } if (graphic.Style != default(Omnigraffle.StyleInfo)) { dict.Add("Style", ExportStyle(graphic.Style)); } if (graphic.VFlip) { dict.Add("VFlip", new PListBool(graphic.VFlip)); } if (graphic.HFlip) { dict.Add("HFlip", new PListBool(graphic.HFlip)); } if (!graphic.AllowConnections) { dict.Add("AllowConnections", new PListString(graphic.AllowConnections ? "YES" : "NO")); } if (graphic.Text != default(Omnigraffle.TextInfo)) { dict.Add("Text", ExportText(graphic)); } if (graphic.Line != null) { var d2 = new PListDict(); d2.Add("ID", new PListInteger(graphic.Line.ID)); d2.Add("Position", new PListReal(graphic.Line.Position)); d2.Add("RotationType", new PListInteger(graphic.Line.RotationType == Omnigraffle.RotationType.Default ? 0 : 0)); dict.Add("Line", d2); } if (graphic.Magnets.Count > 0) { var d2 = new PListArray(); foreach (var m in graphic.Magnets) { d2.Add(new PListString(string.Format("{{{0},{1}}}", m.X, m.Y))); } dict.Add("Magnets", d2); } return(dict); }
static IPListElement ExportShapeData(Omnigraffle.ShapeData data) { var dict = new PListDict (); if (data.UnitPoints != null && data.UnitPoints.Count > 0) { var unitPoints_array = new PListArray (); foreach (var point in data.UnitPoints) { unitPoints_array.Add (ExportPoint (point)); } dict.Add ("UnitPoints", unitPoints_array); } return dict; }
static void TestPList() { PListDict ht = new PListDict(); ht["user"] = new PListDict("lgx"); ht["password"] = new PListDict("123456"); decimal gender = (decimal)25.6; double g2 = 33.4; float g3 = 45.2f; int age = 18; bool istrue = true; bool isfalse = false; ht["gender"] = new PListDict(gender); ht["g2"] = new PListDict(g2); ht["g3"] = new PListDict(g3); PListDict ht2 = new PListDict(); ht2["age"] = new PListDict(age); ht2["istrue"] = new PListDict(istrue); ht2["isfalse"] = new PListDict(isfalse); ht["ht2"] = ht2; PListArray pa = new PListArray(); PListArray array = new PListArray(); array.Add(new PListDict(1)); array.Add(new PListDict("234")); array.Add(new PListDict(23.4)); array.Add(new PListDict(DateTime.Now)); PListDict ht3 = new PListDict(); ht3["age"] = new PListDict(age); ht3["istrue"] = new PListDict(istrue); ht3["isfalse"] = new PListDict(isfalse); PListDict ht4 = new PListDict(); ht4["ht3"] = ht3; array.Add(ht4); ht["array"] = array; string result = ht.ToXmlString(); Console.WriteLine(result); PListDict node = new PListDict(); node.FromXmlString(result); string nodestr = node.ToJson(); string arrayJson = array.ToJson(); Console.WriteLine(nodestr); JToken jsonObj = (JToken)JsonConvert.DeserializeObject(nodestr); JToken jsonArray = (JToken)JsonConvert.DeserializeObject(arrayJson); IPListNode node2 = new PListArray(); node2 = node2.FromJson(nodestr); string str3 = node2.ToJson(); Console.WriteLine(str3); }
void DrawArrayContent(PListArray array) { int entryToRemove = -1; _indentLevel++; Color original = GUI.color; for (int ii = 0; ii < array.Count; ++ii) { var element = array[ii]; Style.IndentedHorizontalLine(Styling.ROW_COLOR, _indentLevel * INDENT_AMOUNT); EditorGUILayout.BeginHorizontal(); GUILayout.Space(_indentLevel * INDENT_AMOUNT); bool open = DrawFoldout(element); //item number string name = "Item " + ii; EditorGUILayout.LabelField(name, GUILayout.MinWidth(KEY_WIDTH), GUILayout.MaxWidth(KEY_WIDTH)); //type IPListElement value = TypeSelector(element); if (value != element) { RemoveFoldoutEntry(element); array[ii] = value; element = array[ii]; IsDirty = true; } //draw the value if (element is PListDictionary) { var d = element as PListDictionary; Style.MinWidthLabel("(" + d.Count + (d.Count == 1 ? " item)" : " items)"), 20); EditorGUILayout.Space(); } else if (element is PListArray) { var a = element as PListArray; Style.MinWidthLabel("(" + a.Count + (a.Count == 1 ? " item)" : " items)"), 20); EditorGUILayout.Space(); } else { DrawElement(element); } if (RemoveElement(name)) { entryToRemove = ii; IsDirty = true; } EditorGUILayout.EndHorizontal(); if (!open) { continue; } //if element is a dictionary or an array, draw its entries if (element is PListDictionary) { DrawDictionaryCommon(element as PListDictionary); } else if (element is PListArray) { DrawArrayContent(element as PListArray); } } GUI.color = original; if (AddElement()) { array.Add(new PListString()); IsDirty = true; } if (entryToRemove >= 0) { RemoveFoldoutEntry(array[entryToRemove]); array.RemoveAt(entryToRemove); } _indentLevel--; }
public static void mobilesync_get_all_contacts(MobileSync client) { PListArray array = new PListArray(); array.Add(new PListString("SDMessageSyncDataClassWithDevice")); array.Add(new PListString("com.apple.Contacts")); array.Add(new PListString("---")); array.Add(new PListString("2009-01-09 18:03:58 +0100")); array.Add(new PListInteger(106)); array.Add(new PListString("___EmptyParameterString___")); client.mobilesync_send(array); array = client.mobilesync_receive() as PListArray; array = new PListArray(); array.Add(new PListString("SDMessageGetAllRecordsFromDevice")); array.Add(new PListString("com.apple.Contacts")); client.mobilesync_send(array); array = client.mobilesync_receive() as PListArray; PListString contact_node = array[1] as PListString; PListString switch_node = array[0] as PListString; while (contact_node.Value == "com.apple.Contacts" && switch_node.Value != "SDMessageDeviceReadyToReceiveChanges") { array = new PListArray(); array.Add(new PListString("SDMessageAcknowledgeChangesFromDevice")); array.Add(new PListString("com.apple.Contacts")); client.mobilesync_send(array); array = client.mobilesync_receive() as PListArray; contact_node = array[1] as PListString; switch_node = array[0] as PListString; } array = new PListArray(); array.Add(new PListString("DLMessagePing")); array.Add(new PListString("Preparing to get changes for device")); client.mobilesync_send(array); array = new PListArray(); array.Add(new PListString("SDMessageProcessChanges")); array.Add(new PListString("com.apple.Contacts")); array.Add(create_new_contact()); array.Add(new PListBool(false)); PListDict dict = new PListDict(); array.Add(dict); PListArray array2 = new PListArray(); dict.Add("SyncDeviceLinkEntityNamesKey", array2); array2.Add(new PListString("com.apple.contacts.Contact")); array2.Add(new PListString("com.apple.contacts.Group")); dict.Add("SyncDeviceLinkAllRecordsOfPulledEntityTypeSentKey", new PListBool(true)); ShowIPListElement(array); client.mobilesync_send(array); array = client.mobilesync_receive() as PListArray; PListArray finish = new PListArray(); finish.Add(new PListString("SDMessageFinishSessionOnDevice")); finish.Add(new PListString("com.apple.Contacts")); client.mobilesync_send(finish); finish = client.mobilesync_receive() as PListArray; }
protected override void DrawArray(PListArray array) { GUILayout.FlexibleSpace(); Style.MinWidthLabel("(" + array.Count + (array.Count == 1 ? " item)" : " items)"), PADDING); EditorGUILayout.Space(); }
private static IPListElement ExportGroup(Omnigraffle.Group @group) { var dict = new PListDict (); dict.Add ("Class", new PListString (@group.Class)); dict.Add ("ID", new PListInteger (@group.ID)); var graphics_array = new PListArray (); foreach (var graphic in @group.Graphics) { graphics_array.Add (ExportGraphic (graphic)); } dict.Add ("Graphics", graphics_array); if (@group.Magnets.Count > 0) { var d2 = new PListArray(); foreach (var m in @group.Magnets) { d2.Add(new PListString(string.Format(CultureInfo.InvariantCulture, "{{{0:0.######},{1:0.######}}}", m.X, m.Y))); } dict.Add ("Magnets", d2); } if (@group.GroupConnect) { dict.Add ("GroupConnect", new PListString ("YES")); } return dict; }
private static IPListElement ExportShapedGraphic(Omnigraffle.ShapedGraphic graphic) { var dict = new PListDict (); dict.Add ("Bounds", ExportBounds (graphic.Bounds)); dict.Add ("Class", new PListString (graphic.Class)); dict.Add ("ID", new PListInteger (graphic.ID)); var shape = new PListString (); if (graphic.Shape == Omnigraffle.Shape.Bezier) shape.Value = "Bezier"; else if (graphic.Shape == Omnigraffle.Shape.Rectangle) shape.Value = "Rectangle"; else if (graphic.Shape == Omnigraffle.Shape.Circle) shape.Value = "Circle"; else if (graphic.Shape == Omnigraffle.Shape.Cloud) shape.Value = "Cloud"; else throw new NotImplementedException (); dict.Add ("Shape", shape); var fit_text = new PListString (); if (graphic.FitText == Omnigraffle.FitText.Vertical) fit_text.Value = "Vertical"; if (graphic.FitText == Omnigraffle.FitText.Clip) fit_text.Value = "Clip"; if (graphic.FitText == Omnigraffle.FitText.Yes) fit_text.Value = "Clip"; dict.Add ("FitText", fit_text); var flow = new PListString (); if (graphic.Flow == Omnigraffle.Flow.Resize) flow.Value = "Resize"; if (graphic.Flow == Omnigraffle.Flow.Clip) flow.Value = "Clip"; dict.Add ("Flow", flow); var wrap = new PListString (); if (!graphic.Wrap) { wrap.Value = "NO"; dict.Add ("Wrap", wrap); } if (graphic.FontInfo != default (Omnigraffle.FontInfo)) { dict.Add ("Font", ExportFont (graphic.FontInfo)); } if (graphic.ShapeData != default (Omnigraffle.ShapeData)) dict.Add ("ShapeData", ExportShapeData (graphic.ShapeData)); if (graphic.Style != default (Omnigraffle.StyleInfo)) dict.Add ("Style", ExportStyle (graphic.Style)); if (graphic.VFlip) dict.Add ("VFlip", new PListBool (graphic.VFlip)); if (graphic.HFlip) dict.Add ("HFlip", new PListBool (graphic.HFlip)); if (!graphic.AllowConnections) dict.Add ("AllowConnections", new PListString (graphic.AllowConnections ? "YES" : "NO")); if (graphic.Text != default(Omnigraffle.TextInfo)) dict.Add ("Text", ExportText (graphic)); if (graphic.Line != null) { var d2 = new PListDict(); d2.Add ("ID", new PListInteger(graphic.Line.ID)); d2.Add ("Position", new PListReal(graphic.Line.Position)); d2.Add ("RotationType", new PListInteger(graphic.Line.RotationType == Omnigraffle.RotationType.Default ? 0 : 0)); dict.Add ("Line", d2); } if (graphic.Magnets.Count > 0) { var d2 = new PListArray(); foreach (var m in graphic.Magnets) { d2.Add(new PListString(string.Format(CultureInfo.InvariantCulture, "{{{0:0.######},{1:0.######}}}", m.X, m.Y))); } dict.Add ("Magnets", d2); } return dict; }
private static PListRoot ExportDocument(Omnigraffle.Document doc) { var root = new PListRoot (); root.Format = PListFormat.Xml; var dict = new PListDict (); var applicationVersion = new PListArray (); applicationVersion.Add (new PListString (doc.ApplicationVersion.Name)); applicationVersion.Add (new PListString (doc.ApplicationVersion.Version)); dict.Add ("ApplicationVersion", applicationVersion); var sheets = new PListArray (); foreach (var sheet in doc.Canvas) { var sheet_dict = new PListDict (); sheet_dict.Add ("ActiveLayerIndex", new PListInteger (sheet.ActiveLayerIndex)); sheet_dict.Add ("AutoAdjust", new PListBool (sheet.AutoAdjust)); var backgroundGraphic = new PListDict (); backgroundGraphic.Add ("Bounds", ExportBounds (sheet.BackgroundGraphic.Bounds)); backgroundGraphic.Add ("Class", ExportBackgroundGraphicClass (sheet.BackgroundGraphic.Class)); backgroundGraphic.Add ("ID", new PListInteger (sheet.BackgroundGraphic.ID)); var style = new PListDict (); var shadow = ExportShadow (sheet.BackgroundGraphic.Shadow); var stroke = new PListDict (); stroke.Add ("Draws", new PListString (sheet.BackgroundGraphic.DrawStroke ? "YES" : "NO")); style.Add ("shadow", shadow); style.Add ("stroke", stroke); backgroundGraphic.Add ("Style", style); sheet_dict.Add ("BackgroundGraphic", backgroundGraphic); sheet_dict.Add ("BaseZoom", new PListInteger (sheet.BaseZoom)); sheet_dict.Add ("CanvasOrigin", new PListString (sheet.CanvasOrigin)); sheet_dict.Add ("ColumnAlign", new PListInteger (sheet.ColumnAlign)); sheet_dict.Add ("ColumnSpacing", new PListReal (sheet.ColumnSpacing)); sheet_dict.Add ("DisplayScale", new PListString (sheet.DisplayScale)); sheet_dict.Add ("HPages", new PListInteger (sheet.HPages)); var layers = new PListArray (); if (sheet.Layers.Count > 1) { foreach (var layer in sheet.Layers) { layers.Add (ExportLayer (layer)); } } else { layers.Add (ExportLayer (new Omnigraffle.Layer ())); } sheet_dict.Add ("Layers", layers); var layoutInfo = new PListDict (); layoutInfo.Add ("Animate", new PListString (sheet.LayoutInfo.Animate ? "YES" : "NO")); if (sheet.LayoutInfo.AutoLayout) layoutInfo.Add ("AutoLayout", new PListInteger (1)); if (sheet.LayoutInfo.HierarchicalOrientation == Omnigraffle.HierarchicalOrientation.LeftRight) layoutInfo.Add ("HierarchicalOrientation", new PListInteger (0)); else if (sheet.LayoutInfo.HierarchicalOrientation == Omnigraffle.HierarchicalOrientation.TopBottom) layoutInfo.Add ("HierarchicalOrientation", new PListInteger (1)); else if (sheet.LayoutInfo.HierarchicalOrientation == Omnigraffle.HierarchicalOrientation.RightLeft) layoutInfo.Add ("HierarchicalOrientation", new PListInteger (2)); else if (sheet.LayoutInfo.HierarchicalOrientation == Omnigraffle.HierarchicalOrientation.BottomTop) layoutInfo.Add ("HierarchicalOrientation", new PListInteger (3)); if (sheet.LayoutInfo.LayoutEngine == Omnigraffle.LayoutEngine.Circo) layoutInfo.Add ("layoutEngine", new PListString ("circo")); else if (sheet.LayoutInfo.LayoutEngine == Omnigraffle.LayoutEngine.Dot) layoutInfo.Add ("layoutEngine", new PListString ("dot")); else if (sheet.LayoutInfo.LayoutEngine == Omnigraffle.LayoutEngine.Neato) layoutInfo.Add ("layoutEngine", new PListString ("neato")); else if (sheet.LayoutInfo.LayoutEngine == Omnigraffle.LayoutEngine.Twopi) layoutInfo.Add ("layoutEngine", new PListString ("twopi")); layoutInfo.Add ("circoMinDist", new PListReal (sheet.LayoutInfo.CircoMinDist)); layoutInfo.Add ("circoSeparation", new PListReal (sheet.LayoutInfo.CircoSeparation)); layoutInfo.Add ("dotRankSep", new PListReal (sheet.LayoutInfo.DotRankSep)); layoutInfo.Add ("neatoSeparation", new PListReal (sheet.LayoutInfo.NeatoSeparation)); layoutInfo.Add ("neatoLineLength", new PListReal (sheet.LayoutInfo.NeatoLineLength)); layoutInfo.Add ("neatoOverlap", new PListBool (sheet.LayoutInfo.NeatoOverlap)); layoutInfo.Add ("twopiOverlap", new PListBool (sheet.LayoutInfo.TwopiOverlap)); layoutInfo.Add ("twopiSeparation", new PListReal (sheet.LayoutInfo.TwopiSeparation)); layoutInfo.Add ("twopiRankSep", new PListReal (sheet.LayoutInfo.TwopiRankSep)); sheet_dict.Add ("LayoutInfo", layoutInfo); if (sheet.Orientation == Omnigraffle.Orientation.Portrait) sheet_dict.Add ("Orientation", new PListInteger(0)); else if (sheet.Orientation == Omnigraffle.Orientation.Landscape) sheet_dict.Add ("Orientation", new PListInteger(1)); else if (sheet.Orientation == Omnigraffle.Orientation.PageSetup) sheet_dict.Add ("Orientation", new PListInteger(2)); sheet_dict.Add ("PrintOnePage", new PListBool (sheet.PrintOnePage)); sheet_dict.Add ("RowAlign", new PListInteger (sheet.RowAlign)); sheet_dict.Add ("RowSpacing", new PListReal (sheet.RowSpacing)); sheet_dict.Add ("SheetTitle", new PListString (sheet.Title)); sheet_dict.Add ("UniqueID", new PListInteger (sheet.UniqueId)); sheet_dict.Add ("VPages", new PListInteger (sheet.VPages)); var graphics_array = new PListArray (); foreach (var graphic in sheet.GraphicsList) { graphics_array.Add (ExportGraphic (graphic)); } sheet_dict.Add ("GraphicsList", graphics_array); sheet_dict.Add ("GridInfo", new PListDict ()); sheets.Add (sheet_dict); } dict.Add ("Sheets", sheets); dict.Add ("CreationDate", new PListString (doc.CreationDate.ToString ("yyyy-MM-dd hh:mm:ss +0000"))); dict.Add ("ModificationDate", new PListString (doc.ModificationDate.ToString ("yyyy-MM-dd hh:mm:ss +0000"))); dict.Add ("Creator", new PListString (doc.Creator)); dict.Add ("GraphDocumentVersion", new PListInteger (doc.GraphDocumentVersion)); dict.Add ("GuidesLocked", new PListString (doc.GuidesLocked ? "YES" : "NO")); dict.Add ("GuidesVisible", new PListString (doc.GuidesVisible ? "YES" : "NO")); dict.Add ("ImageCounter", new PListInteger (doc.ImageCounter)); dict.Add ("KeepToScale", new PListBool ()); dict.Add ("LinksVisible", new PListString (doc.LinksVisible ? "YES" : "NO")); dict.Add ("MagnetsVisible", new PListString (doc.MagnetsVisible ? "YES" : "NO")); dict.Add ("NotesVisible", new PListString (doc.NotesVisible ? "YES" : "NO")); dict.Add ("OriginVisible", new PListString (doc.OriginVisible ? "YES" : "NO")); dict.Add ("PageBreaks", new PListString (doc.PageBreaks ? "YES" : "NO")); dict.Add ("MasterSheets", new PListArray ()); dict.Add ("Modifier", new PListString ()); var printInfo = new PListDict (); var bottomMargin = new PListArray (); bottomMargin.Add (new PListString ("float")); bottomMargin.Add (new PListString (string.Format (CultureInfo.InvariantCulture, "{0:0.######}", doc.PrintInfo.BottomMargin))); printInfo.Add ("NSBottomMargin", bottomMargin); var leftMargin = new PListArray (); leftMargin.Add (new PListString ("float")); leftMargin.Add (new PListString (string.Format (CultureInfo.InvariantCulture, "{0:0.######}", doc.PrintInfo.LeftMargin))); printInfo.Add ("NSLeftMargin", leftMargin); var rightMargin = new PListArray (); rightMargin.Add (new PListString ("float")); rightMargin.Add (new PListString (string.Format (CultureInfo.InvariantCulture, "{0:0.######}", doc.PrintInfo.RightMargin))); printInfo.Add ("NSRightMargin",rightMargin); var topMargin = new PListArray (); topMargin.Add (new PListString ("float")); topMargin.Add (new PListString (string.Format (CultureInfo.InvariantCulture, "{0:0.######}", doc.PrintInfo.TopMargin))); printInfo.Add ("NSTopMargin", topMargin); var horizonalPagination = new PListArray (); horizonalPagination.Add (new PListString ("coded")); horizonalPagination.Add (new PListString (doc.PrintInfo.HorizonalPagination)); printInfo.Add ("NSHorizonalPagination", horizonalPagination); var paperSize = new PListArray (); paperSize.Add (new PListString ("size")); paperSize.Add (new PListString (doc.PrintInfo.PaperSize)); printInfo.Add ("NSPaperSize", paperSize); var printReverseOrientation = new PListArray (); printReverseOrientation.Add (new PListString ("int")); printReverseOrientation.Add (new PListString (doc.PrintInfo.PrintReverseOrientation ? "1" : "0")); printInfo.Add ("NSPrintReverseOrientation", printReverseOrientation); dict.Add ("PrintInfo", printInfo); dict.Add ("ReadOnly", new PListString (doc.ReadOnly ? "YES" : "NO")); dict.Add ("SmartAlignmentGuidesActive", new PListString (doc.SmartAlignmentGuidesActive ? "YES" : "NO")); dict.Add ("SmartDistanceGuidesActive", new PListString (doc.SmartDistanceGuidesActive ? "YES" : "NO")); dict.Add ("UseEntirePage", new PListBool (doc.UseEntirePage)); var windowInfo = new PListDict (); windowInfo.Add ("CurrentSheet", new PListInteger (doc.WindowInfo.CurrentSheet)); var expanded_canvases = new PListArray (); foreach (var sheet in doc.Canvas.Where (s => s.Expanded)) { var canvas_dict = new PListDict (); canvas_dict.Add ("name", new PListString(sheet.Title)); expanded_canvases.Add (canvas_dict); } windowInfo.Add ("ExpandedCanvases", expanded_canvases); windowInfo.Add ("Frame", new PListString (doc.WindowInfo.Frame)); windowInfo.Add ("ListView", new PListBool (doc.WindowInfo.ListView)); windowInfo.Add ("RightSidebar", new PListBool (doc.WindowInfo.RightSidebar)); windowInfo.Add ("ShowRuler", new PListBool (doc.WindowInfo.ShowRuler)); windowInfo.Add ("Sidebar", new PListBool (doc.WindowInfo.Sidebar)); windowInfo.Add ("SidebarWidth", new PListInteger (doc.WindowInfo.SidebarWidth)); windowInfo.Add ("OutlineWidth", new PListInteger (doc.WindowInfo.OutlineWidth)); windowInfo.Add ("VisibleRegion", new PListString ("{{0, 0}, {558, 720}}")); windowInfo.Add ("Zoom", new PListReal (doc.WindowInfo.Zoom)); var zoom_values = new PListArray (); foreach (var sheet in doc.Canvas) { var zoom_array = new PListArray (); zoom_array.Add (new PListString (sheet.Title)); zoom_array.Add (new PListReal (sheet.Zoom)); zoom_array.Add (new PListReal (1)); } windowInfo.Add ("ZoomValues", zoom_values); dict.Add ("WindowInfo", windowInfo); root.Root = dict; return root; }
private static IPListElement ExportPoints(List<Omnigraffle.Point> points) { var array = new PListArray (); foreach (var point in points) { array.Add (ExportPoint (point)); } return array; }