예제 #1
0
        static PListDict ExportStyle(Omnigraffle.StyleInfo style)
        {
            var dict = new PListDict();

            if (style.Fill != default(Omnigraffle.FillInfo))
            {
                var fill = new PListDict();

                if (style.Fill.Color != default(Omnigraffle.Color))
                {
                    fill.Add("Color", ExportColor(style.Fill.Color));
                }

                dict.Add("fill", fill);
            }

            if (style.Shadow != default(Omnigraffle.ShadowInfo))
            {
                dict.Add("shadow", ExportShadow(style.Shadow));
            }

            if (style.Stroke != default(Omnigraffle.StrokeInfo))
            {
                dict.Add("stroke", ExportStroke(style.Stroke));
            }

            return(dict);
        }
예제 #2
0
        private static IPListElement ExportText(Omnigraffle.ShapedGraphic graphic)
        {
            var dict = new PListDict();

            var alignement = @"\ql";

            if (graphic.Text.Alignement == Omnigraffle.TextAlignement.Center)
            {
                alignement = @"\qc";
            }
            else if (graphic.Text.Alignement == Omnigraffle.TextAlignement.Right)
            {
                alignement = @"\qr";
            }
            else if (graphic.Text.Alignement == Omnigraffle.TextAlignement.Justified)
            {
                alignement = @"\qj";
            }

            dict.Add("Text", new PListString(string.Format(@"{{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
{{\fonttbl\f0\fswiss\fcharset0 {1};}}
{{\colortbl;\red255\green255\blue255;}}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural{3}

\f0\fs{2} \cf0 {0}}}", graphic.Text.Text, graphic.FontInfo.Font, graphic.FontInfo.Size * 2, alignement)));

            // if (graphic.Text.SideMargin > 0)
            dict.Add("Pad", new PListInteger(graphic.Text.SideMargin));

            // if (graphic.Text.TopBottomMargin > 0)
            dict.Add("VerticalPad", new PListInteger(graphic.Text.TopBottomMargin));

            return(dict);
        }
예제 #3
0
        public static PListDict eti_contact_plist_builder_build_main(Dictionary <string, EtiContact> contacts)
        {
            var main_plist = new PListDict();

            foreach (var item in contacts)
            {
                var uid     = item.Key;
                var contact = item.Value;

                var      main_info = new PListDict();
                DateTime birthday;
                byte[]   image_data;
                int      data_length;

                main_info.Add("com.apple.syncservices.RecordEntityName", new PListString("com.apple.contacts.Contact"));
                main_info.Add("first name", new PListString(contact.first_name));
                main_info.Add("first name yomi", new PListString(contact.first_name_yomi));
                main_info.Add("middle name", new PListString(contact.middle_name));
                //... lat name,nickname,title,suffix

                //birthday = contact.birthday;

                //main_info.Add("birthday", new PListDate(birthday));

                //main_info.Add("image", new PListData(contact.photo.image_data));

                main_plist.Add(uid, main_info);
            }

            return(main_plist);
        }
예제 #4
0
        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);
        }
예제 #5
0
 private static IPListElement ExportColor(Omnigraffle.Color color)
 {
     var dict = new PListDict ();
     dict.Add ("r", new PListString (string.Format(CultureInfo.InvariantCulture, "{0:0.######}", color.r)));
     dict.Add ("g", new PListString (string.Format(CultureInfo.InvariantCulture, "{0:0.######}", color.g)));
     dict.Add ("b", new PListString (string.Format(CultureInfo.InvariantCulture, "{0:0.######}", color.b)));
     return dict;
 }
예제 #6
0
        private static IPListElement ExportColor(Omnigraffle.Color color)
        {
            var dict = new PListDict();

            dict.Add("r", new PListString(color.r.ToString()));
            dict.Add("g", new PListString(color.g.ToString()));
            dict.Add("b", new PListString(color.b.ToString()));
            return(dict);
        }
예제 #7
0
        static PListDict ExportFont(Omnigraffle.FontInfo font)
        {
            var dict = new PListDict();

            dict.Add("Color", ExportColor(font.Color));
            dict.Add("Font", new PListString(font.Font));
            dict.Add("NSKern", new PListReal(font.Kerning));
            dict.Add("Size", new PListReal(font.Size));
            return(dict);
        }
예제 #8
0
        private static IPListElement ExportLayer(KAOSTools.OmnigraffleExport.Omnigraffle.Layer layer)
        {
            var layer_dict = new PListDict();

            layer_dict.Add("Name", new PListString(layer.Name));
            layer_dict.Add("Lock", new PListString(layer.Lock ? "YES" : "NO"));
            layer_dict.Add("View", new PListString(layer.View ? "YES" : "NO"));
            layer_dict.Add("Print", new PListString(layer.Print ? "YES" : "NO"));

            return(layer_dict);
        }
