• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PlistDictionary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PlistDictionary的典型用法代码示例。如果您正苦于以下问题:C# PlistDictionary类的具体用法?C# PlistDictionary怎么用?C# PlistDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PlistDictionary类属于命名空间,在下文中一共展示了PlistDictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetPlistType

		private PlistType GetPlistType(PlistDictionary dict)
		{
			var isSpriteKit = dict.ContainsKey ("format") ? dict ["format"].AsString == "APPL" : false;

			return isSpriteKit ? PlistType.SpriteKit : PlistType.Cocos2D;

		}
开发者ID:GrimDerp,项目名称:cocos2d-xna,代码行数:7,代码来源:CCSpriteSheet.cs


示例2: InitWithSpriteFrame

 public bool InitWithSpriteFrame(CCSpriteFrame spriteFrame, float delayUnits, PlistDictionary userInfo)
 {
     m_pSpriteFrame = spriteFrame;
     m_fDelayUnits = delayUnits;
     m_pUserInfo = userInfo;
     return true;
 }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:7,代码来源:CCAnimationFrame.cs


示例3: CCLabelAtlas

 private CCLabelAtlas(string label, PlistDictionary fontPlistDict) 
     : this(label, fontPlistDict["textureFilename"].AsString, 
         (int)Math.Ceiling((double)fontPlistDict["itemWidth"].AsInt), 
         (int)Math.Ceiling((double)fontPlistDict["itemHeight"].AsInt),
         (char)fontPlistDict["firstChar"].AsInt)
 {
     Debug.Assert(fontPlistDict["version"].AsInt == 1, "Unsupported version. Upgrade cocos2d version");
 }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:8,代码来源:CCLabelAtlas.cs


示例4: AddSpriteSheet

 public CCSpriteSheet AddSpriteSheet(PlistDictionary dictionary, CCTexture2D texture, string name)
 {
     CCSpriteSheet result;
     if (!_spriteSheets.TryGetValue(name, out result))
     {
         result = new CCSpriteSheet(name, texture);
         _spriteSheets.Add(name, result);
     }
     return result;
 }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:10,代码来源:CCSpriteSheetCache.cs


示例5: AddAnimationsWithDictionary

        public void AddAnimationsWithDictionary(PlistDictionary dictionary)
        {
            PlistDictionary animations = dictionary["animations"].AsDictionary;

            if (animations == null)
            {
                CCLog.Log("cocos2d: CCAnimationCache: No animations were found in provided dictionary.");
                return;
            }

            PlistDictionary properties = dictionary["properties"].AsDictionary;
            if (properties != null)
            {
                int version = properties["format"].AsInt;
                PlistArray spritesheets = properties["spritesheets"].AsArray;

                foreach (PlistObjectBase pObj in spritesheets)
                {
                    string name = pObj.AsString;
                    CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile(name);
                }

                switch (version)
                {
                    case 1:
                        ParseVersion1(animations);
                        break;

                    case 2:
                        ParseVersion2(animations);
                        break;

                    default:
                        Debug.Assert(false, "Invalid animation format");
                        break;
                }
            }
        }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:38,代码来源:CCAnimationCache.cs


示例6: GenXcent

		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;
		}
开发者ID:slluis,项目名称:monodevelop,代码行数:71,代码来源:IPhoneBuildExtension.cs


示例7: CCSpriteSheet

 public CCSpriteSheet(PlistDictionary dictionary, CCTexture2D texture)
 {
     InitWithDictionary(dictionary, texture);
 }
开发者ID:GrimDerp,项目名称:cocos2d-xna,代码行数:4,代码来源:CCSpriteSheet.cs


