Exemplo n.º 1
0
        //ignores invalid values
        public static Orientation Parse(PlistArray arr)
        {
            var o = Orientation.None;

            if (arr == null)
            {
                return(o);
            }
            foreach (PlistString s in arr)
            {
                switch (s.Value)
                {
                case "UIInterfaceOrientationPortrait":
                    o |= Orientation.Up;
                    break;

                case "UIInterfaceOrientationPortraitUpsideDown":
                    o |= Orientation.Down;
                    break;

                case "UIInterfaceOrientationLandscapeLeft":
                    o |= Orientation.Left;
                    break;

                case "UIInterfaceOrientationLandscapeRight":
                    o |= Orientation.Right;
                    break;
                }
            }
            return(o);
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            // CreateDirectory(...) sometimes fails unless we wait (race condition?)
            if (Directory.Exists(keyDir))
            {
                Directory.Delete(keyDir, true);
            }
            Thread.Sleep(100);
            Directory.CreateDirectory(keyDir);

#if !DEBUG
            makeBinaryPlists = true;
#endif

            if (makeBinaryPlists)
            {
                if (!File.Exists(plutil))
                {
                    makeBinaryPlists = false;
                    Console.WriteLine("WARNING: plutil not found! Binary plists will NOT be generated.");
                }
            }

            // TODO: Parse the key page using XPath (action=render) [id tags]
            EnumerateFirmwareListAndSaveKeys("Firmware/Apple_TV");
            //EnumerateFirmwareListAndSaveKeys("Firmware/Apple_Watch");
            EnumerateFirmwareListAndSaveKeys("Firmware/iPad");
            EnumerateFirmwareListAndSaveKeys("Firmware/iPad_mini");
            EnumerateFirmwareListAndSaveKeys("Firmware/iPhone");
            EnumerateFirmwareListAndSaveKeys("Firmware/iPod_touch");

            // Build version listing
            PlistDict plistRoot = new PlistDict();
            foreach (var deviceList in versionsList)
            {
                List <FirmwareVersion> versions  = deviceList.Value;
                PlistArray             deviceArr = new PlistArray(new IPlistElement[versions.Count]);
                for (int i = 0; i < versions.Count; i++)
                {
                    FirmwareVersion ver         = versions[i];
                    PlistDict       versionDict = new PlistDict();
                    versionDict.Add("Build", new PlistString(ver.Build));
                    versionDict.Add("Version", new PlistString(ver.Version));
                    versionDict.Add("Has Keys", new PlistBool(ver.HasKeys));
                    deviceArr.Set(i, versionDict);
                }
                plistRoot.Add(deviceList.Key, deviceArr);
            }

            // Save version listing
            PlistDocument versionDoc  = new PlistDocument(plistRoot);
            string        keyListPath = Path.Combine(keyDir, "KeyList.plist");
            versionDoc.Save(keyListPath, PlistDocumentType.Xml);
            ConvertPlist(keyListPath);
        }
        public static void loadChildrenForNode(CCNode prntNode, PlistDictionary dict)
        {
            PlistArray childrenInfo = dict["children"].AsArray;

            if (null != childrenInfo)
            {
                foreach (PlistDictionary childInfo in childrenInfo)
                {
                    /*CCNode node =*/ LHNodeProtocolImp.createLHNodeWithDictionary(childInfo, prntNode);
                }
            }
        }
        public void createShapeWithDictionary(PlistDictionary dict, PlistArray shapePoints, b2Body body, CCNode node, LHScene scene, CCPoint scale)
        {
            _shapeID   = dict ["shapeID"].AsInt;
            _shapeName = dict ["name"].AsString;

            int flipx = scale.X < 0 ? -1 : 1;
            int flipy = scale.Y < 0 ? -1 : 1;


            for (int f = 0; f < shapePoints.Count; ++f)
            {
                PlistArray fixPoints = shapePoints [f].AsArray;
                int        count     = fixPoints.Count;
                if (count > 2)
                {
                    b2Vec2[]       verts    = new b2Vec2[count];
                    b2PolygonShape shapeDef = new b2PolygonShape();

                    int i = 0;
                    for (int j = count - 1; j >= 0; --j)
                    {
                        int idx = (flipx < 0 && flipy >= 0) || (flipx >= 0 && flipy < 0) ? count - i - 1 : i;

                        String  pointStr = fixPoints [j].AsString;
                        CCPoint point    = CCPoint.Parse(pointStr);

                        point.X *= scale.X;
                        point.Y *= scale.Y;

                        point.Y = -point.Y;

                        b2Vec2 vec = new b2Vec2(point.X, point.Y);

                        verts[idx] = vec;
                        ++i;
                    }

                    if (LHValidateCentroid(verts, count))
                    {
                        shapeDef.Set(verts, count);

                        b2FixtureDef fixture = new b2FixtureDef();

                        LHSetupb2FixtureWithInfo(fixture, dict);

                        fixture.userData = this;
                        fixture.shape    = shapeDef;
                        body.CreateFixture(fixture);
                    }
                }
            }
        }