예제 #9
0
        private static PListDict ExportShadow(Omnigraffle.ShadowInfo shadowInfo)
        {
            var shadow = new PListDict();

            shadow.Add("Draws", new PListString(shadowInfo.Draws ? "YES" : "NO"));

            if (shadowInfo.ShadowVector != null)
            {
                shadow.Add("ShadowVector", new PListString(string.Format("{{{0}, {1}}}", shadowInfo.ShadowVector.X, shadowInfo.ShadowVector.Y)));
            }

            return(shadow);
        }
예제 #10
0
        public static PListDict create_new_contact()
        {
            PListDict contact = new PListDict();
            PListDict value   = new PListDict();

            contact.Add("{B3C33737-35A0-401F-A25E-00D427D733F7}", value);

            //value.Add("birthday", new PListDate(DateTime.Now));
            value.Add("com.apple.syncservices.RecordEntityName", new PListString("com.apple.contacts.Contact"));
            value.Add("display as company", new PListString("person"));
            value.Add("last name", new PListString("pizixie"));

            return(contact);
        }
예제 #11
0
        public PListDict GetIconState()
        {
            lock (sync)
            {
                PListDict root = new PListDict();
                root.Add("command", new PListString("getIconState"));
                root.Add("formatVersion", new PListString("2"));

                PropertyListService.Send(sd, root);

                var recv_plist = PropertyListService.Receive(sd);

                return(recv_plist as PListDict);
            }
        }
예제 #12
0
        public PListDict GetIconPNGData(string bundle_id)
        {
            lock (sync)
            {
                PListDict root = new PListDict();
                root.Add("command", new PListString("getIconPNGData"));
                root.Add("bundleId", new PListString(bundle_id));

                PropertyListService.Send(sd, root);

                var recv = PropertyListService.Receive(sd);

                return(recv as PListDict);
            }
        }
예제 #13
0
        private static IPListElement ExportLineEndInfo(Omnigraffle.LineEndInfo @end)
        {
            var dict = new PListDict();

            dict.Add("ID", new PListInteger(@end.ID));
            return(dict);
        }
예제 #14
0
        public void SavePlist(List <PackerSprite> saveSpriteList, string strImageName)
        {
            this.SavePlistList(strImageName + ".plist", false);
            PListRoot plistRoot  = new PListRoot();
            PListDict plistDict1 = new PListDict();

            plistRoot.Root = (IPListElement)plistDict1;
            PListDict plistDict2 = new PListDict();

            plistDict1.Add("frames", (IPListElement)plistDict2);
            foreach (PackerSprite saveSprite in saveSpriteList)
            {
                PListDict plistDict3 = new PListDict();
                plistDict2.Add(saveSprite.name, (IPListElement)plistDict3);
                plistDict3.Add("width", (IPListElement) new PListInteger((long)(int)saveSprite.width));
                plistDict3.Add("height", (IPListElement) new PListInteger((long)(int)saveSprite.height));
                plistDict3.Add("originalWidth", (IPListElement) new PListInteger((long)(int)saveSprite.originalWidth));
                plistDict3.Add("originalHeight", (IPListElement) new PListInteger((long)(int)saveSprite.originalHeight));
                plistDict3.Add("x", (IPListElement) new PListInteger((long)(int)saveSprite.x));
                plistDict3.Add("y", (IPListElement) new PListInteger((long)(int)saveSprite.y));
                plistDict3.Add("offsetX", (IPListElement) new PListReal((double)saveSprite.offsetX));
                plistDict3.Add("offsetY", (IPListElement) new PListReal((double)saveSprite.offsetY));
            }
            string    str1       = strImageName + ".png";
            string    str2       = Path.Combine(this.fullPathStr, strImageName);
            PListDict plistDict4 = new PListDict();

            plistDict1.Add("metadata", (IPListElement)plistDict4);
            plistDict4.Add("format", (IPListElement) new PListInteger(0L));
            plistDict4.Add("textureFileName", (IPListElement) new PListString(str1));
            plistDict4.Add("realTextureFileName", (IPListElement) new PListString(str1));
            string str3 = "{" + (object)this.maxWidth + "," + (object)this.maxHeight + "}";

            plistDict4.Add("size", (IPListElement) new PListString(str3));
            PListDict plistDict5 = new PListDict();

            plistDict1.Add("texture", (IPListElement)plistDict5);
            plistDict5.Add("width", (IPListElement) new PListInteger((long)this.maxWidth));
            plistDict5.Add("height", (IPListElement) new PListInteger((long)this.maxHeight));
            this.PlistDirectory.Add(str2 + ".plist", plistRoot);
        }
