savePlistToFile() public static method

public static savePlistToFile ( string xmlFile, Hashtable, plist ) : bool
xmlFile string
plist Hashtable,
return bool
Example #1
0
    public static void enablePromptAfterInstall(bool enable)
    {
        // find all the config.plist files in plugin directories
        string basePath = Path.Combine(Application.dataPath, "Editor");
        var    dirInfo  = new DirectoryInfo(basePath);

        var pluginDirs = from dir in dirInfo.GetDirectories()
                         let files = dir.GetFiles("config.plist")
                                     where files.Length == 1
                                     select files[0];

        // loop through our pluginDirs
        foreach (var dir in pluginDirs)
        {
            if (!File.Exists(dir.FullName))
            {
                continue;
            }

            // initialize the hashtable and plistKeys
            Hashtable plistContents = new Hashtable();

            PListEditor.loadPlistFromFile(dir.FullName, plistContents);

            if (plistContents.ContainsKey("neverShowCompletedMessage"))
            {
                plistContents["neverShowCompletedMessage"] = !enable;
                PListEditor.savePlistToFile(dir.FullName, plistContents);
            }
        }
    }
Example #2
0
    // Called when the 'save changes' button is pressed
    void OnWizardCreate()
    {
        // fill out the hashtable with the new values
        var ht = new Hashtable();

        // add an entry with all the key names
        var plistKeys = getAllPublicIvarNames();

        ht["plistKeys"] = plistKeys;

        ht["UIApplicationExitsOnSuspend"] = this.UIApplicationExitsOnSuspend;

        if (MinimumOSVersion != string.Empty)
        {
            ht["MinimumOSVersion"] = MinimumOSVersion;
        }

        ht["UIFileSharingEnabled"] = this.UIFileSharingEnabled;

        if (UISupportedInterfaceOrientations != null && UISupportedInterfaceOrientations.Length > 0)
        {
            var list = new ArrayList();

            // grab all the orientations as strings
            foreach (var orientation in UISupportedInterfaceOrientations)
            {
                list.Add(orientation.ToString());
            }

            ht["UISupportedInterfaceOrientations"] = list;
        }

        if (CFBundleURLSchemes != null && CFBundleURLSchemes.Length > 0)
        {
            var scheme = new Hashtable();
            scheme["CFBundleURLName"]    = string.Empty;
            scheme["CFBundleURLSchemes"] = new ArrayList(CFBundleURLSchemes);

            var urlTypes = new ArrayList();
            urlTypes.Add(scheme);
            ht["CFBundleURLTypes"] = urlTypes;
        }

        PListEditor.savePlistToFile(filePath, ht);
    }