Exemplo n.º 5
0
		public static PlistArray ToPlist (Orientation o)
		{
			var arr = new PlistArray ();
			if ((o & Orientation.Up) != 0)
				arr.Add ("UIInterfaceOrientationPortrait");
			if ((o & Orientation.Down) != 0)
				arr.Add ("UIInterfaceOrientationPortraitUpsideDown");
			if ((o & Orientation.Left) != 0)
				arr.Add ("UIInterfaceOrientationLandscapeLeft");
			if ((o & Orientation.Right) != 0)
				arr.Add ("UIInterfaceOrientationLandscapeRight");
			return arr.Count == 0? null : arr;
		}
 private static void InitDevice(ref List <ComboBoxEntry> device, PlistArray versionArr)
 {
     device = new List <ComboBoxEntry>();
     foreach (IPlistElement elem in versionArr.Value)
     {
         PlistDict dict    = (PlistDict)elem;
         string    build   = dict.Get <PlistString>("Build").Value;
         string    version = dict.Get <PlistString>("Version").Value;
         //bool hasKeys = dict.Get<PlistBool>("Has Keys").Value;
         device.Add(new ComboBoxEntry(
                        build,
                        $"{version} ({build})"));
     }
 }
        //--------------------------------------------------------------------------------------------------------------
        public static LHScene createWithContentOfFile(string plistLevelFile, CCWindow mainWindow, CCApplication application)
        {
            PlistDictionary dict = CCContentManager.SharedContentManager.Load <PlistDocument> (plistLevelFile).Root.AsDictionary;

            if (null == dict)
            {
                Debug.WriteLine("\nERROR: Could not load level file %s. The file does not appear to exist.\n", plistLevelFile);
                return(null);
            }

            var aspect = dict ["aspect"].AsInt;

            if (aspect == 0)           //exact fit
            {
                CCSize winSize = CCSize.Parse(dict ["designResolution"].AsString);
                CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ExactFit);
            }
            else if (aspect == 1)           //no borders
            {
                CCSize winSize = CCSize.Parse(dict ["designResolution"].AsString);
                CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.NoBorder);
            }
            else if (aspect == 2)           //show all
            {
                CCSize winSize = mainWindow.WindowSizeInPixels;
                CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ShowAll);
            }

            PlistArray devsInfo = dict["devices"].AsArray;

            if (null == devsInfo)
            {
                Debug.WriteLine("\nERROR: Level doesn't contain valid devices.\n");
                return(null);
            }

            foreach (PlistDictionary devInf in devsInfo)
            {
                string suffix = dict ["suffix"].AsString;
                application.ContentSearchPaths.Add(suffix);
            }

            application.ContentSearchPaths.Add("hd");
            application.ContentSearchPaths.Add("568");

            return(new LHScene(dict, plistLevelFile, mainWindow));
        }
Exemplo n.º 8
0
        public static PlistArray ToPlist(Orientation o)
        {
            var arr = new PlistArray();

            if ((o & Orientation.Up) != 0)
            {
                arr.Add("UIInterfaceOrientationPortrait");
            }
            if ((o & Orientation.Down) != 0)
            {
                arr.Add("UIInterfaceOrientationPortraitUpsideDown");
            }
            if ((o & Orientation.Left) != 0)
            {
                arr.Add("UIInterfaceOrientationLandscapeLeft");
            }
            if ((o & Orientation.Right) != 0)
            {
                arr.Add("UIInterfaceOrientationLandscapeRight");
            }
            return(arr.Count == 0? null : arr);
        }
Exemplo n.º 9
0
		//ignores invalid values
		public static Orientation Parse (PlistArray arr)
		{
			var o = Orientation.None;
			if (arr == null)
				return o;
			foreach (PlistString s in arr) {
				switch (s.Value) {
				case "UIInterfaceOrientationPortrait":
					o |= Orientation.Up;
					break;
				case "UIInterfaceOrientationPortraitUpsideDown":
					o |= Orientation.Down;
					break;
				case "UIInterfaceOrientationLandscapeLeft":
					o |= Orientation.Left;
					break;
				case "UIInterfaceOrientationLandscapeRight":
					o |= Orientation.Right;
					break;
				}
			}
			return o;
		}
Exemplo n.º 10
0
        static void LoadOrientationsCombo(ComboBox combo, PlistArray values)
        {
            var store = (ListStore)combo.Model;

            store.Clear();
            store.AppendValues(GettextCatalog.GetString("Both"), Orientation.Both);
            store.AppendValues(GettextCatalog.GetString("Portrait"), Orientation.Portrait);
            store.AppendValues(GettextCatalog.GetString("Landscape"), Orientation.Landscape);
            store.AppendValues(GettextCatalog.GetString("Not specified"), Orientation.None);

            var o = OrientationUtil.Parse(values);

            switch (o)
            {
            case Orientation.Both:
                combo.Active = 0;
                break;

            case Orientation.Portrait:
                combo.Active = 1;
                break;

            case Orientation.Landscape:
                combo.Active = 2;
                break;

            case Orientation.None:
                combo.Active = 3;
                break;

            default:
                store.AppendValues(GettextCatalog.GetString("Custom"), o);
                combo.Active = 4;
                break;
            }
        }
Exemplo n.º 11
0
		static bool AddIconRelativeIfNotEmpty (IPhoneProject proj, PlistArray arr, FilePath iconFullPath, string name)
		{
			var icon = iconFullPath.ToRelative (proj.BaseDirectory).ToString ();
			if (string.IsNullOrEmpty (icon) || icon == ".")
				return false;
			arr.Add (null ?? icon);
			return true;
		}
Exemplo n.º 12
0
		static bool AddIconRelativeIfNotEmpty (IPhoneProject proj, PlistArray arr, FilePath iconFullPath)
		{
			return AddIconRelativeIfNotEmpty (proj, arr, iconFullPath, null);
		}
