Пример #1
0
        protected override void Process(BuildTarget buildTarget, string buildPath)
        {
            string entitlementPath = buildPath + entitlementsPath; //Path.Combine(buildPath, entitlementsPath);

            PlistDocument entitlements = new PlistDocument();

            if (File.Exists(entitlementPath))
            {
                entitlements.ReadFromFile(entitlementPath);
            }
            else
            {
                entitlements.Create();
            }

            PlistElementArray elementArray = new PlistElementArray();

            entitlements.root["com.apple.security.application-groups"] = elementArray;
            foreach (string appGroup in appGroups)
            {
                elementArray.values.Add(new PlistElementString(appGroup));
            }

            entitlements.WriteToFile(entitlementPath);
        }
Пример #2
0
        public void CanWriteRealKey()
        {
            var doc = new PlistDocument();

            doc.Create();
            doc.root.SetReal("test", 12.1234f);
            string expected = GetPlistDataFromContents(
                @"  <dict>
    <key>test</key>
    <real>12.1234</real>
  </dict>");

            Assert.AreEqual(expected, doc.WriteToString());
        }
Пример #3
0
        public void CanWriteDateKey()
        {
            var doc = new PlistDocument();

            doc.Create();
            doc.root.SetDate("test", new System.DateTime(2009, 1, 2, 10, 11, 12, System.DateTimeKind.Utc));
            string expected = GetPlistDataFromContents(
                @"  <dict>
    <key>test</key>
    <date>2009-01-02T10:11:12Z</date>
  </dict>");

            Assert.AreEqual(expected, doc.WriteToString());
        }
Пример #4
0
        private PlistDocument GetOrCreateEntitlementDoc()
        {
            if (m_Entitlements == null)
            {
                m_Entitlements = new PlistDocument();
                if (File.Exists(PBXPath.Combine(m_BuildPath, m_EntitlementFilePath)))
                {
                    m_Entitlements.ReadFromFile(PBXPath.Combine(m_BuildPath, m_EntitlementFilePath));
                }
                else
                {
                    m_Entitlements.Create();
                }
            }

            return(m_Entitlements);
        }
Пример #5
0
        private PlistDocument GetOrCreateInfoDoc()
        {
            if (m_InfoPlist == null)
            {
                m_InfoPlist = new PlistDocument();
                string[] infoFiles = Directory.GetFiles(m_BuildPath + "/", "Info.plist");
                if (infoFiles.Length > 0)
                {
                    m_InfoPlist.ReadFromFile(infoFiles[0]);
                }
                else
                {
                    m_InfoPlist.Create();
                }
            }

            return(m_InfoPlist);
        }
Пример #6
0
        private PlistDocument GetOrCreateEntitlementDoc()
        {
            if (m_Entitlements == null)
            {
                m_Entitlements = new PlistDocument();
                string[] entitlementsFiles = Directory.GetFiles(m_BuildPath, m_EntitlementFilePath);
                if (entitlementsFiles.Length > 0)
                {
                    m_Entitlements.ReadFromFile(entitlementsFiles[0]);
                }
                else
                {
                    m_Entitlements.Create();
                }
            }

            return(m_Entitlements);
        }
Пример #7
0
    public static void CreatePlist(TextureInfo[] texturesInfo, Rect[] rects, string plistOutPath)
    {
        var plist = new PlistDocument();

        plist.Create();
        PlistElementDict  rootDict   = plist.root;
        PlistElementArray plistArray = rootDict.CreateArray("texturesInfo");

        for (int i = 0; i < texturesInfo.Length; i++)
        {
            PlistElementDict dict = plistArray.AddDict();
            dict.SetString("name", texturesInfo[i].name);
            dict.SetInteger("x", (int)texturesInfo[i].x);
            dict.SetInteger("y", (int)texturesInfo[i].y);
            dict.SetInteger("width", (int)texturesInfo[i].width);
            dict.SetInteger("height", (int)texturesInfo[i].height);
        }
        File.WriteAllText(plistOutPath, plist.WriteToString());
        AssetDatabase.Refresh();
    }