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

C# IResource类代码示例

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

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



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

示例1: ProfilingDialog

 /// <summary>
 /// Initializes a new instance of the ProfilingDialog class
 /// </summary>
 /// <param name="item"></param>
 /// <param name="resourceId"></param>
 /// <param name="connection"></param>
 public ProfilingDialog(IResource item, string resourceId, IServerConnection connection)
     : this()
 {
     m_connection = connection;
     m_item = item;
     m_resourceId = resourceId;
 }
开发者ID:kanbang,项目名称:Colt,代码行数:13,代码来源:ProfilingDialog.cs


示例2: Location

 /// <summary>
 /// Initializes a new instance of the Location class.
 /// </summary>
 /// <param name="resource"></param>
 /// <param name="source"></param>
 public Location(IResource resource, object source)
 {
     //TODO: look into re-enabling this since resource *is* NULL when parsing config classes vs. acquiring IResources
     //AssertUtils.ArgumentNotNull(resource, "resource");
     this.resource = resource;
     this.source = source;
 }
开发者ID:likesea,项目名称:spring.net,代码行数:12,代码来源:Location.cs


示例3: EncodedResource

 /// <summary>
 /// Create an encoded resource using the specified encoding.
 /// </summary>
 /// <param name="resource">the resource to read from. Must not be <c>null</c></param>
 /// <param name="encoding">the encoding to use. If <c>null</c>, encoding will be autodetected.</param>
 /// <param name="autoDetectEncoding">whether to autoDetect encoding from byte-order marks (<see cref="StreamReader(Stream, Encoding, bool)"/>)</param>
 public EncodedResource(IResource resource, Encoding encoding, bool autoDetectEncoding)
 {
     AssertUtils.ArgumentNotNull(resource, "resource");
     this.resource = resource;
     this.encoding = encoding;
     this.autoDetectEncoding = autoDetectEncoding;
 }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:13,代码来源:EncodedResource.cs


示例4: Validate

        /// <summary>
        /// Validats the specified resources for common issues associated with this
        /// resource type
        /// </summary>
        /// <param name="context"></param>
        /// <param name="resource"></param>
        /// <param name="recurse"></param>
        /// <returns></returns>
        public virtual ValidationIssue[] Validate(ResourceValidationContext context, IResource resource, bool recurse)
        {
            if (!resource.GetResourceTypeDescriptor().Equals(this.SupportedResourceAndVersion))
                return null;

            return ValidateBase(context, resource, recurse);
        }
开发者ID:kanbang,项目名称:Colt,代码行数:15,代码来源:BaseLayerDefinitionValidator.cs


示例5: AbstractInterpreter

        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractInterpreter"/> class
        /// from an The <see cref="IResource"/>.
        /// </summary>
        /// <param name="source">The <see cref="IResource"/>.</param>
        public AbstractInterpreter(IResource source)
        {
            Contract.Require.That(source, Is.Not.Null).When("retrieving argument IResource in AbstractInterpreter constructor");

            resource = source;

        }
开发者ID:techvenky,项目名称:mybatisnet,代码行数:12,代码来源:AbstractInterpreter.cs


示例6: GetURLInternal

		private string GetURLInternal(IResource resource)
		{
			IResourceLocation location = resource.Location;
			string path;
			if (location is TypeLocation)
			{
				TypeLocation tl = location as TypeLocation;
				path = String.Format("{2}/{3}{0}/{1}{4}", HttpUtility.UrlPathEncode(tl.ProxyType.Assembly.GetName().Name), HttpUtility.UrlPathEncode(tl.ProxyType.FullName), AppPath, ResourceHttpHandler.AssemblyPath, ResourceHttpHandler.Extension);
			}
			else if (location is EmbeddedLocation)
			{
				EmbeddedLocation el = location as EmbeddedLocation;
				path = String.Format("{2}/{3}{0}/{1}{4}", HttpUtility.UrlPathEncode(el.Assembly.GetName().Name), HttpUtility.UrlPathEncode(el.ResourceName), AppPath, ResourceHttpHandler.AssemblyPath, ResourceHttpHandler.Extension);
			}
			else if (location is VirtualPathLocation)
			{
				VirtualPathLocation vl = location as VirtualPathLocation;
				path = HttpUtility.UrlPathEncode(vl.VirtualPath);
				if (resource is IProxyResource) path += ResourceHttpHandler.Extension;
			}
			else if (location is ExternalLocation)
			{
				ExternalLocation el = location as ExternalLocation;
				return el.Uri.ToString();
			}
			else
				throw new Exception("Unknown IResourceLocationType");
			return path + "?" + ToHex(resource.Version);
		}