示例8: Execute

        public override bool Execute()
        {
            string displayName = DisplayName ?? Name;
            string identifier  = Identifier ?? String.Format("com.yourcompany.{0}", Name);
            string version     = Version ?? "1.0";
            string region      = DevelopmentRegion ?? "English";

            var doc = new PlistDocument();
            var docRoot = new PlistDictionary();
              			docRoot["CFBundleExecutable"]            = ExeName;
            docRoot["CFBundleInfoDictionaryVersion"] = "6.0";
            docRoot["CFBundlePackageType"]           = "APPL";
            docRoot["CFBundleName"]                  = displayName;
            docRoot["CFBundleDisplayName"]           = displayName;
            docRoot["CFBundleIdentifier"]            = identifier;
            docRoot["CFBundleVersion"]               = version;
            docRoot["CFBundleDevelopmentRegion"]     = region;

            if (!String.IsNullOrEmpty(Icon))
                docRoot["CFBundleIconFile"] = Icon;

            if (!String.IsNullOrEmpty(MainNibFile))
                docRoot["NSMainNibFile"] = Path.GetFileNameWithoutExtension(MainNibFile);

            doc.Root = docRoot;

            using (XmlTextWriter writer = new XmlTextWriter(FileName, Encoding.UTF8)) {
                doc.Write(writer);
            }

            Log.LogMessage("Wrote {0}", FileName);

            return true;
        }
开发者ID:JeanAzzopardi,项目名称:monodevelop-monobjc,代码行数:34,代码来源:CreatePList.cs


