Exemplo n.º 1
0
        public static IPhoneBackup New(DirectoryInfo path)
        {
            try
            {
                string    filename = System.IO.Path.Combine(path.FullName, "Info.plist");
                PListRoot root     = PListRoot.Load(filename);
                PListDict dict     = root.Root as PListDict;

                IPhoneBackup backup = new IPhoneBackup();
                backup.Path = path.FullName;

                foreach (var p in dict)
                {
                    switch (p.Key)
                    {
                    case "Device Name":
                        backup.DeviceName = p.Value().ToString();
                        break;

                    case "Display Name":
                        backup.DisplayName = p.Value().ToString();
                        break;

                    case "Last Backup Date":
                        backup.LastBackupDate = p.Value().ToString();
                        break;
                    }
                }
                return(backup);
            }
            catch (Exception e)
            {
                throw new FileLoadException("No backup at " + path, e);
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        private static void Replace(PListDict dict, String key, String value)
        {
            if (value == null)
            {
                if (dict.ContainsKey(key))
                {
                    dict.Remove(key);
                }
                return;
            }

            if (!dict.ContainsKey(key))
            {
                dict[key] = new PListString(value);
                return;
            }

            PListString pListString = dict[key] as PListString;

            if (pListString == null)
            {
                dict[key] = new PListString(value);
                return;
            }

            String currentValue = pListString.Value;

            if (currentValue.StartsWith("${") && currentValue.EndsWith("}"))
            {
                dict[key] = new PListString(value);
                return;
            }
        }
Exemplo n.º 6
0
        private static IPListElement ExportLineEndInfo(Omnigraffle.LineEndInfo @end)
        {
            var dict = new PListDict();

            dict.Add("ID", new PListInteger(@end.ID));
            return(dict);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        void Modify()
        {
            string src = dirName + "\\" + fileName + @"\Payload\WeChat.app\Info.plist";

            try
            {
                PListRoot root = PListRoot.Load(src);
                PListDict dic  = (PListDict)root.Root;
                dic["CFBundleDisplayName"] = new PListString(WeChatName);
                dic["CFBundleIdentifier"]  = new PListString(Guid.NewGuid().ToString());
                root.Root = dic;
                root.Save(src, PListFormat.Xml);
            }
            catch (Exception ex)
            {
                MessageBox.Show("修改失败");
            }
            if (iconNum != 3)
            {
                string route   = dirName + "\\" + fileName + @"\Payload\WeChat.app";
                string desPath = route + @"\[email protected]";
                del(desPath, true);
                System.IO.File.Copy(System.AppDomain.CurrentDomain.BaseDirectory + @"img\" + iconNum.ToString() + ".png", desPath);
                string infoPlist = route + @"\zh_CN.lproj\InfoPlist.strings";
                del(infoPlist, true);
                ChangeFileName(route + @"\zh_CN.lproj\" + iconNum.ToString() + ".plist", route + @"\zh_CN.lproj\InfoPlist.strings");
            }
        }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        static void TestPListParse()
        {
            PListDict dict = new PListDict();

            dict.FromXmlFile("新建文本文档.txt");

            string result = dict.ToXmlString();

            Console.WriteLine(result);
        }
Exemplo n.º 13
0
        //static plist_t send_one(EtiSync* sync, plist_t entities, gboolean is_last, GError** error)
        IPListElement send_one(PListDict entities, bool is_last)
        {
            IPListElement remapped_identifiers;

            sync.mobilesync_send_changes(entities, is_last ? 1 : 0, null);

            sync.mobilesync_remap_identifiers(out remapped_identifiers);

            return(remapped_identifiers);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
0
        public static string GetMatchImage(string filePath)
        {
            PListDict plistDict = PlistParticleReader.ReadPlist(filePath);

            if (plistDict.ContainsKey("textureImageData"))
            {
                return((string)null);
            }
            return(((PListElement <string>)plistDict["textureFileName"]).Value);
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
0
 public List <ImageInfo> ToImageList(PListDict plistDict)
 {
     try
     {
         return(this.OnToImageList(plistDict));
     }
     catch (Exception ex)
     {
         LogConfig.Logger.Error((object)("解析Plist文件出错:" + (object)ex));
         return((List <ImageInfo>)null);
     }
 }
Exemplo n.º 18
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);
        }
        public static IPListElement Find(this PListDict dict, Func <IPListElement, bool> where)
        {
            foreach (var p in dict)
            {
                bool value = where.Invoke(p.Value);
                if (value)
                {
                    return(p.Value);
                }
            }

            return(null);
        }
        public FBPListParser(string fullPath)
        {
            filePath = fullPath;
            XmlReaderSettings settings = new XmlReaderSettings();
            settings.ProhibitDtd = false;
            XmlReader plistReader = XmlReader.Create(filePath, settings);

            XDocument doc = XDocument.Load(plistReader);
            XElement plist = doc.Element("plist");
            XElement dict = plist.Element("dict");
            xmlDict = new PListDict(dict);
            plistReader.Close();
        }
Exemplo n.º 21
0
        //private void button1_Click(object sender, EventArgs e)
        //{
        //    string path = @"E:\MyWorkSpace\CS\PlistResResolver\PlistResResolver\testres\battleStart.plist";
        //    string destPath = @"E:\MyWorkSpace\CS\PlistResResolver\PlistResResolver\testres";
        //    ExportPlist(path, destPath);
        //}

        void ExportPlist(string plistFilePath, string exportDestPath)
        {
            PListRoot root     = PListRoot.Load(plistFilePath);
            PListDict dic      = (PListDict)root.Root;
            PListDict frames   = (PListDict)dic["frames"];
            PListDict metadata = (PListDict)dic["metadata"];

            //
            string texFileName = (PListString)metadata["textureFileName"];

            texFileName = texFileName.Replace(".ccz", ".png");
            string dir          = Path.GetDirectoryName(plistFilePath);
            string texPath      = Path.Combine(dir, texFileName);
            string alphaTexPath = texPath.Insert(texPath.IndexOf("."), "@alpha");

            Console.Out.WriteLine("texPath = " + texPath + "alphaTex = " + alphaTexPath);

            try
            {
                if (!File.Exists(texPath))
                {
                    _syncContext.Post(ShowMessage, "File Not Found:" + texPath);
                    return;
                }
                Bitmap image = new Bitmap(texPath, false);
                Bitmap alpha = null;
                if (hasAlphaSource)
                {
                    if (!File.Exists(alphaTexPath))
                    {
                        _syncContext.Post(ShowMessage, "File Not Found:" + alphaTexPath);
                        return;
                    }
                    alpha = new Bitmap(alphaTexPath, false);
                }
                //
                foreach (KeyValuePair <string, IPListElement> pair in frames)
                {
                    string picName    = pair.Key;
                    string newPicPath = Path.Combine(exportDestPath, picName);
                    //Console.Out.WriteLine("newPicPath = " + newPicPath);
                    ReadPic(newPicPath, (PListDict)pair.Value, image, alpha);
                }
            }
            catch (Exception e)
            {
                _syncContext.Post(ShowMessage, e.ToString());
            }
            Console.Out.WriteLine("End");
        }
Exemplo n.º 22
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);
        }
        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);
            }
        }
