当前位置: 首页>>代码示例>>C#>>正文


C# IDictionary.GetIfAvailable方法代码示例

本文整理汇总了C#中IDictionary.GetIfAvailable方法的典型用法代码示例。如果您正苦于以下问题:C# IDictionary.GetIfAvailable方法的具体用法?C# IDictionary.GetIfAvailable怎么用?C# IDictionary.GetIfAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDictionary的用法示例。


在下文中一共展示了IDictionary.GetIfAvailable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AndroidBillingTransaction

        public AndroidBillingTransaction(IDictionary _transactionInfo)
        {
            IDictionary _originalJSON = _transactionInfo[kOriginalJSON] as IDictionary;

            // Set raw response
            RawPurchaseData			= _originalJSON.ToJSON();

            // Assign values
            ProductIdentifier		= _originalJSON.GetIfAvailable<string>(kProductID);

            // Transaction time
            long _purchaseTimeInMillis		= _originalJSON.GetIfAvailable<long>(kPurchaseTime);
            System.DateTime _purchaseDate 	= _purchaseTimeInMillis.ToDateTimeFromJavaTime();
            TransactionDateUTC				= _purchaseDate.ToUniversalTime();
            TransactionDateLocal			= _purchaseDate.ToLocalTime();

            TransactionIdentifier			= GetPurchaseIdentifier(_originalJSON);
            int _purchaseState 				= _originalJSON.GetIfAvailable<int>(kPurchaseState);
            TransactionState				= GetConvertedPurchaseState(_purchaseState);

            // Data from _transactionInfo
            TransactionReceipt				= _transactionInfo.GetIfAvailable<string>(kSignature);

            //First find out if the transaction is valid
            string _validationState 		= _transactionInfo.GetIfAvailable<string>(kPurchaseValidationState);
            VerificationState 				= GetValidationState(_validationState);

            // Error
            Error							= _transactionInfo.GetIfAvailable<string>(kError);
        }
开发者ID:yourimpark,项目名称:soma_1st_yourimpark,代码行数:30,代码来源:AndroidBillingTransaction.cs

示例2: iOSSpecificProperties

			internal iOSSpecificProperties (IDictionary _jsonDict)
			{
				AlertAction	= _jsonDict.GetIfAvailable<string>(kAlertActionKey);
				HasAction	= _jsonDict.GetIfAvailable<bool>(kHasActionKey);
				BadgeCount	= _jsonDict.GetIfAvailable<int>(kBadgeCountKey);
				LaunchImage	= _jsonDict.GetIfAvailable<string>(kLaunchImageKey);
			}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:7,代码来源:CrossPlatformNotification.iOS.cs