Exemplo n.º 13
0
		BuildResult UpdateInfoPlist (IProgressMonitor monitor, IPhoneSdkVersion sdkVersion, IPhoneProject proj,
			IPhoneProjectConfiguration conf, IPhoneAppIdentity identity, ProjectFile template, string plistOut)
		{
			return MacBuildUtilities.CreateMergedPlist (monitor, template, plistOut, (PlistDocument doc) => {
				var result = new BuildResult ();
				var dict = doc.Root as PlistDictionary;
				if (dict == null)
					doc.Root = dict = new PlistDictionary ();
				
				bool sim = conf.Platform != IPhoneProject.PLAT_IPHONE;
				bool v3_2_orNewer = sdkVersion >= IPhoneSdkVersion.V3_2;
				bool v3_1_orNewer = sdkVersion >= IPhoneSdkVersion.V3_1;
				bool v4_0_orNewer = sdkVersion >= IPhoneSdkVersion.V4_0;
				bool supportsIPhone = (proj.SupportedDevices & TargetDevice.IPhone) != 0;
				bool supportsIPad = (proj.SupportedDevices & TargetDevice.IPad) != 0;
				
				var sdkSettings = IPhoneFramework.GetSdkSettings (sdkVersion);
				var dtSettings = IPhoneFramework.GetDTSettings ();
				
				SetIfNotPresent (dict, "BuildMachineOSBuild", dtSettings.BuildMachineOSBuild);
				
				SetIfNotPresent (dict, "CFBundleDevelopmentRegion",
					String.IsNullOrEmpty (proj.BundleDevelopmentRegion)? "en" : proj.BundleDevelopmentRegion);
				
				SetIfNotPresent (dict, "CFBundleDisplayName", proj.BundleDisplayName ?? proj.Name);
				SetIfNotPresent (dict, "CFBundleExecutable", conf.NativeExe.FileName);
				
				// < 3.2 icon
				if (supportsIPhone) {
					if (!dict.ContainsKey ("CFBundleIconFile")) {
						var icon = proj.BundleIcon.ToRelative (proj.BaseDirectory);
						if (icon.IsNullOrEmpty || icon.ToString () == ".")
							result.AddWarning ("Application bundle icon has not been set (iPhone Application options panel)");
						else
							dict ["CFBundleIconFile"] = icon.FileName;
					}
				}
				
				//newer icons - see http://developer.apple.com/library/ios/#qa/qa2010/qa1686.html
				if (v3_2_orNewer && !dict.ContainsKey ("CFBundleIconFiles")) {
					var arr = new PlistArray ();
					dict["CFBundleIconFiles"] = arr;
					
					if (supportsIPhone)
						AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIcon, "Icon.png");
					
					if (v4_0_orNewer && supportsIPhone)
						if (!AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconHigh, "*****@*****.**"))
							result.AddWarning ("iPhone high res bundle icon has not been set (iPhone Application options panel)");
					
					if (supportsIPad)
						if (!AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconIPad, "Icon-72.png"))
							result.AddWarning ("iPad bundle icon has not been set (iPhone Application options panel)");
					
					AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconSpotlight, "Icon-Small.png");
					
					if (supportsIPad)
						AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconIPadSpotlight, "Icon-Small-50.png");
					
					if (v4_0_orNewer && supportsIPhone)
						AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconSpotlightHigh, "*****@*****.**");
				}
				
				SetIfNotPresent (dict, "CFBundleIdentifier", identity.BundleID);
				SetIfNotPresent (dict, "CFBundleInfoDictionaryVersion", "6.0");
				SetIfNotPresent (dict, "CFBundleName", proj.Name);
				SetIfNotPresent (dict, "CFBundlePackageType", "APPL");
				if (!sim)
					dict["CFBundleResourceSpecification"] = "ResourceRules.plist";
				SetIfNotPresent (dict, "CFBundleSignature", "????");
				SetIfNotPresent (dict,  "CFBundleSupportedPlatforms",
					new PlistArray () { sim? "iPhoneSimulator" : "iPhoneOS" });
				SetIfNotPresent (dict, "CFBundleVersion", proj.BundleVersion ?? "1.0");
				
				if (!sim) {
					SetIfNotPresent (dict, "DTCompiler", sdkSettings.DTCompiler);
					SetIfNotPresent (dict, "DTPlatformBuild", dtSettings.DTPlatformBuild);
					SetIfNotPresent (dict, "DTSDKBuild", sdkSettings.DTSDKBuild);
				}
				SetIfNotPresent (dict, "DTPlatformName", sim? "iphonesimulator" : "iphoneos");
				if (!sim) {
					SetIfNotPresent (dict, "DTPlatformVersion", dtSettings.DTPlatformVersion);
				}
				SetIfNotPresent (dict, "DTSDKName", sim? sdkSettings.AlternateSDK : sdkSettings.CanonicalName);
				if (!sim) {
					SetIfNotPresent (dict, "DTXcode", dtSettings.DTXcode);
					SetIfNotPresent (dict, "DTXcodeBuild", dtSettings.DTXcodeBuild);
				}
				
				SetIfNotPresent (dict,  "LSRequiresIPhoneOS", true);
				if (v3_2_orNewer)
					SetIfNotPresent (dict,  "UIDeviceFamily", GetSupportedDevices (proj.SupportedDevices));
				
				if (v3_1_orNewer) {
					if (conf.MtouchArch != MtouchArch.ARMv6_ARMv7) {
						var val = conf.MtouchArch == MtouchArch.ARMv6? "armv6" : "armv7";
						var key = "UIRequiredDeviceCapabilities";
						var caps = dict.TryGetValue (key) ?? (dict[key] = new PlistArray ());
						var a = caps as PlistArray;
						if (a != null) {
							a.Add (val);
						} else {
							var d = (PlistDictionary) caps;
							d[val] = new PlistBoolean (true);
						}
					}
				}
				
				SetIfNotPresent (dict, "MinimumOSVersion", conf.MtouchMinimumOSVersion);
				
				SetNibProperty (dict, proj, proj.MainNibFile, "NSMainNibFile");
				if (proj.SupportedDevices == TargetDevice.IPhoneAndIPad)
					SetNibProperty (dict, proj, proj.MainNibFileIPad, "NSMainNibFile~ipad");
				
				
				if (v3_2_orNewer) {
					if (!dict.ContainsKey (OrientationUtil.KEY)) {
						result.AddWarning ("Supported orientations have not been set (iPhone Application options panel)");
					} else {
						var val = OrientationUtil.Parse ((PlistArray)dict[OrientationUtil.KEY]);
						if (!OrientationUtil.IsValidPair (val))
							result.AddWarning ("Supported orientations are not matched pairs (Info.plist)");
						if (dict.ContainsKey (OrientationUtil.KEY_IPAD)) {
							var pad = OrientationUtil.Parse ((PlistArray)dict[OrientationUtil.KEY_IPAD]);
							if (pad != Orientation.None && !OrientationUtil.IsValidPair (pad))
								result.AddWarning ("iPad orientations are not matched pairs (Info.plist)");
						}
					}
				}   
				
				return result;
			});
		}