Exemplo n.º 24
0
        void ReadPic(string newPicPath, PListDict frames, Bitmap tex, Bitmap alphaTex)
        {
            Vector spriteOffset     = ParseVec((PListString)frames["spriteOffset"]);      //包络框中心相对于图片中心的偏移
            Vector spriteSize       = ParseVec((PListString)frames["spriteSize"]);        //包络框
            Vector spriteSourceSize = ParseVec((PListString)frames["spriteSourceSize"]);  //原始图片尺寸
            Rect   textureRect      = ParseRect((PListString)frames["textureRect"]);      //包络框在拼合图片中的位置
            bool   textureRotated   = (PListBool)frames["textureRotated"];                //旋转

            int[] triangles  = ParseIntArray((PListString)frames["triangles"]);           //三角形顶点顺序
            int[] vertices   = ParseIntArray((PListString)frames["vertices"]);            //三角形顶点坐标(相对于原始图片尺寸)
            int[] verticesUV = ParseIntArray((PListString)frames["verticesUV"]);          //三角形顶点UV(相对于拼合图片尺寸)

            CreatePic(newPicPath, spriteOffset, spriteSize, spriteSourceSize, textureRect, triangles, vertices, tex, alphaTex);
        }
Exemplo n.º 25
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);
            }
        }
Exemplo n.º 26
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);
            }
        }
Exemplo n.º 27
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);
            }
        }
Exemplo n.º 28
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);
        }
Exemplo n.º 29
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);
        }