예제 #15
0
        static IPListElement ExportStroke(Omnigraffle.StrokeInfo stroke)
        {
            var dict = new PListDict();

            if (stroke.Draws)
            {
                dict.Add("HeadArrow", ExportArrow(stroke.HeadArrow));
                dict.Add("TailArrow", ExportArrow(stroke.TailArrow));

                dict.Add("Legacy", new PListBool(stroke.Legacy));

                dict.Add("Width", new PListReal(stroke.Width));

                dict.Add("CornerRadius", new PListReal(stroke.CornerRadius));

                if (stroke.Pattern != KAOSTools.OmnigraffleExport.Omnigraffle.StrokePattern.None)
                {
                    if (stroke.Pattern == KAOSTools.OmnigraffleExport.Omnigraffle.StrokePattern.Dashed)
                    {
                        dict.Add("Pattern", new PListInteger(1));
                    }
                }

                if (stroke.LineType == KAOSTools.OmnigraffleExport.Omnigraffle.LineType.Straight)
                {
                    // dict.Add ("LineType", new PListInteger (0));
                }
                else if (stroke.LineType == KAOSTools.OmnigraffleExport.Omnigraffle.LineType.Curved)
                {
                    dict.Add("LineType", new PListInteger(1));
                }
                else if (stroke.LineType == KAOSTools.OmnigraffleExport.Omnigraffle.LineType.Orthogonal)
                {
                    dict.Add("LineType", new PListInteger(2));
                }
            }
            else
            {
                dict.Add("Draws", new PListString(stroke.Draws ? "YES" : "NO"));
            }

            return(dict);
        }
        public void UpdateFBSettings(string appID, string[] allAppIDs, string urlSuffix)
        {
            xmlDict["FacebookAppID"] = appID;

            if (xmlDict.ContainsKey("CFBundleURLTypes"))
            {
                var currentSchemas = (List<object>)xmlDict["CFBundleURLTypes"];
                for (int i = 0; i < currentSchemas.Count; i++)
                {
                    // if it's not a dictionary, go to next index
                    if (currentSchemas[i].GetType() == typeof(PListDict))
                    {
                        var bundleTypeNode = (PListDict)currentSchemas[i];
                        if (bundleTypeNode.ContainsKey("CFBundleURLSchemes") && bundleTypeNode["CFBundleURLSchemes"].GetType() == typeof(List<object>))
                        {
                            var appIdsFromPListDict = (List<object>)bundleTypeNode["CFBundleURLSchemes"];
                            string firstAppID = (string)appIdsFromPListDict[0];
                            if (firstAppID.Contains("fb"))
                            {
                                // this is FB component
                                // clear old FB schemas, add current (editor properties) schemas
                                appIdsFromPListDict.Clear();
                                AddAppIDs(appIdsFromPListDict, allAppIDs, urlSuffix);
                                return;
                            }
                        }
                    }
                }

                // Didn't find FB schema, let's add FB schema to the list of schemas already present
                var appIds = new List<object>();
                AddAppIDs(appIds, allAppIDs, urlSuffix);
                var schemaEntry = new PListDict();
                schemaEntry.Add("CFBundleURLSchemes", appIds);
                currentSchemas.Add(schemaEntry);
                return;
            }
            else
            {
                // Didn't find any CFBundleURLTypes, let's create one
                var appIds = new List<object>();
                AddAppIDs(appIds, allAppIDs, urlSuffix);
                var schemaEntry = new PListDict();
                schemaEntry.Add("CFBundleURLSchemes",appIds);

                var currentSchemas = new List<object>();
                currentSchemas.Add(schemaEntry);
                xmlDict.Add("CFBundleURLTypes", currentSchemas);
            }
        }
예제 #17
0
        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);
        }