Exemplo n.º 14
0
		static BuildResult UpdateDebugSettingsPlist (IProgressMonitor monitor, IPhoneProjectConfiguration conf,
		                                             ProjectFile template, string target)
		{
			if (template != null && template.BuildAction != BuildAction.Content)
				template = null;
			
			//if not in debug mode, make sure that the settings file is either
			//copied cleanly or deleted
			if (!conf.DebugMode) {
				if (template != null) {
					MacBuildUtilities.EnsureDirectoryForFile (target);
					File.Copy (template.FilePath, target, true);
				} else if (File.Exists (target)) {
					File.Delete (target);
				}
				return null;
			}
			
			return MacBuildUtilities.CreateMergedPlist (monitor, template, target, (PlistDocument doc) => {
				var br = new BuildResult ();
				var debuggerIP = System.Net.IPAddress.Any;
				bool sim = conf.Platform == IPhoneProject.PLAT_SIM;
				
				try {
					debuggerIP = IPhoneSettings.GetDebuggerHostIP (sim);
				} catch {
					br.AddWarning (GettextCatalog.GetString ("Could not resolve host IP for debugger settings"));
				}
				
				var dict = doc.Root as PlistDictionary;
				if (dict == null)
					doc.Root = dict = new PlistDictionary ();
				
				SetIfNotPresent (dict, "Title", "AppSettings");
				SetIfNotPresent (dict, "StringsTable", "Root");
				
				var arr = dict.TryGetValue ("PreferenceSpecifiers") as PlistArray;
				if (arr == null)
					dict["PreferenceSpecifiers"] = arr = new PlistArray ();
				
				arr.Add (new PlistDictionary (true) {
					{ "Type", "PSGroupSpecifier" },
					{ "Title", "Debug Settings" }
				});
				
				arr.Add (new PlistDictionary (true) {
					{ "Type", "PSToggleSwitchSpecifier" },
					{ "Title", "Enabled" },
					{ "Key", "__monotouch_debug_enabled" },
					{ "DefaultValue", "1" },
					{ "TrueValue", "1" },
					{ "FalseValue", "0" }
				});
				
				arr.Add (new PlistDictionary (true) {
					{ "Type", "PSTextFieldSpecifier" },
					{ "Title", "Debugger Host" },
					{ "Key", "__monotouch_debug_host" },
					{ "AutocapitalizationType", "None" },
					{ "AutocorrectionType", "No" },
					{ "DefaultValue", debuggerIP.ToString () }
				});
					
				arr.Add (new PlistDictionary (true) {
					{ "Type", "PSTextFieldSpecifier" },
					{ "Title", "Debugger Port" },
					{ "Key", "__monotouch_debug_port" },
					{ "AutocapitalizationType", "None" },
					{ "AutocorrectionType", "No" },
					{ "DefaultValue", IPhoneSettings.DebuggerPort.ToString () }
				});
					
				arr.Add (new PlistDictionary (true) {
					{ "Type", "PSTextFieldSpecifier" },
					{ "Title", "Output Port" },
					{ "Key", "__monotouch_output_port" },
					{ "AutocapitalizationType", "None" },
					{ "AutocorrectionType", "No" },
					{ "DefaultValue", IPhoneSettings.DebuggerOutputPort.ToString () }
				});
				
				return br;
			});
		}
Exemplo n.º 15
0
		static BuildResult GenXcent (IProgressMonitor monitor, IPhoneSdkVersion sdkVersion, IPhoneProject proj, 
			IPhoneProjectConfiguration conf, IPhoneAppIdentity identity, out string xcentName)
		{
			xcentName = conf.CompiledOutputName.ChangeExtension (".xcent");
			
			monitor.BeginTask (GettextCatalog.GetString ("Processing entitlements file"), 0);
			
			string srcFile;
			
			if (!string.IsNullOrEmpty (conf.CodesignEntitlements)) {
				if (!File.Exists (conf.CodesignEntitlements))
					return BuildError ("Entitlements file \"" + conf.CodesignEntitlements + "\" not found.");
				srcFile = conf.CodesignEntitlements;
			} else {
				srcFile = "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" + sdkVersion.ToString ()
					+ ".sdk/Entitlements.plist";
			}
			
			var doc = new PlistDocument ();
			try {
				doc.LoadFromXmlFile (srcFile);
			} catch (Exception ex) {
				monitor.Log.WriteLine (ex.ToString ());
				return BuildError ("Error loading entitlements source file '" + srcFile +"'.");
			}
			
			//insert the app ID into the plist at the beginning
			var oldDict = doc.Root as PlistDictionary;
			var newDict = new PlistDictionary ();
			doc.Root = newDict;
			newDict["application-identifier"] = identity.AppID;
			var keychainGroups = new PlistArray (new [] { identity.AppID } );
			newDict["keychain-access-groups"] = keychainGroups;
			
			//merge in the user's values
			foreach (var item in oldDict) {
				//FIXME: we currently ignore these items, and write our own, but maybe we should do substitutes
				//i.e. $(AppIdentifierPrefix)$(CFBundleIdentifier)
				if (item.Key == "application-identifier") {
					var str = item.Value as PlistString;
					if (str == null || string.IsNullOrEmpty (str.Value) || str.Value.Contains ('$'))
						continue;
				} else if (item.Key == "keychain-access-groups") {
					//special handling, merge into the array
					var keyArr = item.Value as PlistArray;
					foreach (var key in keyArr) {
						var str = key as PlistString;
						if (str != null && !string.IsNullOrEmpty (str.Value) && !str.Value.Contains ('$')) {
							keychainGroups.Add (str.Value);
						}
					}
					continue;
				}
				newDict[item.Key] = item.Value;
			}
			
			//merge in the settings from the provisioning profile, skipping some
			foreach (var item in identity.Profile.Entitlements)
				if (item.Key != "application-identifier" && item.Key != "keychain-access-groups")
					newDict[item.Key] = item.Value;
			
			try {
				WriteXcent (doc, xcentName);
			} catch (Exception ex) {
				monitor.Log.WriteLine (ex.ToString ());
				return BuildError ("Error writing entitlements file '" + xcentName +"'.");
			}
			
			monitor.EndTask ();
			return null;
		}