示例9: AddSpriteFramesWithDictionary

        public void AddSpriteFramesWithDictionary(PlistDictionary pobDictionary, CCTexture2D pobTexture, string framePrefix)
        {
            /*
            Supported Zwoptex Formats:

            ZWTCoordinatesFormatOptionXMLLegacy = 0, // Flash Version
            ZWTCoordinatesFormatOptionXML1_0 = 1, // Desktop Version 0.0 - 0.4b
            ZWTCoordinatesFormatOptionXML1_1 = 2, // Desktop Version 1.0.0 - 1.0.1
            ZWTCoordinatesFormatOptionXML1_2 = 3, // Desktop Version 1.0.2+
            */

            PlistDictionary metadataDict = null;
            if (pobDictionary.ContainsKey("metadata"))
            {
                metadataDict = pobDictionary["metadata"].AsDictionary;
            }

            PlistDictionary framesDict = null;
            if (pobDictionary.ContainsKey("frames"))
            {
                framesDict = pobDictionary["frames"].AsDictionary;
            }

            int format = 0;

            // get the format
            if (metadataDict != null)
            {
                format = metadataDict["format"].AsInt;
            }

            // check the format
            if (format < 0 || format > 3)
            {
                throw (new NotSupportedException("PList format " + format + " is not supported."));
            }

            foreach (var pair in framesDict)
            {
                PlistDictionary frameDict = pair.Value.AsDictionary;
                CCSpriteFrame spriteFrame = null;

                if (format == 0)
                {
                    float x=0f, y=0f, w=0f, h=0f;
                    x = frameDict["x"].AsFloat;
                    y = frameDict["y"].AsFloat;
                    w = frameDict["width"].AsFloat;
                    h = frameDict["height"].AsFloat;
                    float ox = 0f, oy = 0f;
                    ox = frameDict["offsetX"].AsFloat;
                    oy = frameDict["offsetY"].AsFloat;
                    int ow = 0, oh = 0;
                    ow = frameDict["originalWidth"].AsInt;
                    oh = frameDict["originalHeight"].AsInt;
                    // check ow/oh
                    if (ow == 0 || oh == 0)
                    {
                        CCLog.Log(
                            "cocos2d: WARNING: originalWidth/Height not found on the CCSpriteFrame. AnchorPoint won't work as expected. Regenerate the .plist or check the 'format' metatag");
                    }
                    // abs ow/oh
                    ow = Math.Abs(ow);
                    oh = Math.Abs(oh);
                    // create frame
                    spriteFrame = new CCSpriteFrame(pobTexture,
                                                new CCRect(x, y, w, h),
                                                false,
                                                new CCPoint(ox, oy),
                                                new CCSize(ow, oh)
                        );
                }
                else if (format == 1 || format == 2)
                {
					CCRect frame = CCRect.Parse(frameDict["frame"].AsString);
                    bool rotated = false;

                    // rotation
                    if (format == 2)
                    {
                        if (frameDict.ContainsKey("rotated"))
                        {
                            rotated = frameDict["rotated"].AsBool;
                        }
                    }

                    CCPoint offset = CCPoint.Parse(frameDict["offset"].AsString);
					CCSize sourceSize = CCSize.Parse (frameDict["sourceSize"].AsString);

                    // create frame
                    spriteFrame = new CCSpriteFrame(pobTexture,
                                                frame,
                                                rotated,
                                                offset,
                                                sourceSize
                        );
                }
                else if (format == 3)
                {
                    // get values
//.........这里部分代码省略.........
开发者ID:nilcrabaniel,项目名称:cocos2d-xna,代码行数:101,代码来源:CCSpriteFrameCache.cs


示例10: UpdateInfoPlist

		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, "[email protected]"))
							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, "[email protected]");
				}
				
				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) {
//.........这里部分代码省略.........
开发者ID:slluis,项目名称:monodevelop,代码行数:101,代码来源:IPhoneBuildExtension.cs


示例11: Store

		public void Store (IPhoneProject proj)
		{
			proj.BundleDevelopmentRegion = NullIfEmpty (devRegionEntry.Text);
			proj.BundleIdentifier = NullIfEmpty (bundleIdEntry.Text);
			proj.BundleVersion = NullIfEmpty (bundleVersionEntry.Text);
			proj.BundleDisplayName = NullIfEmpty (displayNameEntry.Text);
			proj.MainNibFile = NullIfEmpty (mainNibPicker.SelectedFile);
			proj.MainNibFileIPad = NullIfEmpty (iPadNibPicker.SelectedFile);
			
			proj.BundleIcon = NullIfEmpty (iphoneIconPicker.SelectedFile);
			proj.BundleIconHigh = NullIfEmpty (iphoneIconHighPicker.SelectedFile);
			proj.BundleIconIPad = NullIfEmpty (ipadIconPicker.SelectedFile);
			proj.BundleIconSpotlight = NullIfEmpty (settingsIconPicker.SelectedFile);
			proj.BundleIconSpotlightHigh = NullIfEmpty (settingsIconHighPicker.SelectedFile);
			proj.BundleIconIPadSpotlight = NullIfEmpty (ipadSpotlightIconPicker.SelectedFile);
			
			proj.SupportedDevices = SupportedDevices;
			
			if (badPlist)
				return;
			try {
				var pf = proj.GetInfoPlist ();
				var doc = new PlistDocument ();
				doc.LoadFromXmlFile (pf.FilePath);
				var dict = doc.Root as PlistDictionary;
				if (dict == null)
					doc.Root = dict = new PlistDictionary ();
				
				var orientations = SaveOrientationsCombo (supportedOrientationsCombo);
				if (orientations != null)
					dict [OrientationUtil.KEY] = orientations;
				else
					dict.Remove (OrientationUtil.KEY);
				
				var iPadOrientations = SaveOrientationsCombo (iPadOrientationsCombo);
				if (proj.SupportedDevices == TargetDevice.IPhoneAndIPad && iPadOrientations != null)
					dict [OrientationUtil.KEY_IPAD] = iPadOrientations;
				else
					dict.Remove (OrientationUtil.KEY_IPAD);
				
				doc.WriteToFile (pf.FilePath);
			} catch (Exception ex) {
				badPlist = true;
				MonoDevelop.Ide.MessageService.ShowException (ex, "Error saving Info.plist.");
			}
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:46,代码来源:IPhoneOptionsPanel.cs


示例12: ProcessPlist

        private void ProcessPlist(XmlReader reader)
        {   
            // create null plist object
            PlistObjectBase rootDict = null;
            
            // loop through reader
            while (reader.Read())
            {
                // node type is not an Element ignore and loop again.
                if (reader.NodeType != XmlNodeType.Element) continue;
                // node type is element, loop through xml data recursively.
                rootDict = LoadFromNode(reader); 
             }
             
            // assign loaded plist as sheet.
             _sheet = (PlistDictionary)rootDict;
            

        }
开发者ID:AJSchultheis,项目名称:Dream.Build.Play.2012,代码行数:19,代码来源:SpriteSheet.cs


示例13: Load

		public void Load (IPhoneProject proj)
		{
			devRegionEntry.Text = proj.BundleDevelopmentRegion ?? "";
			bundleIdEntry.Text = proj.BundleIdentifier ?? "";
			bundleVersionEntry.Text = proj.BundleVersion ?? "";
			displayNameEntry.Text = proj.BundleDisplayName ?? "";
			
			mainNibPicker.Project         = iPadNibPicker.Project         = proj;
			mainNibPicker.EntryIsEditable = iPadNibPicker.EntryIsEditable = true;
			mainNibPicker.DefaultFilter   = iPadNibPicker.DefaultFilter   = "*.xib";
			
			mainNibPicker.DialogTitle = GettextCatalog.GetString ("Select main interface file...");
			mainNibPicker.SelectedFile = proj.MainNibFile.ToString () ?? "";
			
			iPadNibPicker.DialogTitle = GettextCatalog.GetString ("Select iPad interface file...");
			iPadNibPicker.SelectedFile = proj.MainNibFileIPad.ToString () ?? "";
			
			targetDevicesCombo.AppendText (GettextCatalog.GetString ("iPhone and iPad"));
			targetDevicesCombo.AppendText (GettextCatalog.GetString ("iPhone only"));
			targetDevicesCombo.AppendText (GettextCatalog.GetString ("iPad only"));
			
			SupportedDevices = proj.SupportedDevices;
			
			ProjectFileEntry [] pickers = {
				iphoneIconPicker,
				iphoneIconHighPicker,
				ipadIconPicker,
				settingsIconPicker,
				settingsIconHighPicker,
				ipadSpotlightIconPicker,
			};
			
			foreach (var p in pickers) {
				p.Project = proj;
				p.DefaultFilter = "*.png";
				p.EntryIsEditable = true;
				p.DialogTitle = GettextCatalog.GetString ("Select icon...");
			}
			
			iphoneIconPicker.SelectedFile = proj.BundleIcon.ToString () ?? "";
			iphoneIconHighPicker.SelectedFile = proj.BundleIconHigh.ToString () ?? "";
			ipadIconPicker.SelectedFile = proj.BundleIconIPad.ToString () ?? "";
			settingsIconPicker.SelectedFile = proj.BundleIconSpotlight.ToString () ?? "";
			settingsIconHighPicker.SelectedFile = proj.BundleIconSpotlightHigh.ToString () ?? "";
			ipadSpotlightIconPicker.SelectedFile = proj.BundleIconIPadSpotlight.ToString () ?? "";
			
			badPlist = false;
			try {
				var pf = proj.GetInfoPlist ();
				var doc = new PlistDocument ();
				doc.LoadFromXmlFile (pf.FilePath);
				var dict = doc.Root as PlistDictionary;
				if (dict == null)
					doc.Root = dict = new PlistDictionary ();
				
				var orientationArr = dict.TryGetValue (OrientationUtil.KEY) as PlistArray;
				var ipadOrientationArr = dict.TryGetValue (OrientationUtil.KEY_IPAD) as PlistArray;
				
				LoadOrientationsCombo (supportedOrientationsCombo, orientationArr);
				LoadOrientationsCombo (iPadOrientationsCombo, ipadOrientationArr);
			} catch (Exception ex) {
				badPlist = true;
				MonoDevelop.Ide.MessageService.ShowException (ex, "Error reading Info.plist. Some settings may not be saved.");
			}
			
			HandleTargetDevicesComboChanged (null, null);
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:67,代码来源:IPhoneOptionsPanel.cs


示例14: LoadFromNode

        /*
         *  Recursive method to load xml plist data into plist objects.
         * 
         */
        private PlistObjectBase LoadFromNode(XmlReader reader)
        {
            //Console.WriteLine("Loading data from node");
            //only processes 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":
                    return new PlistArray();
                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 PlistInteger(reader.ReadElementContentAsInt());
                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));
            }
        }
