本文整理汇总了C#中LoadFlags类的典型用法代码示例。如果您正苦于以下问题:C# LoadFlags类的具体用法?C# LoadFlags怎么用?C# LoadFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoadFlags类属于命名空间,在下文中一共展示了LoadFlags类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CompileRubySource
private ScriptCode/*!*/ CompileRubySource(SourceUnit/*!*/ sourceUnit, LoadFlags flags) {
Assert.NotNull(sourceUnit);
// TODO: check file timestamp
string fullPath = Platform.GetFullPath(sourceUnit.Path);
#if FEATURE_FILESYSTEM
CompiledFile compiledFile;
if (TryGetCompiledFile(fullPath, out compiledFile)) {
Utils.Log(String.Format("{0}: {1}", ++_cacheHitCount, sourceUnit.Path), "LOAD_CACHED");
return compiledFile.CompiledCode;
}
Utils.Log(String.Format("{0}: {1}", ++_compiledFileCount, sourceUnit.Path), "LOAD_COMPILED");
#endif
RubyCompilerOptions options = new RubyCompilerOptions(_context.RubyOptions) {
FactoryKind = (flags & LoadFlags.LoadIsolated) != 0 ? TopScopeFactoryKind.WrappedFile : TopScopeFactoryKind.File
};
ScriptCode compiledCode = sourceUnit.Compile(options, _context.RuntimeErrorSink);
#if FEATURE_FILESYSTEM
AddCompiledFile(fullPath, compiledCode);
#endif
return compiledCode;
}
开发者ID:TerabyteX,项目名称:main,代码行数:28,代码来源:Loader.cs
示例2: LoadFromPath
private bool LoadFromPath(Scope/*!*/ globalScope, object self, string/*!*/ path, LoadFlags flags) {
Assert.NotNull(globalScope, path);
ResolvedFile file = FindFile(globalScope, path, (flags & LoadFlags.AppendExtensions) != 0);
if (file == null) {
throw new LoadError(String.Format("no such file to load -- {0}", path));
}
MutableString pathWithExtension = MutableString.Create(path);
if (file.AppendedExtension != null) {
pathWithExtension.Append(file.AppendedExtension);
}
if (AlreadyLoaded(pathWithExtension, flags) || _unfinishedFiles.Contains(pathWithExtension.ToString())) {
return false;
}
try {
// save path as is, no canonicalization nor combination with an extension or directory:
_unfinishedFiles.Push(pathWithExtension.ToString());
if (file.SourceUnit != null) {
RubyContext rubySource = file.SourceUnit.LanguageContext as RubyContext;
if (rubySource != null) {
ExecuteRubySourceUnit(file.SourceUnit, globalScope, flags);
} else {
file.SourceUnit.Execute();
}
} else {
Debug.Assert(file.Path != null);
try {
Assembly asm = Platform.LoadAssemblyFromPath(Platform.GetFullPath(file.Path));
DomainManager.LoadAssembly(asm);
} catch (Exception e) {
throw new LoadError(e.Message, e);
}
}
FileLoaded(pathWithExtension, flags);
} finally {
_unfinishedFiles.Pop();
}
return true;
}
开发者ID:mscottford,项目名称:ironruby,代码行数:46,代码来源:Loader.cs
示例3: AlreadyLoaded
private bool AlreadyLoaded(MutableString/*!*/ path, LoadFlags flags) {
return (flags & LoadFlags.LoadOnce) != 0 && IsFileLoaded(path);
}
开发者ID:mscottford,项目名称:ironruby,代码行数:3,代码来源:Loader.cs
示例4: GetAdvance
public int GetAdvance(uint glyphIndex, LoadFlags flags)
{
int padvance;
Error err = FT.FT_Get_Advance(Reference, glyphIndex, flags, out padvance);
if (err != Error.Ok)
throw new FreeTypeException(err);
return padvance;
}
开发者ID:jiangzhonghui,项目名称:SharpFont,代码行数:10,代码来源:Face.cs
示例5: LoadLibraryEx
public static IntPtr LoadLibraryEx (string lpFileName, IntPtr hFile, LoadFlags dwFlags)
{
throw new System.NotImplementedException();
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:4,代码来源:Win32EventLog.Mosa.cs
示例6: gambatte_load
public static extern int gambatte_load(IntPtr core, byte[] romdata, uint length, long now, LoadFlags flags);
开发者ID:ddugovic,项目名称:RASuite,代码行数:1,代码来源:LibGambatte.cs
示例7: LoadChar
public void LoadChar(uint charCode, LoadFlags flags, LoadTarget target)
{
if (disposed)
throw new ObjectDisposedException("face", "Cannot access a disposed object.");
Error err = FT.FT_Load_Char(Reference, charCode, (int)flags | (int)target);
if (err != Error.Ok)
throw new FreeTypeException(err);
}
开发者ID:jiangzhonghui,项目名称:SharpFont,代码行数:10,代码来源:Face.cs
示例8: LoadFile
/// <summary>
/// Returns <b>true</b> if a Ruby file is successfully loaded, <b>false</b> if it is already loaded.
/// </summary>
/// <param name="globalScope">
/// A scope against which the file should be executed or null to create a new scope.
/// </param>
/// <returns>True if the file was loaded/executed by this call.</returns>
public bool LoadFile(Scope globalScope, object self, MutableString/*!*/ path, LoadFlags flags, out object loaded) {
Assert.NotNull(path);
string assemblyName, typeName;
string strPath = path.ConvertToString();
if (TryParseAssemblyName(strPath, out typeName, out assemblyName)) {
if (AlreadyLoaded(path, flags)) {
loaded = ((flags & LoadFlags.ResolveLoaded) != 0) ? GetAssembly(assemblyName, true, false) : null;
return false;
}
Assembly assembly = LoadAssembly(assemblyName, typeName, false, false);
if (assembly != null) {
FileLoaded(path, flags);
loaded = assembly;
return true;
}
}
return LoadFromPath(globalScope, self, strPath, flags, out loaded);
}
开发者ID:kevinkeeney,项目名称:ironruby,代码行数:30,代码来源:Loader.cs
示例9: LoadFromPath
private bool LoadFromPath(Scope globalScope, object self, string/*!*/ path, LoadFlags flags, out object loaded) {
Assert.NotNull(path);
string[] sourceFileExtensions;
if ((flags & LoadFlags.AnyLanguage) != 0) {
sourceFileExtensions = DomainManager.Configuration.GetFileExtensions();
} else {
sourceFileExtensions = DomainManager.Configuration.GetFileExtensions(_context);
}
ResolvedFile file = FindFile(path, (flags & LoadFlags.AppendExtensions) != 0, sourceFileExtensions);
if (file == null) {
throw RubyExceptions.CreateLoadError(String.Format("no such file to load -- {0}", path));
}
MutableString pathWithExtension = _context.EncodePath(path);
if (file.AppendedExtension != null) {
pathWithExtension.Append(file.AppendedExtension);
}
if (AlreadyLoaded(pathWithExtension, flags) || _unfinishedFiles.Contains(pathWithExtension.ToString())) {
if ((flags & LoadFlags.ResolveLoaded) != 0) {
var fullPath = Platform.GetFullPath(file.Path);
if (file.SourceUnit != null) {
Scope loadedScope;
if (!LoadedScripts.TryGetValue(fullPath, out loadedScope)) {
throw RubyExceptions.CreateLoadError(String.Format("no such file to load -- {0}", file.Path));
}
loaded = loadedScope;
} else {
loaded = Platform.LoadAssemblyFromPath(fullPath);
}
} else {
loaded = null;
}
return false;
}
try {
// save path as is, no canonicalization nor combination with an extension or directory:
_unfinishedFiles.Push(pathWithExtension.ToString());
if (file.SourceUnit != null) {
AddScriptLines(file.SourceUnit);
ScriptCode compiledCode;
if (file.SourceUnit.LanguageContext == _context) {
compiledCode = CompileRubySource(file.SourceUnit, flags);
} else {
compiledCode = file.SourceUnit.Compile();
}
loaded = Execute(globalScope, compiledCode);
} else {
Debug.Assert(file.Path != null);
try {
Assembly assembly = Platform.LoadAssemblyFromPath(Platform.GetFullPath(file.Path));
DomainManager.LoadAssembly(assembly);
loaded = assembly;
} catch (Exception e) {
throw RubyExceptions.CreateLoadError(e);
}
}
FileLoaded(pathWithExtension, flags);
} finally {
_unfinishedFiles.Pop();
}
return true;
}
开发者ID:kevinkeeney,项目名称:ironruby,代码行数:70,代码来源:Loader.cs
示例10: AlreadyLoaded
/// <summary>
/// Return true if any of the files has alraedy been loaded.
/// </summary>
private bool AlreadyLoaded(string/*!*/ path, IEnumerable<ResolvedFile>/*!*/ files, LoadFlags flags) {
return (flags & LoadFlags.LoadOnce) != 0 && AnyFileLoaded(
new[] { _context.EncodePath(path) }.Concat(files.Select((file) => _context.EncodePath(file.Path)))
);
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:Loader.cs
示例11: GetPathsToTestLoaded
private IEnumerable<MutableString>/*!*/ GetPathsToTestLoaded(string/*!*/ path, string fullPath, LoadFlags flags, string[]/*!*/ sourceFileExtensions) {
List<MutableString> paths = new List<MutableString>();
paths.Add(_context.EncodePath(path));
if (fullPath != null) {
paths.Add(_context.EncodePath(path));
}
if ((flags & LoadFlags.AppendExtensions) != 0 && RubyUtils.GetExtension(path).Length == 0) {
foreach (var extension in sourceFileExtensions) {
paths.Add(_context.EncodePath(path + extension));
}
foreach (var extension in _LibraryExtensions) {
paths.Add(_context.EncodePath(path + extension));
}
}
return paths;
}
开发者ID:TerabyteX,项目名称:main,代码行数:19,代码来源:Loader.cs
示例12: LoadFromWriter
internal XmlRawWriter LoadFromWriter(LoadFlags flags, string baseUri)
{
return new XPathDocumentBuilder(this, null, baseUri, flags);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:XPathDocument.cs
示例13: CompileRubySource
private ScriptCode/*!*/ CompileRubySource(SourceUnit/*!*/ sourceUnit, LoadFlags flags) {
Assert.NotNull(sourceUnit);
// TODO: check file timestamp
string fullPath = Platform.GetFullPath(sourceUnit.Path);
CompiledFile compiledFile;
if (TryGetCompiledFile(fullPath, out compiledFile)) {
Utils.Log(String.Format("{0}: {1}", ++_cacheHitCount, sourceUnit.Path), "LOAD_CACHED");
return compiledFile.CompiledCode;
} else {
Utils.Log(String.Format("{0}: {1}", ++_compiledFileCount, sourceUnit.Path), "LOAD_COMPILED");
RubyCompilerOptions options = new RubyCompilerOptions(_context.RubyOptions) {
FactoryKind = (flags & LoadFlags.LoadIsolated) != 0 ? TopScopeFactoryKind.WrappedFile : TopScopeFactoryKind.File
};
long ts1 = Stopwatch.GetTimestamp();
ScriptCode compiledCode = sourceUnit.Compile(options, _context.RuntimeErrorSink);
long ts2 = Stopwatch.GetTimestamp();
Interlocked.Add(ref _ScriptCodeGenerationTimeTicks, ts2 - ts1);
AddCompiledFile(fullPath, compiledCode);
return compiledCode;
}
}
开发者ID:kevinkeeney,项目名称:ironruby,代码行数:27,代码来源:Loader.cs
示例14: LookupScaler
public Glyph LookupScaler(Scaler scaler, LoadFlags loadFlags, uint gIndex, out Node node)
{
if (parentManager.IsDisposed)
throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");
IntPtr glyphRef, nodeRef;
Error err = FT.FTC_ImageCache_LookupScaler(Reference, scaler.Reference, loadFlags, gIndex, out glyphRef, out nodeRef);
if (err != Error.Ok)
throw new FreeTypeException(err);
node = new Node(nodeRef);
return new Glyph(glyphRef, null);
}
开发者ID:Mailaender,项目名称:SharpFont,代码行数:14,代码来源:ImageCache.cs
示例15: GetAdvance
public Fixed16Dot16 GetAdvance(uint glyphIndex, LoadFlags flags)
{
IntPtr padvance;
Error err = FT.FT_Get_Advance(Reference, glyphIndex, flags, out padvance);
if (err != Error.Ok)
throw new FreeTypeException(err);
return Fixed16Dot16.FromRawValue((int)padvance);
}
开发者ID:HinTak,项目名称:SharpFont,代码行数:10,代码来源:Face.cs
示例16: LoadLibraryEx
public static extern IntPtr LoadLibraryEx (string lpFileName, IntPtr hFile, LoadFlags dwFlags);
开发者ID:sushihangover,项目名称:playscript,代码行数:1,代码来源:Win32EventLog.cs
示例17: GetAdvances
public unsafe Fixed16Dot16[] GetAdvances(uint start, uint count, LoadFlags flags)
{
IntPtr advPtr;
Error err = FT.FT_Get_Advances(Reference, start, count, flags, out advPtr);
if (err != Error.Ok)
throw new FreeTypeException(err);
//create a new array and copy the data from the pointer over
Fixed16Dot16[] advances = new Fixed16Dot16[count];
IntPtr* ptr = (IntPtr*)advPtr;
for (int i = 0; i < count; i++)
advances[i] = Fixed16Dot16.FromRawValue((int)ptr[i]);
return advances;
}
开发者ID:HinTak,项目名称:SharpFont,代码行数:17,代码来源:Face.cs
示例18: LoadGlyph
public void LoadGlyph(uint glyphIndex, LoadFlags flags, LoadTarget target)
{
if (disposed)
throw new ObjectDisposedException("face", "Cannot access a disposed object.");
Error err = FT.FT_Load_Glyph(Reference, glyphIndex, (int)flags | (int)target);
if (err != Error.Ok)
throw new FreeTypeException(err);
}
开发者ID:jiangzhonghui,项目名称:SharpFont,代码行数:10,代码来源:Face.cs
示例19: FT_Get_Advance
internal static extern Error FT_Get_Advance(IntPtr face, uint gIndex, LoadFlags load_flags, out int padvance);
开发者ID:jiangzhonghui,项目名称:SharpFont,代码行数:1,代码来源:FT.Internal.cs
示例20: GetAdvances
public unsafe int[] GetAdvances(uint start, uint count, LoadFlags flags)
{
IntPtr advPtr;
Error err = FT.FT_Get_Advances(Reference, start, count, flags, out advPtr);
if (err != Error.Ok)
throw new FreeTypeException(err);
//create a new array and copy the data from the pointer over
int[] advances = new int[count];
int* ptr = (int*)advPtr;
for (int i = 0; i < count; i++)
advances[i] = ptr[i];
return advances;
}
开发者ID:jiangzhonghui,项目名称:SharpFont,代码行数:17,代码来源:Face.cs
注:本文中的LoadFlags类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论