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); } } }
// grabs the contents of the plist and sets them in the ivar public void getPlistContents() { // initialize the hashtable and plistKeys plistContents = new Hashtable(); // get the contents of the plist file if it exists filePath = Path.Combine(Application.dataPath, "Editor/Prime31/" + plistFileName); if (File.Exists(filePath)) { PListEditor.loadPlistFromFile(filePath, plistContents); // set any keys that we have present var t = typeof(Prime31PlistHelperWizard); foreach (var info in t.GetFields()) { if (plistContents.ContainsKey(info.Name)) { // special case for orientations if (info.Name == "UISupportedInterfaceOrientations") { var list = new List <UIInterfaceOrientationEnum>(); var values = plistContents[info.Name]; // parse out the strings to enums foreach (var orientation in (ArrayList)values) { var fixedOrient = (UIInterfaceOrientationEnum)Enum.Parse(typeof(UIInterfaceOrientationEnum), orientation.ToString()); list.Add(fixedOrient); } // set the list to the ivar UISupportedInterfaceOrientations = list.ToArray(); } else { info.SetValue(this, plistContents[info.Name]); } } else if (plistContents.ContainsKey("CFBundleURLTypes")) // special case for url schemes { var values = (ArrayList)plistContents["CFBundleURLTypes"]; var ht = values[0] as Hashtable; var listOfSchemes = ht["CFBundleURLSchemes"] as ArrayList; var extractedSchemes = new List <string>(); foreach (string scheme in listOfSchemes) { extractedSchemes.Add(scheme); } CFBundleURLSchemes = extractedSchemes.ToArray(); } } } }