예제 #18
0
        protected override PListRoot OnToPlist(List <ImageInfo> imageList, Size size, string imageKey)
        {
            PListRoot plistRoot  = new PListRoot();
            PListDict plistDict1 = new PListDict();

            plistRoot.Root = (IPListElement)plistDict1;
            PListDict plistDict2 = new PListDict();

            plistDict1.Add("frames", (IPListElement)plistDict2);
            foreach (ImageInfo image in imageList)
            {
                PListDict plistDict3 = new PListDict();
                plistDict2.Add(image.Name, (IPListElement)plistDict3);
                string str1 = PlistFormatHelp.ConvertToString(image.Bounding);
                plistDict3.Add("frame", (IPListElement) new PListString(str1));
                string str2 = PlistFormatHelp.ConvertToString(new Point(image.SourceLocation.X + image.Bounding.Width / 2 - image.SourceSize.Width / 2, image.SourceSize.Height / 2 - (image.SourceLocation.Y + image.Bounding.Height / 2)));
                plistDict3.Add("offset", (IPListElement) new PListString(str2));
                plistDict3.Add("rotated", (IPListElement) new PListBool(image.IsRotation));
                string str3 = PlistFormatHelp.ConvertToString(image.SourceSize);
                plistDict3.Add("sourceSize", (IPListElement) new PListString(str3));
            }
            PListDict plistDict4 = new PListDict();

            plistDict1.Add("metadata", (IPListElement)plistDict4);
            plistDict4.Add("format", (IPListElement) new PListInteger(2L));
            plistDict4.Add("textureFileName", (IPListElement) new PListString(imageKey));
            plistDict4.Add("realTextureFileName", (IPListElement) new PListString(imageKey));
            string str = "{" + (object)size.Width + "," + (object)size.Height + "}";

            plistDict4.Add("size", (IPListElement) new PListString(str));
            PListDict plistDict5 = new PListDict();

            plistDict1.Add("texture", (IPListElement)plistDict5);
            plistDict5.Add("width", (IPListElement) new PListInteger((long)size.Width));
            plistDict5.Add("height", (IPListElement) new PListInteger((long)size.Height));
            return(plistRoot);
        }
예제 #19
0
        public PListDict GetHomeScreenWallpaperPNGData()
        {
            //throw new NotImplementedException();
            lock (sync)
            {
                PListDict dict = new PListDict();
                dict.Add("command", new PListString("getHomeScreenWallpaperPNGData"));

                PropertyListService.Send(sd, dict);

                var recv = PropertyListService.Receive(sd);

                return(recv as PListDict);
            }
        }
예제 #20
0
        public InterfaceOrientation GetInterfaceOrientation()
        {
            lock (sync)
            {
                PListDict dict = new PListDict();
                dict.Add("command", new PListString("getInterfaceOrientation"));

                PropertyListService.Send(sd, dict);

                var recv = PropertyListService.Receive(sd) as PListDict;

                var v = recv["interfaceOrientation"] as PListInteger;

                return((InterfaceOrientation)v.Value);
            }
        }
예제 #21
0
        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);
        }
예제 #22
0
        private static IPListElement ExportLineGraphic(Omnigraffle.LineGraphic graphic)
        {
            var dict = new PListDict();

            dict.Add("Class", new PListString(graphic.Class));
            dict.Add("ID", new PListInteger(graphic.ID));

            dict.Add("Head", ExportLineEndInfo(graphic.Head));
            dict.Add("Tail", ExportLineEndInfo(graphic.Tail));

            dict.Add("Points", ExportPoints(graphic.Points));

            dict.Add("Style", ExportStyle(graphic.Style));

            return(dict);
        }
예제 #23
0
        private static IPListElement ExportText(Omnigraffle.ShapedGraphic graphic)
        {
            var dict = new PListDict ();

            var alignement = @"\ql";
            if (graphic.Text.Alignement == Omnigraffle.TextAlignement.Center)
                alignement = @"\qc";
            else if (graphic.Text.Alignement == Omnigraffle.TextAlignement.Right)
                alignement = @"\qr";
            else if (graphic.Text.Alignement == Omnigraffle.TextAlignement.Justified)
                alignement = @"\qj";

            dict.Add ("Text", new PListString (string.Format (@"{{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
            {{\fonttbl\f0\fswiss\fcharset0 {1};}}
            {{\colortbl;\red255\green255\blue255;}}
            \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural{3}

            \f0\fs{2} \cf0 {0}}}", graphic.Text.Text, graphic.FontInfo.Font, graphic.FontInfo.Size * 2, alignement)));

            // if (graphic.Text.SideMargin > 0)
                dict.Add ("Pad", new PListInteger (graphic.Text.SideMargin));

            // if (graphic.Text.TopBottomMargin > 0)
                dict.Add ("VerticalPad", new PListInteger (graphic.Text.TopBottomMargin));

            return dict;
        }
예제 #24
0
        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);
        }
예제 #25
0
        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);
        }
예제 #26
0
        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;
        }
예제 #27
0
 static PListDict ExportFont(Omnigraffle.FontInfo font)
 {
     var dict = new PListDict ();
     dict.Add ("Color", ExportColor (font.Color));
     dict.Add ("Font", new PListString (font.Font));
     dict.Add ("NSKern", new PListReal (font.Kerning));
     dict.Add ("Size", new PListReal (font.Size));
     return dict;
 }
