Exemplo n.º 1
0
        void UpgradeSettingsFile(string fileName)
        {
            var plist = new PList();

            if (!plist.Load(fileName))
            {
                return;
            }

            if (plist.Root.StringValue("Type") != "EgoXproject Settings")
            {
                return;
            }

            if (plist.Root.IntValue("Version") != 1 && plist.Root.IntValue("Version") != 2)
            {
                return;
            }

            var dirName        = Path.GetDirectoryName(fileName);
            var configurations = new XcodeConfigurations(dirName);
            var platformConfig = configurations.Configuration(BuildPlatform.iOS);
            var configs        = plist.Root.DictionaryValue("Configurations");

            if (configs != null)
            {
                foreach (var kvp in configs)
                {
                    var entries = kvp.Value as PListArray;

                    if (entries == null || entries.Count <= 0)
                    {
                        platformConfig.AddConfiguration(kvp.Key);
                        continue;
                    }

                    for (int ii = 0; ii < entries.Count; ++ii)
                    {
                        platformConfig.AddChangeFileToConfiguration(entries.StringValue(ii), kvp.Key);
                    }
                }
            }

            var active = plist.Root.StringValue("ActiveConfiguration");

            if (!string.IsNullOrEmpty(active))
            {
                platformConfig.ActiveConfiguration = active;
            }

            configurations.Save();
            plist.Root.Remove("Configurations");
            plist.Root.Remove("ActiveConfiguration");
            plist.Save();
            string oldPath = ProjectUtil.MakePathRelativeToProject(plist.SavePath);
            string newPath = ProjectUtil.MakePathRelativeToProject(Path.Combine(Path.GetDirectoryName(oldPath), "egoxproject.settings"));

            AssetDatabase.MoveAsset(oldPath, newPath);
        }
Exemplo n.º 2
0
        XcodeController()
        {
            var upgrader = new Upgrader();

            upgrader.Upgrade();
            _lastSaveDirectory = DllUtils.DllLocation();
            _settings          = new XcodeSettings(_lastSaveDirectory);
            _configurations    = new XcodeConfigurations(_lastSaveDirectory);
            FindChangeFiles();
            RefreshConfigurations();
        }