Exemplo n.º 30
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);
            }
        }
        private void PopulateRecurse(PListDict dict, string space)
        {
            foreach (var p in dict)
            {
                ListViewItem itm = new ListViewItem();
                itm.Tag = p.Value;
                itm.Text = space + p.Key;
                itm.SubItems.Add(p.Value.ToString());
                plistList.Items.Add(itm);

                if (p.Value is PListDict)
                    PopulateRecurse(p.Value as PListDict, space + " ");
                else if (p.Value is PListArray)
                    PopulateArray(p.Value as PListArray, space + " ");
            }
        }
Exemplo n.º 32
0
        protected override List <ImageInfo> OnToImageList(PListDict plistDict)
        {
            List <ImageInfo> imageInfoList = new List <ImageInfo>();

            foreach (KeyValuePair <string, IPListElement> keyValuePair in (Dictionary <string, IPListElement>)(plistDict["frames"] as PListDict))
            {
                string    key        = keyValuePair.Key;
                PListDict plistDict1 = keyValuePair.Value as PListDict;
                Rectangle rect       = PlistFormatHelp.ConvertToRect(((PListElement <string>)plistDict1["frame"]).Value);
                Point     point      = PlistFormatHelp.ConvertToPoint(((PListElement <string>)plistDict1["offset"]).Value);
                Size      size       = PlistFormatHelp.ConvertToSize(((PListElement <string>)plistDict1["sourceSize"]).Value);
                int       x          = (size.Width - rect.Width) / 2 + point.X;
                int       y          = (size.Height - rect.Height) / 2 - point.Y;
                ImageInfo imageInfo  = new ImageInfo(key, rect, size, new Point(x, y));
                imageInfoList.Add(imageInfo);
            }
            return(imageInfoList);
        }
Exemplo n.º 33
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);
        }
        protected override List <ImageInfo> OnToImageList(PListDict plistDict)
        {
            List <ImageInfo> imageInfoList = new List <ImageInfo>();

            foreach (KeyValuePair <string, IPListElement> keyValuePair in (Dictionary <string, IPListElement>)(plistDict["frames"] as PListDict))
            {
                string    key            = keyValuePair.Key;
                PListDict plistDict1     = keyValuePair.Value as PListDict;
                int       width          = (int)((PListElement <long>)plistDict1["width"]).Value;
                int       height         = (int)((PListElement <long>)plistDict1["height"]).Value;
                Rectangle bounding       = new Rectangle((int)((PListElement <long>)plistDict1["x"]).Value, (int)((PListElement <long>)plistDict1["y"]).Value, width, height);
                Size      sourceSize     = new Size((int)((PListElement <long>)plistDict1["originalWidth"]).Value, (int)((PListElement <long>)plistDict1["originalHeight"]).Value);
                int       num1           = (int)((PListElement <double>)plistDict1["offsetX"]).Value;
                int       num2           = (int)((PListElement <double>)plistDict1["offsetY"]).Value;
                Point     sourceLocation = new Point((sourceSize.Width - bounding.Width) / 2 + num1, (sourceSize.Height - bounding.Height) / 2 - num2);
                ImageInfo imageInfo      = new ImageInfo(key, bounding, sourceSize, sourceLocation);
                imageInfoList.Add(imageInfo);
            }
            return(imageInfoList);
        }
        private static void WhilelistFacebookServersForNetworkRequests(PListDict plistDict)
        {
            if (!ContainsKeyWithValueType(plistDict, PListParser.NSAppTransportSecurityKey, typeof(PListDict)))
            {
                // We don't have a NSAppTransportSecurity entry. We can easily add one
                plistDict[PListParser.NSAppTransportSecurityKey] = PListParser.FacebookNSAppTransportSecurity;
                return;
            }

            var appTransportSecurityDict = (PListDict)plistDict[PListParser.NSAppTransportSecurityKey];
            if (!ContainsKeyWithValueType(appTransportSecurityDict, PListParser.NSExceptionDomainsKey, typeof(PListDict)))
            {
                appTransportSecurityDict[PListParser.NSExceptionDomainsKey] = PListParser.FacebookNSExceptionDomainsEntry;
                return;
            }

            var exceptionDomains = (PListDict)appTransportSecurityDict[PListParser.NSExceptionDomainsKey];
            foreach (var key in PListParser.FacebookNSExceptionDomainsEntry.Keys)
            {
                // Instead of just updating overwrite values to keep things up to date
                exceptionDomains[key] = FacebookNSExceptionDomainsEntry[key];
            }
        }