开发者ID:AJSchultheis,项目名称:Dream.Build.Play.2012,代码行数:50,代码来源:SpriteSheet.cs


示例15: Build

        protected override BuildResult Build(IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration)
        {
            MonobjcProject proj = item as MonobjcProject;
            if (proj == null || proj.CompileTarget != CompileTarget.Exe)
                return base.Build(monitor, item, configuration);

            BuildResult result = base.Build(monitor, item, configuration);
            if (result.ErrorCount > 0)
                return result;

            var conf = (MonobjcProjectConfiguration) proj.GetConfiguration(configuration);

            // Create directories
            monitor.BeginTask("Creating application bundle", 0);
            foreach (var path in new [] { conf.ResourcesDirectory, conf.MacOSDirectory }) {
                if (!Directory.Exists(path))
                    Directory.CreateDirectory(path);
            }
            monitor.EndTask();

            string exeName = Path.GetFileNameWithoutExtension(conf.CompiledOutputName);

            // Write Info.plist into 'Contents' directory

            monitor.BeginTask("Updating application manifest", 0);
            var doc = new PlistDocument();
            var docRoot = new PlistDictionary();
              			docRoot["CFBundleExecutable"]            = exeName;
            docRoot["CFBundleInfoDictionaryVersion"] = "6.0";
            docRoot["CFBundlePackageType"]           = "APPL";
            docRoot["CFBundleName"]                  = proj.BundleDisplayName ?? proj.Name;
            docRoot["CFBundleDisplayName"]           = proj.BundleDisplayName ?? proj.Name;
            docRoot["CFBundleIdentifier"]            = proj.BundleIdentifier ?? String.Format("com.yourcompany.{0}", proj.Name);
            docRoot["CFBundleVersion"]               = proj.BundleVersion ?? "1.0";
            docRoot["CFBundleDevelopmentRegion"]     = proj.BundleDevelopmentRegion ?? "English";

            FilePath icon = proj.BundleIcon.ToRelative (proj.BaseDirectory);
            if (!(icon.IsNullOrEmpty || icon.ToString () == "."))
                docRoot["CFBundleIconFile"] = icon.FileName;

            if (!String.IsNullOrEmpty (proj.MainNibFile.ToString ()))
                docRoot["NSMainNibFile"] = Path.GetFileNameWithoutExtension(proj.MainNibFile.ToString ());

            doc.Root = docRoot;

            var plistOut = conf.ContentsDirectory.Combine("Info.plist");
            using (XmlTextWriter writer = new XmlTextWriter(plistOut, Encoding.UTF8)) {
                doc.Write(writer);
            }
            monitor.EndTask();

            // Copy project binary into 'Resources' directory
            monitor.BeginTask("Copying application binary", 0);
            File.Copy(conf.CompiledOutputName, conf.ResourcesDirectory.Combine(conf.CompiledOutputName.FileName), true);
            if (File.Exists(conf.CompiledOutputName + ".mdb"))
                File.Copy(conf.CompiledOutputName + ".mdb", conf.ResourcesDirectory.Combine(conf.CompiledOutputName.FileName + ".mdb"), true);
            monitor.EndTask();

            // Copy references into 'Resources' directory
            var references = BuildUtils.GetReferencesFilePairs(proj, configuration);
            foreach (var pair in references) {
                pair.EnsureOutputDirectory();
                monitor.Log.WriteLine("Copying '{0}' to '{1}'", pair.Input, pair.Output);
                File.Copy(pair.Input, pair.Output, true);
                monitor.Step(1);
            }
            monitor.EndTask();

            // Write launcher script into 'MacOS' directory
            monitor.BeginTask("Writing launcher script", 0);
            string scriptPath = conf.MacOSDirectory.Combine(exeName);
            var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LaunchScript.sh");
            using (StreamReader reader = new StreamReader(stream)) {
                using (StreamWriter writer = new StreamWriter(scriptPath)) {
                    writer.Write(reader.ReadToEnd());
                }
            }

            // Make executable (755)
            new UnixFileInfo(scriptPath).FileAccessPermissions = FileAccessPermissions.UserReadWriteExecute |
                FileAccessPermissions.GroupRead | FileAccessPermissions.GroupExecute |
                FileAccessPermissions.OtherRead | FileAccessPermissions.OtherExecute;

            monitor.EndTask();

            return result;
        }