예제 #28
0
        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;
        }
예제 #29
0
        static PListDict ExportStyle(Omnigraffle.StyleInfo style)
        {
            var dict = new PListDict ();

            if (style.Fill != default (Omnigraffle.FillInfo)) {
                var fill = new PListDict ();

                if (style.Fill.Color != default (Omnigraffle.Color))
                    fill.Add ("Color", ExportColor (style.Fill.Color));

                dict.Add ("fill", fill);
            }

            if (style.Shadow != default (Omnigraffle.ShadowInfo))
                dict.Add ("shadow", ExportShadow (style.Shadow));

            if (style.Stroke != default (Omnigraffle.StrokeInfo))
                dict.Add ("stroke", ExportStroke (style.Stroke));

            return dict;
        }
예제 #30
0
 private static IPListElement ExportLineEndInfo(Omnigraffle.LineEndInfo @end)
 {
     var dict = new PListDict ();
     dict.Add ("ID", new PListInteger (@end.ID));
     return dict;
 }
예제 #31
0
        static IPListElement ExportStroke(Omnigraffle.StrokeInfo stroke)
        {
            var dict = new PListDict ();

            if (stroke.Draws) {
                dict.Add ("HeadArrow", ExportArrow (stroke.HeadArrow));
                dict.Add ("TailArrow", ExportArrow (stroke.TailArrow));

                dict.Add ("Legacy", new PListBool (stroke.Legacy));

                dict.Add ("Width", new PListReal (stroke.Width));

                dict.Add ("CornerRadius", new PListReal (stroke.CornerRadius));

                if (stroke.Pattern != KAOSTools.OmnigraffleExport.Omnigraffle.StrokePattern.None) {
                    if (stroke.Pattern == KAOSTools.OmnigraffleExport.Omnigraffle.StrokePattern.Dashed) {
                        dict.Add ("Pattern", new PListInteger (1));
                    }
                }

                if (stroke.LineType == KAOSTools.OmnigraffleExport.Omnigraffle.LineType.Straight) {
                    // dict.Add ("LineType", new PListInteger (0));
                } else if (stroke.LineType == KAOSTools.OmnigraffleExport.Omnigraffle.LineType.Curved) {
                    dict.Add ("LineType", new PListInteger (1));
                } else if (stroke.LineType == KAOSTools.OmnigraffleExport.Omnigraffle.LineType.Orthogonal) {
                    dict.Add ("LineType", new PListInteger (2));
                }

            } else {
                dict.Add ("Draws", new PListString (stroke.Draws ? "YES" : "NO"));
            }

            return dict;
        }
예제 #32
0
        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;
        }
예제 #33
0
        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;
        }
예제 #34
0
        private static PListDict ExportShadow(Omnigraffle.ShadowInfo shadowInfo)
        {
            var shadow = new PListDict ();
            shadow.Add ("Draws", new PListString (shadowInfo.Draws ? "YES" : "NO"));

            if (shadowInfo.ShadowVector != null)
                shadow.Add ("ShadowVector", new PListString (string.Format (CultureInfo.InvariantCulture, "{{{0:0.######}, {1:0.######}}}", shadowInfo.ShadowVector.X,  shadowInfo.ShadowVector.Y)));

            return shadow;
        }
예제 #35
0
        private static IPListElement ExportLineGraphic(Omnigraffle.LineGraphic graphic)
        {
            var dict = new PListDict ();

            dict.Add ("Class", new PListString (graphic.Class));
            dict.Add ("ID", new PListInteger (graphic.ID));

            dict.Add ("Head", ExportLineEndInfo (graphic.Head));
            dict.Add ("Tail", ExportLineEndInfo (graphic.Tail));

            dict.Add ("Points", ExportPoints (graphic.Points));

            dict.Add ("Style", ExportStyle (graphic.Style));

            return dict;
        }
예제 #36
0
        private static IPListElement ExportLayer(KAOSTools.OmnigraffleExport.Omnigraffle.Layer layer)
        {
            var layer_dict = new PListDict ();
            layer_dict.Add ("Name", new PListString (layer.Name));
            layer_dict.Add ("Lock", new PListString (layer.Lock ? "YES" : "NO"));
            layer_dict.Add ("View", new PListString (layer.View ? "YES" : "NO"));
            layer_dict.Add ("Print", new PListString (layer.Print ? "YES" : "NO"));

            return layer_dict;
        }
예제 #37
0
        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;
        }