示例3: RequestForImageFinished

		protected override void RequestForImageFinished (IDictionary _dataDict)
		{
			string		_error	= _dataDict.GetIfAvailable<string>(EditorGameCenter.kErrorKey);
			Texture2D	_image	= _dataDict.GetIfAvailable<Texture2D>(EditorGameCenter.kImageKey);

			DownloadImageFinished(_image, _error);
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:7,代码来源:EditorUser.cs

示例4: AndroidAddressBookContact

		public AndroidAddressBookContact (IDictionary _contactInfoJsontDict)
		{
			//If Given Name is available set it. Else pick from Display Name
			string _displayName = _contactInfoJsontDict.GetIfAvailable<string>(kDisplayName);
			string _givenName 	= _contactInfoJsontDict.GetIfAvailable<string>(kGivenName);
			string _familyName 	= _contactInfoJsontDict.GetIfAvailable<string>(kFamilyName);
		
			if(string.IsNullOrEmpty(_displayName))
			{
				_displayName = "";
			}

			FirstName 		= _givenName;
			LastName 		= _familyName;
			ImagePath		= _contactInfoJsontDict[kImagePath] as string;
			PhoneNumberList	= new List<string>();
			EmailIDList		= new List<string>();
			
			// Add phone numbers
			IList _phoneNumJsonList	= _contactInfoJsontDict[kPhoneNumList] as IList;
			foreach (string _phoneNo in _phoneNumJsonList)
				PhoneNumberList.Add(_phoneNo);
			
			// Add email id's
			IList _emailIDJsonList	= _contactInfoJsontDict[kEmailList] as IList;
			foreach (string _emailID in _emailIDJsonList)
				EmailIDList.Add(_emailID);
		}
开发者ID:georgex1,项目名称:bp-unity-nuevo-proyecto,代码行数:28,代码来源:AndroidAddressBookContact.cs

示例5: iOSTwitterSession

		public iOSTwitterSession (IDictionary _sessionJsonDict)
		{
			AuthToken		= _sessionJsonDict.GetIfAvailable<string>(kAuthToken);
			AuthTokenSecret	= _sessionJsonDict.GetIfAvailable<string>(kAuthTokenSecret);
			UserName		= _sessionJsonDict.GetIfAvailable<string>(kUserName);
			UserID			= _sessionJsonDict.GetIfAvailable<string>(kUserID);
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:7,代码来源:iOSTwitterSession.cs

示例6: iOSBillingTransaction

		public iOSBillingTransaction (IDictionary _transactionJsonDict)
		{
			ProductIdentifier		= _transactionJsonDict.GetIfAvailable<string>(kProductID);

			// Transaction date can be NULL/Empty
			string 	_tDateStr		= _transactionJsonDict.GetIfAvailable<string>(kTransactionDate);

			if (!string.IsNullOrEmpty(_tDateStr))
			{
				TransactionDateUTC		= _tDateStr.ToZuluFormatDateTimeUTC();
				TransactionDateLocal	= TransactionDateUTC.ToLocalTime();
			}

			// Transaction identifier
			TransactionIdentifier	= _transactionJsonDict.GetIfAvailable<string>(kTransactionID);

			// Transaction receipt can be NULL/Empty
			TransactionReceipt		= _transactionJsonDict.GetIfAvailable<string>(kTransactionReceipt);

			// Transactions state
			SKPaymentTransactionState _skTransactionState	= (SKPaymentTransactionState)int.Parse(_transactionJsonDict[kTransactionState].ToString());
			TransactionState		= ConvertToBillingTransactionState(_skTransactionState);

			// Verifications state
			VerificationState		= (eBillingTransactionVerificationState)int.Parse(_transactionJsonDict[kVerificationState].ToString());

			// Error can be NULL/Empty
			Error					= _transactionJsonDict.GetIfAvailable<string>(kError);		

			// Set response which is sent from Native side
			RawPurchaseData			= _transactionJsonDict.ToJSON();
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:32,代码来源:iOSBillingTransaction.cs

示例7: AndroidBillingProduct

		public AndroidBillingProduct (IDictionary _productJsonDict)
		{
			ProductIdentifier	= _productJsonDict[kProductID] as string;
			Name				= _productJsonDict[kTitle] as string;
			Description			= _productJsonDict[kDescription] as string;
			Price				= _productJsonDict.GetIfAvailable<long>(kPriceAmount)/1000000.0f;//As the value is in microns
			LocalizedPrice		= _productJsonDict.GetIfAvailable<string>(kLocalizedPrice);
		}
开发者ID:georgex1,项目名称:bp-unity-nuevo-proyecto,代码行数:8,代码来源:AndroidBillingProduct.cs

示例8: iOSBillingProduct

		public iOSBillingProduct (IDictionary _productJsonDict)
		{
			Name				= _productJsonDict.GetIfAvailable<string>(kTitle);
			ProductIdentifier	= _productJsonDict.GetIfAvailable<string>(kProductID);
			Description			= _productJsonDict.GetIfAvailable<string>(kDescription);
			Price				= _productJsonDict.GetIfAvailable<float>(kPrice);
			LocalizedPrice		= _productJsonDict.GetIfAvailable<string>(kLocalizedPrice);
		}
开发者ID:georgex1,项目名称:bp-unity-nuevo-proyecto,代码行数:8,代码来源:iOSBillingProduct.cs

示例9: AndroidTwitterUser

		public AndroidTwitterUser (IDictionary _userJsonDict)
		{
			UserID					= _userJsonDict[kUserID] as string;
			Name					= _userJsonDict[kName] as string;
			IsVerified				= _userJsonDict.GetIfAvailable<bool>(kIsVerified);
			IsProtected				= _userJsonDict.GetIfAvailable<bool>(kIsProtected);
			ProfileImageURL			= _userJsonDict[kProfileImageURL] as string;
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:8,代码来源:AndroidTwitterUser.cs

示例10: iOSTwitterUser

		public iOSTwitterUser (IDictionary _userJsonDict)
		{
			UserID					= _userJsonDict.GetIfAvailable<string>(kUserID);
			Name					= _userJsonDict.GetIfAvailable<string>(kName);
			IsVerified				= _userJsonDict.GetIfAvailable<bool>(kIsVerified);
			IsProtected				= _userJsonDict.GetIfAvailable<bool>(kIsProtected);
			ProfileImageURL			= _userJsonDict.GetIfAvailable<string>(kProfileImageURL);
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:8,代码来源:iOSTwitterUser.cs

示例11: iOSNotificationPayload

		public iOSNotificationPayload (IDictionary _payloadDict)
		{
			IDictionary _apsDict			= _payloadDict[kAPS] as IDictionary;
			string 		_userInfoKey		= NPSettings.Notification.iOS.UserInfoKey;
			iOSProperties					= new iOSSpecificProperties();

			// Read alert info
			if (_apsDict.Contains(kAlert))
			{
				object 	_alertUnknownType	= _apsDict[kAlert] as object;
			
				if (_alertUnknownType != null)
				{
					// String format
					if ((_alertUnknownType as string) != null)
					{
						AlertBody						= _alertUnknownType as string;
					}
					// Dictionary format
					else
					{
						IDictionary _alertDict			= _alertUnknownType as IDictionary;
						AlertBody						= _alertDict.GetIfAvailable<string>(kBody);
						string 		_alertAction		= _alertDict.GetIfAvailable<string>(kAction);

						if (string.IsNullOrEmpty(_alertAction))
						{
							iOSProperties.AlertAction	= null;
							iOSProperties.HasAction		= false;
						}
						else
						{
							iOSProperties.AlertAction	= _alertAction;
							iOSProperties.HasAction		= true;
						}

						// Launch image
						iOSProperties.LaunchImage		= _alertDict.GetIfAvailable<string>(kLaunchImage);
					}
				}
			}

			// Read sound, badge info
			iOSProperties.SoundName		=  _apsDict.GetIfAvailable<string>(kSound);
			iOSProperties.BadgeCount	=  _apsDict.GetIfAvailable<int>(kBadge);

			// Read user info
			if (_apsDict.Contains(_userInfoKey))
				UserInfo				= _payloadDict[_userInfoKey] as IDictionary;
			
			// Read fire date, repeat interval
			string 	_fireDateStr		= _payloadDict.GetIfAvailable<string>(kFireDate);

			if (!string.IsNullOrEmpty(_fireDateStr))
				FireDate				= _fireDateStr.ToDateTimeLocalUsingZuluFormat();

			RepeatInterval				= ConvertToRepeatInterval(_payloadDict.GetIfAvailable<CalendarUnit>(kRepeatIntervalKey));
		}
开发者ID:georgex1,项目名称:bp-unity-nuevo-proyecto,代码行数:58,代码来源:iOSNotificationPayload.cs

示例12: AndroidUser

		internal AndroidUser (IDictionary _userProfileData)
		{
			if(_userProfileData != null)
			{
				m_identifier		= _userProfileData.GetIfAvailable<string>(kIdentifier);
				m_name				= _userProfileData.GetIfAvailable<string>(kName);
				m_imagePath			= _userProfileData.GetIfAvailable<string>(kHighResImageURL);
			}
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:9,代码来源:AndroidUser.cs

示例13: LoadUsersFinished

		protected override void LoadUsersFinished (IDictionary _dataDict)
		{
			EGCUser[]			_gcUsers			= _dataDict.GetIfAvailable<EGCUser[]>(EditorGameCenter.kUsersListKey);
			string 				_error				= _dataDict.GetIfAvailable<string>(EditorGameCenter.kErrorKey);
			User[]				_newUsers			= EditorUser.ConvertUsersList(_gcUsers);
			
			// Invoke handler
			LoadUsersFinished(_newUsers, _error);
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:9,代码来源:GameServicesEditor.Events.cs

示例14: LoadAchievementsFinished

		protected override void LoadAchievementsFinished (IDictionary _dataDict)
		{
			EGCAchievement[]			_gcAchievements			= _dataDict.GetIfAvailable<EGCAchievement[]>(EditorGameCenter.kAchievementsListKey);
			string 						_error					= _dataDict.GetIfAvailable<string>(EditorGameCenter.kErrorKey);
			Achievement[]				_newAchievements		= EditorAchievement.ConvertAchievementsList(_gcAchievements);
			
			// Invoke handler
			LoadAchievementsFinished(_newAchievements, _error);
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:9,代码来源:GameServicesEditor.Events.cs

示例15: LoadAchievementsFinished

		protected override void LoadAchievementsFinished (IDictionary _dataDict)
		{
			IList			_achievementsJSONList	= _dataDict.GetIfAvailable<IList>(kAchievementsListKey);
			string 			_error					= _dataDict.GetIfAvailable<string>(GameServicesIOS.kNativeMessageErrorKey);
			Achievement[]	_newAchievements		= iOSAchievement.ConvertAchievementsList(_achievementsJSONList);
			
			// Invoke handler
			LoadAchievementsFinished(_newAchievements, _error);
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:9,代码来源:GameServicesIOS.Events.cs


注:本文中的IDictionary.GetIfAvailable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。