开发者ID:JeanAzzopardi,项目名称:monodevelop-monobjc,代码行数:87,代码来源:MonobjcBuildExtension.cs


示例16: SetNibProperty

		static bool SetNibProperty (PlistDictionary dict, IPhoneProject proj, FilePath mainNibProp, string propName)
		{
			if (!dict.ContainsKey (propName)) {
				if (mainNibProp.IsNullOrEmpty) {
					return false;
				} else {
					string mainNib = mainNibProp.ToRelative (proj.BaseDirectory);
					if (mainNib.EndsWith (".nib") || mainNib.EndsWith (".xib"))
					    mainNib = mainNib.Substring (0, mainNib.Length - 4).Replace ('\\', '/');
					dict[propName] = mainNib;
				}
			}
			return true;
		}
开发者ID:slluis,项目名称:monodevelop,代码行数:14,代码来源:IPhoneBuildExtension.cs


示例17: ParseVersion1

        private void ParseVersion1(PlistDictionary animations)
        {
            CCSpriteFrameCache frameCache = CCSpriteFrameCache.SharedSpriteFrameCache;

            foreach (var pElement in animations)
            {
                PlistDictionary animationDict = pElement.Value.AsDictionary;

                PlistArray frameNames = animationDict["frames"].AsArray;
                float delay = animationDict["delay"].AsFloat;
                //CCAnimation* animation = NULL;

                if (frameNames == null)
                {
                    CCLog.Log(
                        "cocos2d: CCAnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",
                        pElement.Key);
                    continue;
                }

                var frames = new List<CCAnimationFrame>(frameNames.Count);

                foreach (PlistObjectBase pObj in frameNames)
                {
                    string frameName = pObj.AsString;
                    CCSpriteFrame spriteFrame = frameCache.SpriteFrameByName(frameName);

                    if (spriteFrame == null)
                    {
                        CCLog.Log(
                            "cocos2d: CCAnimationCache: Animation '%s' refers to frame '%s' which is not currently in the CCSpriteFrameCache. This frame will not be added to the animation.",
                            pElement.Key, frameName);
                        continue;
                    }

                    var animFrame = new CCAnimationFrame();
                    animFrame.InitWithSpriteFrame(spriteFrame, 1, null);
                    frames.Add(animFrame);
                }

                if (frames.Count == 0)
                {
                    CCLog.Log(
                        "cocos2d: CCAnimationCache: None of the frames for animation '%s' were found in the CCSpriteFrameCache. Animation is not being added to the Animation Cache.",
                        pElement.Key);
                    continue;
                }
                else if (frames.Count != frameNames.Count)
                {
                    CCLog.Log(
                        "cocos2d: CCAnimationCache: An animation in your dictionary refers to a frame which is not in the CCSpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.",
                        pElement.Key);
                }

                CCAnimation animation = CCAnimation.Create(frames, delay, 1);

                SharedAnimationCache.AddAnimation(animation, pElement.Key);
            }
        }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:59,代码来源:CCAnimationCache.cs