Exemplo n.º 16
0
		BuildResult UpdateInfoPlist (IProgressMonitor monitor, IPhoneProject proj, IPhoneProjectConfiguration conf,
		                             IPhoneAppIdentity identity, ProjectFile template, string plistOut)
		{
			return MacBuildUtilities.CreateMergedPlist (monitor, template, plistOut, (PlistDocument doc) => {
				var result = new BuildResult ();
				var dict = doc.Root as PlistDictionary;
				if (dict == null)
					doc.Root = dict = new PlistDictionary ();
				
				bool sim = conf.Platform != IPhoneProject.PLAT_IPHONE;
				var sdkversion = IPhoneSdkVersion.Parse (conf.MtouchSdkVersion);
				bool v3_2_orNewer = sdkversion.CompareTo (IPhoneSdkVersion.V3_2) >= 0;
				bool v4_0_orNewer = sdkversion.CompareTo (IPhoneSdkVersion.V4_0) >= 0;
				bool supportsIPhone = (proj.SupportedDevices & TargetDevice.IPhone) != 0;
				bool supportsIPad = (proj.SupportedDevices & TargetDevice.IPad) != 0;
				
				SetIfNotPresent (dict, "CFBundleDevelopmentRegion",
					String.IsNullOrEmpty (proj.BundleDevelopmentRegion)? "English" : proj.BundleDevelopmentRegion);
				
				SetIfNotPresent (dict, "CFBundleDisplayName", proj.BundleDisplayName ?? proj.Name);
				SetIfNotPresent (dict, "CFBundleExecutable", conf.NativeExe.FileName);
				
				// < 3.2 icon
				if (supportsIPhone) {
					if (!dict.ContainsKey ("CFBundleIconFile")) {
						var icon = proj.BundleIcon.ToRelative (proj.BaseDirectory);
						if (icon.IsNullOrEmpty || icon.ToString () == ".")
							result.AddWarning ("Application bundle icon has not been set (iPhone Application options panel)");
						else
							dict ["CFBundleIconFile"] = icon.FileName;
					}
				}
				
				//newer icons
				if (v3_2_orNewer && !dict.ContainsKey ("CFBundleIconFiles")) {
					var arr = new PlistArray ();
					dict["CFBundleIconFiles"] = arr;
					
					if (supportsIPhone)
						AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIcon);
					
					AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconSpotlight, "Icon-Small.png");
					if (supportsIPad) {
						AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconIPadSpotlight, "Icon-Small-50.png");
						if (!AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconIPad))
							result.AddWarning ("iPad bundle icon has not been set (iPhone Application options panel)");
					}
					
					if (v4_0_orNewer) {
						if (supportsIPhone) {
							if (!AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconHigh))
								result.AddWarning ("iPhone high res bundle icon has not been set (iPhone Application options panel)");
							AddIconRelativeIfNotEmpty (proj, arr, proj.BundleIconSpotlightHigh, "*****@*****.**");
						}
					}
				}
				
				SetIfNotPresent (dict, "CFBundleIdentifier", identity.BundleID);
				SetIfNotPresent (dict, "CFBundleInfoDictionaryVersion", "6.0");
				SetIfNotPresent (dict, "CFBundleName", proj.Name);
				SetIfNotPresent (dict, "CFBundlePackageType", "APPL");
				if (!sim)
					dict["CFBundleResourceSpecification"] = "ResourceRules.plist";
				SetIfNotPresent (dict, "CFBundleSignature", "????");
				SetIfNotPresent (dict,  "CFBundleSupportedPlatforms",
					new PlistArray () { sim? "iPhoneSimulator" : "iPhoneOS" });
				SetIfNotPresent (dict, "CFBundleVersion", proj.BundleVersion ?? "1.0");
				SetIfNotPresent (dict, "DTPlatformName", sim? "iphonesimulator" : "iphoneos");
				SetIfNotPresent (dict, "DTSDKName", IPhoneFramework.GetDTSdkName (sdkversion, sim));
				SetIfNotPresent (dict,  "LSRequiresIPhoneOS", true);
				if (v3_2_orNewer)
					SetIfNotPresent (dict,  "UIDeviceFamily", GetSupportedDevices (proj.SupportedDevices));
				SetIfNotPresent (dict, "DTPlatformVersion", IPhoneFramework.DTPlatformVersion);
				
				SetIfNotPresent (dict, "MinimumOSVersion", conf.MtouchMinimumOSVersion);
				
				SetNibProperty (dict, proj, proj.MainNibFile, "NSMainNibFile");
				if (proj.SupportedDevices == TargetDevice.IPhoneAndIPad)
					SetNibProperty (dict, proj, proj.MainNibFileIPad, "NSMainNibFile~ipad");
				
				
				if (v3_2_orNewer) {
					if (!dict.ContainsKey (OrientationUtil.KEY)) {
						result.AddWarning ("Supported orientations have not been set (iPhone Application options panel)");
					} else {
						var val = OrientationUtil.Parse ((PlistArray)dict[OrientationUtil.KEY]);
						if (!OrientationUtil.IsValidPair (val))
							result.AddWarning ("Supported orientations are not matched pairs (Info.plist)");
						if (dict.ContainsKey (OrientationUtil.KEY_IPAD)) {
							var pad = OrientationUtil.Parse ((PlistArray)dict[OrientationUtil.KEY_IPAD]);
							if (pad != Orientation.None && !OrientationUtil.IsValidPair (pad))
								result.AddWarning ("iPad orientations are not matched pairs (Info.plist)");
						}
					}
				}   
				
				return result;
			});
		}
		static bool AddIconRelativeIfNotEmpty (PlistArray arr, FilePath iconFullPath, string name)
		{
			if (iconFullPath.IsNullOrEmpty)
				return false;
			arr.Add (name);
			return true;
		}
Exemplo n.º 18
0
		static void LoadOrientationsCombo (ComboBox combo, PlistArray values)
		{
			var store = (ListStore)combo.Model;
			store.Clear ();
			store.AppendValues (GettextCatalog.GetString ("Both"), Orientation.Both);
			store.AppendValues (GettextCatalog.GetString ("Portrait"), Orientation.Portrait);
			store.AppendValues (GettextCatalog.GetString ("Landscape"), Orientation.Landscape);
			store.AppendValues (GettextCatalog.GetString ("Not specified"), Orientation.None);
			
			var o = OrientationUtil.Parse (values);
			switch (o) {
			case Orientation.Both:
				combo.Active = 0;
				break;
			case Orientation.Portrait:
				combo.Active = 1;
				break;
			case Orientation.Landscape:
				combo.Active = 2;
				break;
			case Orientation.None:
				combo.Active = 3;
				break;
			default:
				store.AppendValues (GettextCatalog.GetString ("Custom"), o);
				combo.Active = 4;
				break;
			}
		}