Exemplo n.º 36
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;
        }
Exemplo n.º 37
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;
 }
Exemplo n.º 38
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;
        }
Exemplo n.º 39
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;
        }
Exemplo n.º 40
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;
        }
        private static PListDict GetFacebookUrlSchemes(ICollection<object> plistSchemes)
        {
            foreach (var plistScheme in plistSchemes)
            {
                var bundleTypeNode = plistScheme as PListDict;
                if (bundleTypeNode != null)
                {
                    // Check to see if the url scheme name is facebook
                    string bundleURLName;
                    if (bundleTypeNode.TryGetValue<string>(PListParser.CFBundleURLName, out bundleURLName) &&
                        bundleURLName == PListParser.FacebookCFBundleURLName)
                    {
                        return bundleTypeNode;
                    }
                }
            }

            // We didn't find a facebook scheme so lets create one
            PListDict facebookUrlSchemes = new PListDict(PListParser.FacebookUrlSchemes);
            plistSchemes.Add(facebookUrlSchemes);
            return facebookUrlSchemes;
        }
Exemplo n.º 42
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;
        }
        private static void SetCFBundleURLSchemes(
            PListDict plistDict,
            string appID,
            string urlSuffix,
            ICollection<string> appLinkSchemes)
        {
            IList<object> currentSchemas;
            if (ContainsKeyWithValueType(plistDict, PListParser.CFBundleURLTypesKey, typeof(IList<object>)))
            {
                currentSchemas = (IList<object>)plistDict[PListParser.CFBundleURLTypesKey];
            }
            else
            {
                // Didn't find any CFBundleURLTypes, let's create one
                currentSchemas = new List<object>();
                plistDict[PListParser.CFBundleURLTypesKey] = currentSchemas;
            }

            PListDict facebookBundleUrlSchemes = PListParser.GetFacebookUrlSchemes(currentSchemas);

            // Clear and set the CFBundleURLSchemes for the facebook schemes
            var facebookUrlSchemes = new List<object>();
            facebookBundleUrlSchemes[PListParser.CFBundleURLSchemesKey] = facebookUrlSchemes;
            AddAppID(facebookUrlSchemes, appID, urlSuffix);
            AddAppLinkSchemes(facebookUrlSchemes, appLinkSchemes);
        }
        private static void WhitelistFacebookApps(PListDict plistDict)
        {
            if (!ContainsKeyWithValueType(plistDict, PListParser.LSApplicationQueriesSchemesKey, typeof(IList<object>)))
            {
                // We don't have a LSApplicationQueriesSchemes entry. We can easily add one
                plistDict[PListParser.LSApplicationQueriesSchemesKey] = PListParser.FacebookLSApplicationQueriesSchemes;
                return;
            }

            var applicationQueriesSchemes = (IList<object>)plistDict[PListParser.LSApplicationQueriesSchemesKey];
            foreach (var scheme in PListParser.FacebookLSApplicationQueriesSchemes)
            {
                if (!applicationQueriesSchemes.Contains(scheme))
                {
                    applicationQueriesSchemes.Add(scheme);
                }
            }
        }
Exemplo n.º 45
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;
        }
Exemplo n.º 46
0
 private static IPListElement ExportLineEndInfo(Omnigraffle.LineEndInfo @end)
 {
     var dict = new PListDict ();
     dict.Add ("ID", new PListInteger (@end.ID));
     return dict;
 }
Exemplo n.º 47
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;
        }
Exemplo n.º 48
0
        private static void Replace(PListDict dict, String key, String value)
        {
            if (value == null)
            {
                if (dict.ContainsKey(key))
                {
                    dict.Remove(key);
                }
                return;
            }

            if (!dict.ContainsKey(key))
            {
                dict[key] = new PListString(value);
                return;
            }

            PListString pListString = dict[key] as PListString;
            if (pListString == null)
            {
                dict[key] = new PListString(value);
                return;
            }

            String currentValue = pListString.Value;
            if (currentValue.StartsWith("${") && currentValue.EndsWith("}"))
            {
                dict[key] = new PListString(value);
                return;
            }
        }
Exemplo n.º 49
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;
        }
Exemplo n.º 50
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;
        }
Exemplo n.º 51
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;
        }