示例18: LoadDictionaryContents

 private PlistDictionary LoadDictionaryContents(XmlReader reader, PlistDictionary dict)
 {
     Debug.Assert(reader.NodeType == XmlNodeType.Element && reader.LocalName == "key");
     while (!reader.EOF && reader.NodeType == XmlNodeType.Element)
     {
         string key = reader.ReadElementString();
         while (reader.NodeType != XmlNodeType.Element && reader.Read())
             if (reader.NodeType == XmlNodeType.EndElement)
                 throw new Exception(String.Format("No value found for key {0}", key));
         PlistObjectBase result = LoadFromNode(reader);
         if (result != null)
             dict.Add(key, result);
         reader.ReadToNextSibling("key");
     }
     return dict;
 }
开发者ID:AJSchultheis,项目名称:Dream.Build.Play.2012,代码行数:16,代码来源:PlistDocument.cs


示例19: ParseVersion2

        private void ParseVersion2(PlistDictionary animations)
        {
            CCSpriteFrameCache frameCache = CCSpriteFrameCache.SharedSpriteFrameCache;

            foreach (var pElement in animations)
            {
                string name = pElement.Key;
                PlistDictionary animationDict = pElement.Value.AsDictionary;

                int loops = animationDict["loops"].AsInt;
                bool restoreOriginalFrame = animationDict["restoreOriginalFrame"].AsBool;

                PlistArray frameArray = animationDict["frames"].AsArray;

                if (frameArray == null)
                {
                    CCLog.Log(
                        "cocos2d: CCAnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",
                        name);
                    continue;
                }

                // Array of AnimationFrames
                var array = new List<CCAnimationFrame>(frameArray.Count);

                foreach (PlistObjectBase pObj in frameArray)
                {
                    PlistDictionary entry = pObj.AsDictionary;

                    string spriteFrameName = entry["spriteframe"].AsString;
                    CCSpriteFrame spriteFrame = frameCache.SpriteFrameByName(spriteFrameName);

                    if (spriteFrame == null)
                    {
                        CCLog.Log(
                            "cocos2d: CCAnimationCache: Animation '%s' refers to frame '%s' which is not currently in the CCSpriteFrameCache. This frame will not be added to the animation.",
                            name, spriteFrameName);

                        continue;
                    }

                    float delayUnits = entry["delayUnits"].AsFloat;
                    PlistDictionary userInfo = entry["notification"].AsDictionary;

                    var animFrame = new CCAnimationFrame();
                    animFrame.InitWithSpriteFrame(spriteFrame, delayUnits, userInfo);

                    array.Add(animFrame);
                }

                float delayPerUnit = animationDict["delayPerUnit"].AsFloat;
                var animation = new CCAnimation();
                animation.InitWithAnimationFrames(array, delayPerUnit, (uint) loops);

                animation.RestoreOriginalFrame = restoreOriginalFrame;

                SharedAnimationCache.AddAnimation(animation, name);
            }
        }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:59,代码来源:CCAnimationCache.cs


示例20: MergeInfoPlist

		BuildResult MergeInfoPlist (IProgressMonitor monitor, MonoMacProject proj, MonoMacProjectConfiguration conf, 
		                            ProjectFile template, FilePath 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 ();
				
				//required keys that the user is likely to want to modify
				SetIfNotPresent (dict, "CFBundleName", proj.Name);
				SetIfNotPresent (dict, "CFBundleIdentifier", "com.yourcompany." + proj.Name);
				SetIfNotPresent (dict, " 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PloobsEngine类代码示例发布时间:2022-05-24
下一篇:
C# PlaylistItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap