本文整理汇总了C#中ResourceAttributes类的典型用法代码示例。如果您正苦于以下问题:C# ResourceAttributes类的具体用法?C# ResourceAttributes怎么用?C# ResourceAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceAttributes类属于命名空间,在下文中一共展示了ResourceAttributes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateResource
/// <summary>
/// Creates a resource, given a metadata block of values.
/// </summary>
/// <param name="attribs"></param>
/// <returns></returns>
public static MediaResource CreateResource(ResourceAttributes attribs)
{
MediaResource newRes = new MediaResource();
SetCommonAttributes(newRes, attribs);
return newRes;
}
开发者ID:Scannow,项目名称:SWYH,代码行数:12,代码来源:ResourceBuilder.cs
示例2: ResWriterData
internal ResWriterData(ResourceWriter resWriter, Stream memoryStream, string strName, string strFileName, string strFullFileName, ResourceAttributes attribute)
{
this.m_resWriter = resWriter;
this.m_memoryStream = memoryStream;
this.m_strName = strName;
this.m_strFileName = strFileName;
this.m_strFullFileName = strFullFileName;
this.m_nextResWriter = null;
this.m_attribute = attribute;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:ResWriterData.cs
示例3: SetCommonAttributes
/// <summary>
/// Constructors use this method to set the properties of a resource.
/// Programmers can use this method also, but the method is not
/// guaranteed to be thread safe. As a general rule, programmers shouldn't
/// be changing the values of resources after they've instantiated them.
/// </summary>
/// <param name="res"></param>
/// <param name="attribs"></param>
public static void SetCommonAttributes(MediaResource res, ResourceAttributes attribs)
{
res.ProtocolInfo = attribs.protocolInfo;
res.ContentUri = attribs.contentUri.Trim();
if ((attribs.importUri != null) && (attribs.importUri != ""))
{
res[T[_RESATTRIB.importUri]] = attribs.importUri;
}
TransferValue("bitrate", res, attribs);
TransferValue("bitsPerSample", res, attribs);
TransferValue("colorDepth", res, attribs);
TransferValue("duration", res, attribs);
TransferValue("nrAudioChannels", res, attribs);
TransferValue("protection", res, attribs);
TransferValue("resolution", res, attribs);
TransferValue("sampleFrequency", res, attribs);
TransferValue("size", res, attribs);
}
开发者ID:Scannow,项目名称:SWYH,代码行数:28,代码来源:ResourceBuilder.cs
示例4: AddResourceFile
public void AddResourceFile(string name, string fileName, ResourceAttributes attribs)
{
ResourceFile resfile = new ResourceFile();
resfile.Name = name;
resfile.FileName = fileName;
resfile.Attributes = attribs;
resourceFiles.Add(resfile);
}
开发者ID:Semogj,项目名称:ikvm-fork,代码行数:8,代码来源:AssemblyBuilder.cs
示例5: DefineManifestResource
public void DefineManifestResource (string name, Stream stream, ResourceAttributes attribute) {
if (name == null)
throw new ArgumentNullException ("name");
if (name == String.Empty)
throw new ArgumentException ("name cannot be empty");
if (stream == null)
throw new ArgumentNullException ("stream");
if (transient)
throw new InvalidOperationException ("The module is transient");
if (!assemblyb.IsSave)
throw new InvalidOperationException ("The assembly is transient");
if (resources != null) {
MonoResource[] new_r = new MonoResource [resources.Length + 1];
System.Array.Copy(resources, new_r, resources.Length);
resources = new_r;
} else {
resources = new MonoResource [1];
}
int p = resources.Length - 1;
resources [p].name = name;
resources [p].attrs = attribute;
resources [p].stream = stream;
}
开发者ID:carrie901,项目名称:mono,代码行数:24,代码来源:ModuleBuilder.cs
示例6: LinkedResource
public LinkedResource (string name, string file, bool isPrivate)
{
this.name = name;
this.file = file;
this.attribute = isPrivate ? ResourceAttributes.Private : ResourceAttributes.Public;
}
开发者ID:Ein,项目名称:monodevelop,代码行数:6,代码来源:driver.cs
示例7: DefineResourceNoLock
private IResourceWriter DefineResourceNoLock(string name, string description, ResourceAttributes attribute)
{
if (this.IsTransient())
{
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
}
if (name == null)
{
throw new ArgumentNullException("name");
}
if (name.Length == 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
}
if (!this.m_assemblyBuilder.IsPersistable())
{
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
}
this.m_assemblyBuilder.m_assemblyData.CheckResNameConflict(name);
MemoryStream stream = new MemoryStream();
ResourceWriter resWriter = new ResourceWriter(stream);
ResWriterData data = new ResWriterData(resWriter, stream, name, string.Empty, string.Empty, attribute) {
m_nextResWriter = this.m_moduleData.m_embeddedRes
};
this.m_moduleData.m_embeddedRes = data;
return resWriter;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:ModuleBuilder.cs
示例8: DefineResource
public IResourceWriter DefineResource (string name, string description, ResourceAttributes attribute)
{
if (name == null)
throw new ArgumentNullException ("name");
if (name == String.Empty)
throw new ArgumentException ("name cannot be empty");
if (transient)
throw new InvalidOperationException ("The module is transient");
if (!assemblyb.IsSave)
throw new InvalidOperationException ("The assembly is transient");
ResourceWriter writer = new ResourceWriter (new MemoryStream ());
if (resource_writers == null)
resource_writers = new Hashtable ();
resource_writers [name] = writer;
// The data is filled out later
if (resources != null) {
MonoResource[] new_r = new MonoResource [resources.Length + 1];
System.Array.Copy(resources, new_r, resources.Length);
resources = new_r;
} else {
resources = new MonoResource [1];
}
int p = resources.Length - 1;
resources [p].name = name;
resources [p].attrs = attribute;
return writer;
}
开发者ID:carrie901,项目名称:mono,代码行数:29,代码来源:ModuleBuilder.cs
示例9: AddResourceFile
public void AddResourceFile(string name, string file, ResourceAttributes attribute)
{
IResourceWriter rw = _myModule.DefineResource(Path.GetFileName(file), name, attribute);
string ext = Path.GetExtension(file);
if(String.Equals(ext, ".resources", StringComparison.OrdinalIgnoreCase)) {
ResourceReader rr = new ResourceReader(file);
using (rr) {
System.Collections.IDictionaryEnumerator de = rr.GetEnumerator();
while (de.MoveNext()) {
string key = de.Key as string;
rw.AddResource(key, de.Value);
}
}
} else {
rw.AddResource(name, File.ReadAllBytes(file));
}
}
开发者ID:robertlj,项目名称:IronScheme,代码行数:19,代码来源:AssemblyGen.cs
示例10: DefineResourceNoLock
private IResourceWriter DefineResourceNoLock(string name, string description, string fileName, ResourceAttributes attribute)
{
ResourceWriter writer;
string fullPath;
if (name == null)
{
throw new ArgumentNullException("name");
}
if (name.Length == 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), name);
}
if (fileName == null)
{
throw new ArgumentNullException("fileName");
}
if (fileName.Length == 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "fileName");
}
if (!string.Equals(fileName, Path.GetFileName(fileName)))
{
throw new ArgumentException(Environment.GetResourceString("Argument_NotSimpleFileName"), "fileName");
}
this.m_assemblyData.CheckResNameConflict(name);
this.m_assemblyData.CheckFileNameConflict(fileName);
if (this.m_assemblyData.m_strDir == null)
{
fullPath = Path.Combine(Environment.CurrentDirectory, fileName);
writer = new ResourceWriter(fullPath);
}
else
{
fullPath = Path.Combine(this.m_assemblyData.m_strDir, fileName);
writer = new ResourceWriter(fullPath);
}
fullPath = Path.GetFullPath(fullPath);
fileName = Path.GetFileName(fullPath);
this.m_assemblyData.AddResWriter(new ResWriterData(writer, null, name, fileName, fullPath, attribute));
return writer;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:41,代码来源:AssemblyBuilder.cs
示例11: AddResourceFile
public void AddResourceFile(string name, string fileName, ResourceAttributes attribute)
{
lock (this.SyncRoot)
{
this.AddResourceFileNoLock(name, fileName, attribute);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:AssemblyBuilder.cs
示例12: AddResourceFile
private void AddResourceFile (string name, string fileName, ResourceAttributes attribute, bool fileNeedsToExists)
{
check_name_and_filename (name, fileName, fileNeedsToExists);
// Resource files are created/searched under the assembly storage
// directory
if (dir != null)
fileName = Path.Combine (dir, fileName);
if (resources != null) {
MonoResource[] new_r = new MonoResource [resources.Length + 1];
System.Array.Copy(resources, new_r, resources.Length);
resources = new_r;
} else {
resources = new MonoResource [1];
}
int p = resources.Length - 1;
resources [p].name = name;
resources [p].filename = fileName;
resources [p].attrs = attribute;
}
开发者ID:sjlangley,项目名称:mono,代码行数:21,代码来源:AssemblyBuilder.cs
示例13: TransferValue
/// <summary>
/// <para>
/// This method allows a generalized implementation of transfering
/// a value from a
/// <see cref="ResourceBuilder.ResourceAttributes"/>
/// to a
/// <see cref="MediaResource"/>
/// object.
/// </para>
///
/// <para>
/// Classes derived from the
/// <see cref="ResourceBuilder.ResourceAttributes"/>
/// class have fields, with names that match against fields in a
/// <see cref="MediaResource"/>
/// object.
/// </para>
/// </summary>
/// <param name="attribName">name of the attribute to transfer</param>
/// <param name="res">The
/// <see cref="MediaResource"/>
/// object to transfer to.
/// </param>
/// <param name="attribs">
/// The
/// <see cref="ResourceBuilder.ResourceAttributes"/>
/// object to transfer from.
/// </param>
private static void TransferValue(string attribName, MediaResource res, ResourceAttributes attribs)
{
object val = null;
System.Type type = attribs.GetType();
FieldInfo info = type.GetField(attribName);
if (info != null)
{
val = info.GetValue(attribs);
if (val != null)
{
IValueType ivt = val as IValueType;
bool ok = true;
if (ivt != null)
{
ok = ivt.IsValid;
}
if (ok)
{
//res.m_Attributes[attribName] = val;
res[attribName] = val;
}
}
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:55,代码来源:ResourceBuilder.cs
示例14: AddResourceFileNoLock
private void AddResourceFileNoLock(string name, string fileName, ResourceAttributes attribute)
{
string fullPath;
if (name == null)
{
throw new ArgumentNullException("name");
}
if (name.Length == 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), name);
}
if (fileName == null)
{
throw new ArgumentNullException("fileName");
}
if (fileName.Length == 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), fileName);
}
if (!string.Equals(fileName, Path.GetFileName(fileName)))
{
throw new ArgumentException(Environment.GetResourceString("Argument_NotSimpleFileName"), "fileName");
}
this.m_assemblyData.CheckResNameConflict(name);
this.m_assemblyData.CheckFileNameConflict(fileName);
if (this.m_assemblyData.m_strDir == null)
{
fullPath = Path.Combine(Environment.CurrentDirectory, fileName);
}
else
{
fullPath = Path.Combine(this.m_assemblyData.m_strDir, fileName);
}
fullPath = Path.GetFullPath(fullPath);
fileName = Path.GetFileName(fullPath);
if (!File.Exists(fullPath))
{
throw new FileNotFoundException(Environment.GetResourceString("IO.FileNotFound_FileName", new object[] { fileName }), fileName);
}
this.m_assemblyData.AddResWriter(new ResWriterData(null, null, name, fileName, fullPath, attribute));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:41,代码来源:AssemblyBuilder.cs
示例15: DefineResource
/**********************************************
*
* Define embedded managed resource to be stored in this module
*
*
**********************************************/
/// <include file='doc\ModuleBuilder.uex' path='docs/doc[@for="ModuleBuilder.DefineResource1"]/*' />
public IResourceWriter DefineResource(
String name,
String description,
ResourceAttributes attribute)
{
CodeAccessPermission.DemandInternal(PermissionType.ReflectionEmit);
try
{
Enter();
BCLDebug.Log("DYNIL","## DYNIL LOGGING: ModuleBuilder.DefineResource( " + name + ")");
if (IsTransient())
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
if (name == null)
throw new ArgumentNullException("name");
if (name.Length == 0)
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
Assembly assembly = this.Assembly;
if (assembly is AssemblyBuilder)
{
AssemblyBuilder asmBuilder = (AssemblyBuilder)assembly;
if (asmBuilder.IsPersistable())
{
asmBuilder.m_assemblyData.CheckResNameConflict(name);
MemoryStream stream = new MemoryStream();
ResourceWriter resWriter = new ResourceWriter(stream);
ResWriterData resWriterData = new ResWriterData( resWriter, stream, name, String.Empty, String.Empty, attribute);
// chain it to the embedded resource list
resWriterData.m_nextResWriter = m_moduleData.m_embeddedRes;
m_moduleData.m_embeddedRes = resWriterData;
return resWriter;
}
else
{
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
}
}
else
{
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
}
}
finally
{
Exit();
}
}
开发者ID:ArildF,项目名称:masters,代码行数:60,代码来源:modulebuilder.cs
示例16: EmbedResource
internal void EmbedResource (string name, byte[] blob, ResourceAttributes attribute)
{
if (resources != null) {
MonoResource[] new_r = new MonoResource [resources.Length + 1];
System.Array.Copy(resources, new_r, resources.Length);
resources = new_r;
} else {
resources = new MonoResource [1];
}
int p = resources.Length - 1;
resources [p].name = name;
resources [p].attrs = attribute;
resources [p].data = blob;
}
开发者ID:runefs,项目名称:Marvin,代码行数:14,代码来源:AssemblyBuilder.cs
示例17: DefineResource
public IResourceWriter DefineResource(String name, String description, ResourceAttributes attribute)
{
// Define embedded managed resource to be stored in this module
lock(SyncRoot)
{
return DefineResourceNoLock(name, description, attribute);
}
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:8,代码来源:ModuleBuilder.cs
示例18: DefineResource
public IResourceWriter DefineResource(string name, string description, string fileName, ResourceAttributes attribute)
{
// FXBUG we ignore the description, because there is no such thing
string fullPath = fileName;
if (dir != null)
{
fullPath = Path.Combine(dir, fileName);
}
ResourceWriter rw = new ResourceWriter(fullPath);
ResourceFile resfile;
resfile.Name = name;
resfile.FileName = fileName;
resfile.Attributes = attribute;
resfile.Writer = rw;
resourceFiles.Add(resfile);
return rw;
}
开发者ID:Semogj,项目名称:ikvm-fork,代码行数:18,代码来源:AssemblyBuilder.cs
示例19: DefineResource
public IResourceWriter DefineResource (string name, string description,
string fileName, ResourceAttributes attribute)
{
IResourceWriter writer;
// description seems to be ignored
AddResourceFile (name, fileName, attribute, false);
writer = new ResourceWriter (fileName);
if (resource_writers == null)
resource_writers = new ArrayList ();
resource_writers.Add (writer);
return writer;
}
开发者ID:sjlangley,项目名称:mono,代码行数:13,代码来源:AssemblyBuilder.cs
示例20: AddResourceFile
/// <summary>Enbdeds resource into assembly</summary>
/// <param name="builder"><see cref="ModuleBuilder"/> to embede resource in</param>
/// <param name="name">Name of the resource</param>
/// <param name="path">File to obtain resource from</param>
/// <param name="attributes">Defines resource visibility</param>
//DefineResource
// Exceptions:
// System.ArgumentException:
// name has been previously defined or if there is another file in the assembly
// named fileName.-or- The length of name is zero.-or- The length of fileName
// is zero.-or- fileName includes a path.
//
// System.ArgumentNullException:
// name or fileName is null.
//
// System.Security.SecurityException:
// The caller does not have the required permission.
//ResourceReader
// Exceptions:
// System.ArgumentException:
// The stream is not readable.
//
// System.ArgumentNullException:
// The stream parameter is null.
//
// System.IO.IOException:
// An I/O error has occurred while accessing stream.
//AddResource
// Exceptions:
// System.ArgumentNullException:
// The name parameter is null.
//ReadAllBytes
// Exceptions:
// System.ArgumentException:
// path is a zero-length string, contains only white space, or contains one
// or more invalid characters as defined by System.IO.Path.InvalidPathChars.
//
// System.ArgumentNullException:
// path is null.
//
// System.IO.PathTooLongException:
// The specified path, file name, or both exceed the system-defined maximum
// length. For example, on Windows-based platforms, paths must be less than
// 248 characters, and file names must be less than 260 characters.
//
// System.IO.DirectoryNotFoundException:
// The specified path is invalid (for example, it is on an unmapped drive).
//
// System.IO.IOException:
// An I/O error occurred while opening the file.
//
// System.UnauthorizedAccessException:
// path specified a file that is read-only.-or- This operation is not supported
// on the current platform.-or- path specified a directory.-or- The caller does
// not have the required permission.
//
// System.IO.FileNotFoundException:
// The file specified in path was not found.
//
// System.NotSupportedException:
// path is in an invalid format.
//
// System.Security.SecurityException:
// The caller does not have the required permission.
private void AddResourceFile(ModuleBuilder builder,string name, FullPath path, ResourceAttributes attributes) {
IResourceWriter rw = builder.DefineResource(path.FileName, name, attributes);
string ext = path.Extension.ToLower();
if(ext == ".resources") {
ResourceReader rr = new ResourceReader(path);
using(rr) {
System.Collections.IDictionaryEnumerator de = rr.GetEnumerator();
while(de.MoveNext()) {
string key = de.Key as string;
rw.AddResource(key, de.Value);
}
}
} else {
rw.AddResource(name, File.ReadAllBytes(path));
}
}
开发者ID:hansdude,项目名称:Phalanger,代码行数:84,代码来源:AssemblyBuilders.CLR.cs
注:本文中的ResourceAttributes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论