开发者ID:sebmarkbage,项目名称:calyptus.resourcemanager,代码行数:29,代码来源:HttpHandlerURLFactory.cs


示例7: DecorateClass

 public override void DecorateClass(IResource resource,
                           IMethod request,
                           CodeTypeDeclaration requestClass,
                           CodeTypeDeclaration resourceClass)
 {
     requestClass.Members.Add(CreateRequiredConstructor(resourceClass, request, false));
 }
开发者ID:JANCARLO123,项目名称:google-apis,代码行数:7,代码来源:UploadConstructorDecorator.cs


示例8: listViewModels_SelectedIndexChanged

 private void listViewModels_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewModels.SelectedItems.Count > 0)
     {
         selectedItem = (IResource)listViewModels.SelectedItems[0].Tag;
     }
 }
开发者ID:MattVitelli,项目名称:IslandAdventure,代码行数:7,代码来源:ModelSelector.cs


示例9: Parse

		/// <summary>
		/// Parses a script from the specified resource.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		/// <param name="resource">The resource wcich to parse as script.</param>
		/// <returns>Returns the parsed script.</returns>
		/// <exception cref="ParseScriptException">Thrown when an exception occurres while parsing the script.</exception>
		public IExpressionScript Parse(IMansionContext context, IResource resource)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (resource == null)
				throw new ArgumentNullException("resource");

			// open the script
			var cacheKey = ResourceCacheKey.Create(resource);
			return cachingService.GetOrAdd(
				context,
				cacheKey,
				() =>
				{
					// get the phrase
					string rawPhrase;
					using (var resourceStream = resource.OpenForReading())
					using (var reader = resourceStream.Reader)
						rawPhrase = reader.ReadToEnd();

					// let someone else do the heavy lifting
					var phrase = ParsePhrase(context, rawPhrase);

					// create the cache object
					return new CachedPhrase(phrase);
				});
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:35,代码来源:ExpressionScriptService.cs


示例10: LoadMidi

 public bool LoadMidi(IResource midiFile)
 {
     if (playing == true)
         return false;
     LoadMidiFile(new MidiFile(midiFile));
     return true;
 }
开发者ID:eriser,项目名称:Cross-Platform-Csharp-Synth-with-OpenAL,代码行数:7,代码来源:MidiFileSequencer.cs


示例11: SerializeResourceForStudio

        /// <summary>
        /// Strips for ship.
        /// </summary>
        /// <param name="resource">The resource.</param>
        /// <returns></returns>
        public SerializableResource SerializeResourceForStudio(IResource resource)
        {

            // convert the fliping errors due to json issues in c# ;(
            var errors = new List<ErrorInfo>();
            var parseErrors = resource.Errors;
            if(parseErrors != null)
            {
                errors.AddRange(parseErrors.Select(error => (error as ErrorInfo)));
            }

            var datalist = "<DataList></DataList>";

            if(resource.DataList != null)
            {
                var replace = resource.DataList.Replace("\"", GlobalConstants.SerializableResourceQuote);
                datalist = replace.Replace("'", GlobalConstants.SerializableResourceSingleQuote).ToString();
            }

            return new SerializableResource
            {
                Inputs = resource.Inputs,
                Outputs = resource.Outputs,
                ResourceCategory = resource.ResourcePath,
                ResourceID = resource.ResourceID,
                VersionInfo = resource.VersionInfo,
                ResourceName = resource.ResourceName,
                Permissions = AuthorizationService.GetResourcePermissions(resource.ResourceID),
                ResourceType = resource.ResourceType,
                IsValid = resource.IsValid,
                DataList = datalist,
                Errors = errors,
                IsNewResource = resource.IsNewResource
            };
        }
开发者ID:ndubul,项目名称:Chillas,代码行数:40,代码来源:FindResourceHelper.cs


示例12: ThrowsSecurityExceptionIfUserIsNotLoggedOn

 public Spec ThrowsSecurityExceptionIfUserIsNotLoggedOn(string input, IResource output)
 {
     return
         new Spec()
         .If(UserIsNotLoggedOn)
         .Throws<SecurityException>();
 }
开发者ID:lynchjames,项目名称:ScotAlt.Net-Pex-QuickCheck,代码行数:7,代码来源:NavigateSpecs.cs