Exemplo n.º 19
0
        //--------------------------------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------------------------------
        public LHScene(PlistDictionary dict, string plistLevelFile, CCWindow mainWindow) : base(mainWindow)
        {
            _designResolutionSize = CCSize.Parse(dict ["designResolution"].AsString);

            foreach (PlistDictionary devInf in dict["devices"].AsArray)
            {
                devices.Add(new LHDevice(devInf));
            }
            currentDev = LHDevice.currentDeviceFromArray(devices, this);
            CCSize sceneSize = currentDev.getSize();
            float  ratio     = currentDev.getRatio();

            sceneSize.Width  = sceneSize.Width / ratio;
            sceneSize.Height = sceneSize.Height / ratio;

            var aspect = dict ["aspect"].AsInt;

            if (aspect == 0)           //exact fit
            {
                sceneSize = _designResolutionSize;
            }
            else if (aspect == 1)           //no borders
            {
            }
            else if (aspect == 2)           //show all
            {
                _designOffset.X = (sceneSize.Width - _designResolutionSize.Width) * 0.5f;
                _designOffset.Y = (sceneSize.Height - _designResolutionSize.Height) * 0.5f;
            }


            //loadingInProgress = true;
            Debug.WriteLine("plistLevelFile:|" + plistLevelFile + "|");

            this.relativePath = LHUtils.folderFromPath(plistLevelFile);
//			this.relativePath = Path.GetDirectoryName (plistLevelFile);

            Debug.WriteLine("SCENE REL |" + this.relativePath + "|");
//			Console.WriteLine ("SCENE REL |" + this.relativePath + "|");

            if (this.relativePath == null)
            {
                this.relativePath = "";
            }

//			loadingInProgress = true;

//			[[CCDirector sharedDirector] setContentScaleFactor:ratio];
//			#if __CC_PLATFORM_IOS
//			[[CCFileUtils sharedFileUtils] setiPhoneContentScaleFactor:curDev.ratio];
//			#endif

//			[self setName:relativePath];

            _nodeProtocolImp.loadGenericInfoFromDictionary(dict, this);

//			self.contentSize= CGSizeMake(curDev.size.width/curDev.ratio, curDev.size.height/curDev.ratio);
//			self.position   = CGPointZero;

            PlistDictionary tracedFixInfo = dict["tracedFixtures"].AsDictionary;

            if (tracedFixInfo != null)
            {
                tracedFixtures = new PlistDictionary();
                foreach (var pair in tracedFixInfo)
                {
                    string     fixUUID = pair.Key;
                    PlistArray fixInfo = pair.Value.AsArray;
                    if (null != fixInfo)
                    {
                        tracedFixtures.Add(fixUUID, fixInfo);
                    }
                }
            }

//			supportedDevices = [[NSArray alloc] initWithArray:devices];

//			[self loadBackgroundColorFromDictionary:dict];
//			[self loadGameWorldInfoFromDictionary:dict];



            LHNodeProtocolImp.loadChildrenForNode(this, dict);

//			[self loadGlobalGravityFromDictionary:dict];
//			[self loadPhysicsBoundariesFromDictionary:dict];

//			[self setUserInteractionEnabled:YES];

//			#if __CC_PLATFORM_IOS
//			pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)];
//			[[[CCDirector sharedDirector] view] addGestureRecognizer:pinchRecognizer];
//			#endif



//			#if LH_USE_BOX2D
//			_box2dCollision = [[LHBox2dCollisionHandling alloc] initWithScene:self];
//			#else//cocos2d

//			#endif
//			[self performLateLoading];

//			loadingInProgress = false;

            Debug.WriteLine("SCENE has children count " + this.ChildrenCount);
        }
        public void loadPhysicsInfoFromDictionary(PlistDictionary dict, CCNode nd)
        {
            _node = nd;

            if (null != dict)
            {
                int shapeType = dict ["shape"].AsInt;
                int type      = dict ["type"].AsInt;

                LHScene scene = ((LHNodeProtocol)_node).getScene();

                b2World world = scene.getBox2dWorld();

                var bodyDef = new b2BodyDef();
                bodyDef.type = (b2BodyType)type;

                CCPoint position = _node.Parent.ConvertToWorldspace(_node.Position);
//				bodyDef.position = scene.metersFromPoint (position);
                bodyDef.position = new b2Vec2(position.X, position.Y);

                float angle = CCNodeTransforms.GlobalXAngleFromLocalAngle(_node, _node.RotationX);
                bodyDef.angle = LHUtils.LH_DEGREES_TO_RADIANS(angle);

                bodyDef.userData = _node;

                _body          = world.CreateBody(bodyDef);
                _body.UserData = _node;


                Debug.WriteLine("BODY:" + _body);


                _body.SetFixedRotation(dict ["fixedRotation"].AsBool);
                //_body->SetGravityScale

                _body.SetSleepingAllowed(dict ["allowSleep"].AsBool);
                _body.SetBullet(dict ["bullet"].AsBool);

                _body.AngularDamping  = dict ["angularDamping"].AsFloat;
                _body.AngularVelocity = -360.0f * dict ["angularVelocity"].AsFloat;
                _body.LinearDamping   = dict ["linearDamping"].AsFloat;

                CCPoint linearVel = CCPoint.Parse(dict ["linearVelocity"].AsString);
                _body.LinearVelocity = new b2Vec2(linearVel.X, linearVel.Y);


                CCSize size = _node.ContentSize;
//				size.Width = scene.metersFromValue (size.Width);
//				size.Height = scene.metersFromValue (size.Height);

                CCPoint scale = new CCPoint(_node.ScaleX, _node.ScaleY);
                scale = CCNodeTransforms.ConvertToWorldScale(_node, scale);

                previousScale = scale;


                size.Width  *= scale.X;
                size.Height *= scale.Y;


                PlistDictionary fixInfo = dict ["genericFixture"].AsDictionary;

                Debug.WriteLine("FIX INFO " + fixInfo);

                Debug.WriteLine("SHAPE TYPE " + shapeType);

                if (shapeType == 0)               //RECTANGLE
                {
                    LHBodyShape shape = new LHBodyShape();
                    shape.createRectangleWithDictionary(fixInfo, _body, _node, scene, size);

                    _subShapes.Add(shape);
                }
                else if (shapeType == 1)               //CIRCLE
                {
                    LHBodyShape shape = new LHBodyShape();
                    shape.createCircleWithDictionary(fixInfo, _body, _node, scene, size);

                    _subShapes.Add(shape);
                }
                else if (shapeType == 4)               //oval
                {
                    PlistArray shapePoints = dict ["ovalShape"].AsArray;
                    if (shapePoints != null)
                    {
                        LHBodyShape shape = new LHBodyShape();
                        shape.createShapeWithDictionary(fixInfo, shapePoints, _body, _node, scene, scale);
                        _subShapes.Add(shape);
                    }
                }
                else if (shapeType == 5)               //traced
                {
                    String fixUUID = dict ["fixtureUUID"].AsString;

                    Debug.WriteLine("TRACED " + fixUUID);

                    PlistArray shapePoints = scene.tracedFixturesWithUUID(fixUUID);

                    Debug.WriteLine("RETURNS " + shapePoints);

                    if (shapePoints == null)
                    {
                        //CHECK IN ASSET
                        //LHAsset asset = _node.assetParent;
                        ///
                    }

                    if (shapePoints != null)
                    {
                        LHBodyShape shape = new LHBodyShape();

                        Debug.WriteLine("WE HAVE A TRACED SHAPE");

                        shape.createShapeWithDictionary(fixInfo, shapePoints, _body, _node, scene, scale);

                        _subShapes.Add(shape);
                    }
                }
                else if (shapeType == 6)               //editor
                {
                    LHSprite sprite = (LHSprite)_node;


                    if (sprite != null && sprite.GetType() == typeof(LHSprite))
                    {
                        String imageFile = sprite.getImageFilePath();

                        imageFile = LHUtils.stripExtension(imageFile);

                        Debug.WriteLine("WE HAVE AN EDITOR SHAPE for sprite " + sprite + " node " + _node + " tst " + imageFile);


                        PlistDictionary bodyInfo = scene.getEditorBodyInfoForSpriteName(sprite.getSpriteFrameName(), imageFile);

                        Debug.WriteLine("WE HAVE BODY INFO " + bodyInfo);

                        if (bodyInfo != null)
                        {
                            PlistArray fixturesInfo = bodyInfo ["shapes"].AsArray;

                            for (int i = 0; i < fixturesInfo.Count; ++i)
                            {
                                PlistDictionary shapeInfo = fixturesInfo [i].AsDictionary;

                                Debug.WriteLine("SHAPE INFO " + shapeInfo);

                                LHBodyShape shape = new LHBodyShape();

                                shape.createEditorWithDictionary(shapeInfo, _body, _node, scene, scale);

                                _subShapes.Add(shape);
                            }
                        }
                    }
                }

//				if (dict.ContainsKey ("alpha")) {
//					_node.Opacity = (byte)dict ["alpha"].AsFloat;
//				}
            }
        }
		BuildResult UpdateInfoPlist (IProgressMonitor monitor, IPhoneProject proj, IPhoneProjectConfiguration conf,
		                             IPhoneAppIdentity identity, ProjectFile template, string plistOut)
		{
			return CreateMergedPlist (monitor, conf, template, plistOut, 
				(IPhoneProjectConfiguration config, PlistDocument doc) => 
			{
				var result = new BuildResult ();
				var dict = doc.Root as PlistDictionary;
				if (dict == null)
					doc.Root = dict = new PropertyList.PlistDictionary ();
				
				bool sim = conf.Platform != IPhoneProject.PLAT_IPHONE;
				
				SetIfNotPresent (dict, "CFBundleDevelopmentRegion",
					String.IsNullOrEmpty (proj.BundleDevelopmentRegion)? "English" : proj.BundleDevelopmentRegion);
				
				SetIfNotPresent (dict, "CFBundleDisplayName", proj.BundleDisplayName ?? proj.Name);
				SetIfNotPresent (dict, "CFBundleExecutable", conf.NativeExe.FileName);
				
				//iphone icons
				if ((proj.SupportedDevices & TargetDevice.IPhone) != 0) {
					if (!dict.ContainsKey ("CFBundleIconFile")) {
						var icon = proj.BundleIcon.ToRelative (proj.BaseDirectory);
						if (icon.IsNullOrEmpty || icon.ToString () == ".")
							result.AddWarning ("Application bundle icon has not been set");
						else
							dict ["CFBundleIconFile"] = icon.FileName;
					}
				}
				
				//ipad and universal icons
				if ((proj.SupportedDevices & TargetDevice.IPad) != 0 && !dict.ContainsKey ("CFBundleIconFiles")) {
					var arr = new PlistArray ();
					dict["CFBundleIconFiles"] = arr;
					//universal only
					if ((proj.SupportedDevices & TargetDevice.IPhone) != 0)
						AddRelativeIfNotEmpty (proj, arr, proj.BundleIcon);
					//ipad and universal
					AddRelativeIfNotEmpty (proj, arr, proj.BundleIconSpotlight);
					AddRelativeIfNotEmpty (proj, arr, proj.BundleIconIPadSpotlight);
					if (!AddRelativeIfNotEmpty (proj, arr, proj.BundleIconIPad))
						result.AddWarning ("iPad bundle icon has not been set");
				}
				
				SetIfNotPresent (dict, "CFBundleIdentifier", identity.BundleID);
				SetIfNotPresent (dict, "CFBundleInfoDictionaryVersion", "6.0");
				SetIfNotPresent (dict, "CFBundleName", proj.Name);
				SetIfNotPresent (dict, "CFBundlePackageType", "APPL");
				if (!sim)
					dict["CFBundleResourceSpecification"] = "ResourceRules.plist";
				SetIfNotPresent (dict, "CFBundleSignature", "????");
				SetIfNotPresent (dict,  "CFBundleSupportedPlatforms",
					new PropertyList.PlistArray () { sim? "iPhoneSimulator" : "iPhoneOS" });
				SetIfNotPresent (dict, "CFBundleVersion", proj.BundleVersion ?? "1.0");
				SetIfNotPresent (dict, "DTPlatformName", sim? "iphonesimulator" : "iphoneos");
				SetIfNotPresent (dict, "DTSDKName", (sim? "iphonesimulator" : "iphoneos")  + conf.MtouchSdkVersion);
				SetIfNotPresent (dict,  "LSRequiresIPhoneOS", true);
				if (proj.SupportedDevices != TargetDevice.IPhone)
					SetIfNotPresent (dict,  "UIDeviceFamily", GetSupportedDevices (proj.SupportedDevices));
				SetIfNotPresent (dict, "DTPlatformVersion", conf.MtouchSdkVersion);
				
				SetIfNotPresent (dict, "MinimumOSVersion", conf.MtouchMinimumOSVersion);
				
				SetNibProperty (dict, proj, proj.MainNibFile, "NSMainNibFile");
				if (proj.SupportedDevices == TargetDevice.IPhoneAndIPad)
					SetNibProperty (dict, proj, proj.MainNibFileIPad, "NSMainNibFile~ipad");
				
				return result;
			});
		}
        private PlistObjectBase LoadFromNode(XmlReader reader)
        {
            //Debug.Assert(reader.NodeType == XmlNodeType.Element);
            bool isEmpty = reader.IsEmptyElement;
            switch (reader.LocalName)
            {
                case "dict":
                    var dict = new PlistDictionary(true);
                    if (!isEmpty)
                    {
                        if (reader.ReadToDescendant("key"))
                            dict = LoadDictionaryContents(reader, dict);
                        reader.ReadEndElement();
                    }
                    return dict;

                case "array":
                    if (isEmpty)
                        return new PlistArray();

                    //advance to first node
                    reader.ReadStartElement();
                    while (reader.Read() && reader.NodeType != XmlNodeType.Element) ;

                    // HACK: plist data in iPods is not even valid in some cases! Way to go Apple!
                    // This hack checks to see if they really meant for this array to be a dict.
                    if (reader.LocalName == "key")
                    {
                        var ret = LoadDictionaryContents(reader, new PlistDictionary(true));
                        reader.ReadEndElement();
                        return ret;
                    }

                    var arr = new PlistArray();
                    do
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            var val = LoadFromNode(reader);
                            if (val != null)
                                arr.Add(val);
                        }
                    } while (reader.Read() && reader.NodeType != XmlNodeType.EndElement);
                    reader.ReadEndElement();
                    return arr;

                case "key":
                    return new PlistString(reader.ReadElementContentAsString());
                case "string":
                    return new PlistString(reader.ReadElementContentAsString());
                case "integer":
                    return new PlistInteger(reader.ReadElementContentAsInt());
                case "real":
                    return new PlistReal(reader.ReadElementContentAsDouble());
                case "false":
                    reader.ReadStartElement();
                    if (!isEmpty)
                        reader.ReadEndElement();
                    return new PlistBoolean(false);
                case "true":
                    reader.ReadStartElement();
                    if (!isEmpty)
                        reader.ReadEndElement();
                    return new PlistBoolean(true);
                case "data":
                    return new PlistData(reader.ReadElementContentAsString());
                case "date":
                    return new PlistDate(reader.ReadElementContentAsDateTime());
                default:
                    throw new XmlException(String.Format("Plist Node `{0}' is not supported", reader.LocalName));
            }
        }
Exemplo n.º 23
0
        object ParseObject(ulong objectIndex)
        {
            Seek(offsetTable [objectIndex]);

            var header  = reader.ReadByte();
            var kind    = (MarkerKind)(header & 0xF0);
            var subKind = (MarkerKind)(header);
            var length  = header & 0x0F;

            switch ((MarkerKind)header)
            {
            case MarkerKind.Date:
                return(PlistDate.FromAbsoluteTime(ReadSizedDouble(8)));
            }

            switch (kind)
            {
            case MarkerKind.Data:
            case MarkerKind.AsciiString:
            case MarkerKind.Unicode16String:
            case MarkerKind.Array:
            case MarkerKind.Set:
            case MarkerKind.Dict:
                if (length == 0xF)
                {
                    length = (int)ReadInt();
                }
                break;
            }

            switch (kind)
            {
            case MarkerKind.Null:
                switch (subKind)
                {
                case MarkerKind.Null:
                case MarkerKind.Fill:
                    return(null);

                case MarkerKind.False:
                    return(false);

                case MarkerKind.True:
                    return(true);
                }
                break;

            case MarkerKind.Uid:
                var buffer = new byte [16];
                reader.Read(buffer, 0, length + 1);
                return(new Guid(buffer));

            case MarkerKind.Int:
                return((long)ReadSizedInt(1UL << length));

            case MarkerKind.Real:
                return(ReadSizedDouble(1UL << length));

            case MarkerKind.Data:
                return(reader.ReadBytes(length));

            case MarkerKind.AsciiString:
                var strBytes = reader.ReadBytes(length);
                return(Encoding.ASCII.GetString(strBytes));

            case MarkerKind.Unicode16String:
                var uniBytes = reader.ReadBytes(length);
                return(Encoding.BigEndianUnicode.GetString(uniBytes));

            case MarkerKind.Array:
            case MarkerKind.Set:
                ICollection <object> array;
                if (kind == MarkerKind.Array)
                {
                    array = new PlistArray();
                }
                else
                {
                    array = new PlistSet();
                }

                var arrayStart = (ulong)stream.Position;

                for (var i = 0UL; i < (ulong)length; i++)
                {
                    Seek(arrayStart + i * trailer.ObjectRefSize);
                    var valueRef = ReadSizedInt(trailer.ObjectRefSize);
                    array.Add(ParseObject(valueRef));
                }

                return((object)array);

            case MarkerKind.Dict:
                var dict      = new PlistDictionary();
                var dictStart = (ulong)stream.Position;

                for (var i = 0UL; i < (ulong)length; i++)
                {
                    Seek(dictStart + i * trailer.ObjectRefSize);
                    var keyRef = ReadSizedInt(trailer.ObjectRefSize);

                    Seek(dictStart + i * trailer.ObjectRefSize + (ulong)length * trailer.ObjectRefSize);
                    var valueRef = ReadSizedInt(trailer.ObjectRefSize);

                    dict.Add((string)ParseObject(keyRef), ParseObject(valueRef));
                }

                return(dict);
            }

            Fatal("Unhandled object kind: {0}", kind);
            return(null);
        }