示例13: LoadBank

 public void LoadBank(IResource bankFile)
 {
     if (!bankFile.ReadAllowed())
         throw new Exception("The bank file provided does not have read access.");
     bank.Clear();
     assets.PatchAssetList.Clear();
     assets.SampleAssetList.Clear();
     bankName = string.Empty;
     comment = string.Empty;
     switch (IOHelper.GetExtension(bankFile.GetName()).ToLower())
     {
         case ".bank":
             bankName = IOHelper.GetFileNameWithoutExtension(bankFile.GetName());
             LoadMyBank(bankFile.OpenResourceForRead());
             break;
         case ".sf2":
             bankName = "SoundFont";
             LoadSf2(bankFile.OpenResourceForRead());
             break;
         default:
             throw new Exception("Invalid bank resource was provided. An extension must be included in the resource name.");
     }
     assets.PatchAssetList.TrimExcess();
     assets.SampleAssetList.TrimExcess();
 }
开发者ID:eriser,项目名称:Cross-Platform-Csharp-Synth-with-OpenAL,代码行数:25,代码来源:PatchBank.cs


示例14: DecorateClass

        public void DecorateClass(IResource resource,
            string className,
            CodeTypeDeclaration resourceClass,
            ResourceClassGenerator generator,
            string serviceClassName,
            IEnumerable<IResourceDecorator> allDecorators)
        {
            var gen = new ResourceGenerator(className, objectTypeProvider, commentCreator);
            foreach (var method in resource.Methods.Values)
            {
                logger.Debug("Adding RequestObject Method {0}.{1}", resource.Name, method.Name);

                // Add the default request method to the class:
                CodeTypeMember convenienceMethod = gen.CreateMethod(resourceClass, resource, method, false);
                if (convenienceMethod != null)
                {
                    resourceClass.Members.Add(convenienceMethod);
                }

                // Add the request method specifiying all parameters (also optional ones) to the class:
                if (AddOptionalParameters && method.HasOptionalParameters())
                {
                    convenienceMethod = gen.CreateMethod(resourceClass, resource, method, true);
                    if (convenienceMethod != null)
                    {
                        resourceClass.Members.Add(convenienceMethod);
                    }
                }
            }
        }
开发者ID:nick0816,项目名称:LoggenCSG,代码行数:30,代码来源:RequestMethodResourceDecorator.cs


示例15: ConvertRecursively

        private static void ConvertRecursively(IResource currentResource, JObject node, JsonSerializer serializer)
        {
            if (currentResource == null)
            {
                return;
            }

            var currentResourceType = currentResource.GetType();
            var readableProperties = GetReadablePropertyInfos(currentResourceType);

            var nonResourceProperties = readableProperties.Where(IsNeitherResourceOrReservedProperty).ToList();
            var resourceProperties = readableProperties.Where(IsResourceProperty).ToList();

            node.Add(ReservedPropertyNames.Relations, JObject.FromObject(currentResource.Relations, serializer));
            var embeddedResourceObject = new JObject();
            node.Add(ReservedPropertyNames.EmbeddedResources, embeddedResourceObject);

            foreach (var resourceProperty in resourceProperties)
            {                
                var embeddedResourceNodeValue = new JObject();

                ConvertRecursively((IResource)resourceProperty.GetValue(currentResource), embeddedResourceNodeValue, serializer);
                embeddedResourceObject.Add(ToCamelCase(resourceProperty.Name), embeddedResourceNodeValue);
            }

            if (IsCollectionResourceType(currentResourceType))
            {
                var currentResourceDynamic = (dynamic) currentResource;
                var jArray = new JArray();
                string name = "";
                foreach (IResource resourceItem in currentResourceDynamic.Items)
                {
                    var embeddedResourceNodeValue = new JObject();
                    ConvertRecursively(resourceItem, embeddedResourceNodeValue, serializer);
                    jArray.Add(embeddedResourceNodeValue);
                    name =  resourceItem.GetType().Name;
                }

                // Remove the "Resource" by convention.
                if (name.EndsWith("Resource"))
                {
                    name = name.Remove(name.LastIndexOf("Resource", StringComparison.Ordinal));
                }

                embeddedResourceObject.Add(ToCamelCase(name), jArray);
            }

            foreach (var nonResourceProperty in nonResourceProperties)
            {
                var value = nonResourceProperty.GetValue(currentResource);
                if (value != null && value.GetType().GetTypeInfo().IsClass && value.GetType() != typeof(string))
                {
                    node.Add(ToCamelCase(nonResourceProperty.Name), JToken.FromObject(value, serializer));
                }
                else
                {
                    node.Add(ToCamelCase(nonResourceProperty.Name), new JValue(value));
                }                
            }
        }
开发者ID:olohmann,项目名称:Lohmann.HALight,代码行数:60,代码来源:ResourceConverter.cs


示例16: GetURL

		public string GetURL(IResource resource)
		{
			string url;
			_lock.AcquireReaderLock(3000);
			try
			{
				if (!_urlCache.TryGetValue(resource, out url))
				{
					var c = _lock.UpgradeToWriterLock(3000);
					try
					{
						_urlCache.Add(resource, url = GetURLInternal(resource));
					}
					finally
					{
						_lock.DowngradeFromWriterLock(ref c);
					}
				}
			}
			finally
			{
				_lock.ReleaseReaderLock();
			}
			IProxyResource pr = resource as IProxyResource;
			if (!(resource.Location is ExternalLocation) && pr != null && (pr.CultureSensitive || pr.CultureUISensitive))
			{
				url += "-";
				if (pr.CultureSensitive)
					url += CultureInfo.CurrentCulture.LCID.ToString("x");
				url += "-";
				if (pr.CultureUISensitive)
					url += CultureInfo.CurrentCulture.LCID.ToString("x");
			}
			return url;
		}
开发者ID:sebmarkbage,项目名称:calyptus.resourcemanager,代码行数:35,代码来源:HttpHandlerURLFactory.cs


示例17: HtmlProxy

        public HtmlProxy(FileLocation location)
		{
            _includes = new IResource[0];
            _references = _builds = _includes;
			_location = location;
			_version = ChecksumHelper.GetCombinedChecksum(location.Version, _includes, _builds);
		}
开发者ID:sebmarkbage,项目名称:calyptus.resourcemanager,代码行数:7,代码来源:HtmlProxy.cs


示例18: Upload

        public string Upload(IResource resource, string storeName)
        {
            // Authenticate the application (if not authenticated) and load the OAuth token
            // if (!File.Exists(OAuthTokenFileName))
            // {
            //     AuthorizeAppOAuth(dropboxServiceProvider);
            // }

            // OAuthToken oauthAccessToken = LoadOAuthToken();

            // Login in Dropbox
            IDropbox dropbox = this.dropboxServiceProvider
                .GetApi(AuthorizationConstants.DropBoxOAuthAccessTokenValue, AuthorizationConstants.DropBoxOAuthAccessTokenSecret);

            // Display user name (from his profile)
            DropboxProfile profile = dropbox.GetUserProfileAsync().Result;

            // Upload a file
            Entry uploadFileEntry = dropbox.UploadFileAsync(resource, storeName).Result;

            // Share a file
            DropboxLink sharedUrl = dropbox.GetShareableLinkAsync(uploadFileEntry.Path).Result;

            var link = dropbox.GetMediaLinkAsync(uploadFileEntry.Path).Result;
            return link.Url;
        }
开发者ID:EosTA,项目名称:Restful,代码行数:26,代码来源:DropBoxClient.cs


示例19: Process

		public XmlNode Process(IResource resource)
		{
			try
			{
				using (resource)
				{
					var doc = new XmlDocument();
					using (var stream = resource.GetStreamReader())
					{
						doc.Load(stream);
					}

					engine.PushResource(resource);

					var element = Process(doc.DocumentElement);

					engine.PopResource();

					return element;
				}
			}
			catch (ConfigurationProcessingException)
			{
				throw;
			}
			catch (Exception ex)
			{
				var message = String.Format("Error processing node resource {0}", resource);

				throw new ConfigurationProcessingException(message, ex);
			}
		}
开发者ID:janv8000,项目名称:Windsor,代码行数:32,代码来源:XmlProcessor.cs


示例20: Enlist

		public virtual void Enlist(IResource resource)
		{
			logger.DebugFormat("Enlisting resource {0}", resource);

			if (resource == null) throw new ArgumentNullException("resource");

			// We can't add the resource more than once
			if (resources.Contains(resource)) return;

			if (Status == TransactionStatus.Active)
			{
				try
				{
					resource.Start();
				}
				catch(Exception ex)
				{
					state = TransactionStatus.Invalid;

					logger.Error("Enlisting resource failed", ex);

					throw;
				}
			}

			resources.Add(resource);

			logger.DebugFormat("Resource enlisted successfully {0}", resource);
		}
开发者ID:ralescano,项目名称:castle,代码行数:29,代码来源:AbstractTransaction.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IResourceAccessor类代码示例发布时间:2022-05-24
下一篇:
C# IResolver类代码示例发布时间: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