本文整理汇总了C#中IKVM.Internal.ClassFile.SetInternal方法的典型用法代码示例。如果您正苦于以下问题:C# ClassFile.SetInternal方法的具体用法?C# ClassFile.SetInternal怎么用?C# ClassFile.SetInternal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Internal.ClassFile
的用法示例。
在下文中一共展示了ClassFile.SetInternal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTypeWrapperCompilerHook
private TypeWrapper GetTypeWrapperCompilerHook(string name)
{
RemapperTypeWrapper rtw;
if(remapped.TryGetValue(name, out rtw))
{
return rtw;
}
else
{
ClassItem classdef;
if(classes.TryGetValue(name, out classdef))
{
classes.Remove(name);
ClassFile f;
try
{
ClassFileParseOptions cfp = ClassFileParseOptions.LocalVariableTable;
if(this.EmitStackTraceInfo)
{
cfp |= ClassFileParseOptions.LineNumberTable;
}
f = new ClassFile(classdef.data, 0, classdef.data.Length, name, cfp);
}
catch(ClassFormatError x)
{
StaticCompiler.IssueMessage(options, Message.ClassFormatError, name, x.Message);
return null;
}
if(options.removeUnusedFields)
{
f.RemoveUnusedFields();
}
if(f.IsPublic && options.privatePackages != null)
{
foreach(string p in options.privatePackages)
{
if(f.Name.StartsWith(p))
{
f.SetInternal();
break;
}
}
}
if(f.IsPublic && options.publicPackages != null)
{
bool found = false;
foreach(string package in options.publicPackages)
{
if(f.Name.StartsWith(package))
{
found = true;
break;
}
}
if(!found)
{
f.SetInternal();
}
}
if(!f.IsInterface
&& !f.IsAbstract
&& !f.IsPublic
&& !f.IsInternal
&& !f.IsFinal
&& !baseClasses.ContainsKey(f.Name)
&& !options.targetIsModule
&& options.sharedclassloader == null)
{
f.SetEffectivelyFinal();
}
if(f.SourceFileAttribute != null)
{
if(classdef.path != null)
{
string sourceFile = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(classdef.path), f.SourceFileAttribute));
if(File.Exists(sourceFile))
{
f.SourcePath = sourceFile;
}
}
if(f.SourcePath == null)
{
if (options.sourcepath != null)
{
string package = f.Name;
int index = package.LastIndexOf('.');
package = index == -1 ? "" : package.Substring(0, index).Replace('.', '/');
f.SourcePath = Path.GetFullPath(Path.Combine(options.sourcepath + "/" + package, f.SourceFileAttribute));
}
else
{
f.SourcePath = f.SourceFileAttribute;
}
}
}
try
{
TypeWrapper type = DefineClass(f, null);
if(f.IKVMAssemblyAttribute != null)
{
//.........这里部分代码省略.........
示例2: GetTypeWrapperCompilerHook
private TypeWrapper GetTypeWrapperCompilerHook(string name)
{
TypeWrapper type = null;
if(type == null)
{
if(remapped.TryGetValue(name, out type))
{
return type;
}
byte[] classdef;
if(classes.TryGetValue(name, out classdef))
{
classes.Remove(name);
ClassFile f;
try
{
ClassFileParseOptions cfp = ClassFileParseOptions.LocalVariableTable;
if(this.EmitStackTraceInfo)
{
cfp |= ClassFileParseOptions.LineNumberTable;
}
f = new ClassFile(classdef, 0, classdef.Length, name, cfp);
}
catch(ClassFormatError x)
{
StaticCompiler.IssueMessage(options, Message.ClassFormatError, name, x.Message);
return null;
}
if(options.removeUnusedFields)
{
f.RemoveUnusedFields();
}
if(f.IsPublic && options.privatePackages != null)
{
foreach(string p in options.privatePackages)
{
if(f.Name.StartsWith(p))
{
f.SetInternal();
break;
}
}
}
if(f.IsPublic && options.publicPackages != null)
{
bool found = false;
foreach(string package in options.publicPackages)
{
if(f.Name.StartsWith(package))
{
found = true;
break;
}
}
if(!found)
{
f.SetInternal();
}
}
if(!f.IsInterface
&& !f.IsAbstract
&& !f.IsPublic
&& !f.IsInternal
&& !f.IsFinal
&& !baseClasses.ContainsKey(f.Name)
&& !options.targetIsModule
&& options.sharedclassloader == null)
{
f.SetEffectivelyFinal();
}
try
{
type = DefineClass(f, null);
if(f.IKVMAssemblyAttribute != null)
{
importedStubTypes.Add(f.Name, type);
}
}
catch (ClassFormatError x)
{
StaticCompiler.IssueMessage(options, Message.ClassFormatError, name, x.Message);
return null;
}
catch (IllegalAccessError x)
{
StaticCompiler.IssueMessage(options, Message.IllegalAccessError, name, x.Message);
return null;
}
catch (VerifyError x)
{
StaticCompiler.IssueMessage(options, Message.VerificationError, name, x.Message);
return null;
}
catch (NoClassDefFoundError x)
{
StaticCompiler.IssueMessage(options, Message.NoClassDefFoundError, name, x.Message);
return null;
}
catch (RetargetableJavaException x)
{
//.........这里部分代码省略.........
示例3: GetTypeWrapperCompilerHook
private TypeWrapper GetTypeWrapperCompilerHook(string name)
{
RemapperTypeWrapper rtw;
if(remapped.TryGetValue(name, out rtw))
{
return rtw;
}
else
{
Jar.Item itemRef;
if(classes.TryGetValue(name, out itemRef))
{
classes.Remove(name);
ClassFile f;
try
{
byte[] buf = itemRef.GetData();
f = new ClassFile(buf, 0, buf.Length, name, ClassFileParseOptions, null);
}
catch(ClassFormatError x)
{
StaticCompiler.SuppressWarning(options, Message.ClassNotFound, name);
StaticCompiler.IssueMessage(options, Message.ClassFormatError, name, x.Message);
return null;
}
if(f.Name != name)
{
StaticCompiler.SuppressWarning(options, Message.ClassNotFound, name);
StaticCompiler.IssueMessage(options, Message.WrongClassName, name, f.Name);
return null;
}
if(options.removeUnusedFields)
{
f.RemoveUnusedFields();
}
if(f.IsPublic && options.privatePackages != null)
{
foreach(string p in options.privatePackages)
{
if(f.Name.StartsWith(p))
{
f.SetInternal();
break;
}
}
}
if(f.IsPublic && options.publicPackages != null)
{
bool found = false;
foreach(string package in options.publicPackages)
{
if(f.Name.StartsWith(package))
{
found = true;
break;
}
}
if(!found)
{
f.SetInternal();
}
}
if(f.SourceFileAttribute != null)
{
FileInfo path = itemRef.Path;
if(path != null)
{
string sourceFile = Path.GetFullPath(Path.Combine(path.DirectoryName, f.SourceFileAttribute));
if(File.Exists(sourceFile))
{
f.SourcePath = sourceFile;
}
}
if(f.SourcePath == null)
{
if (options.sourcepath != null)
{
string package = f.Name;
int index = package.LastIndexOf('.');
package = index == -1 ? "" : package.Substring(0, index).Replace('.', '/');
f.SourcePath = Path.GetFullPath(Path.Combine(options.sourcepath + "/" + package, f.SourceFileAttribute));
}
else
{
f.SourcePath = f.SourceFileAttribute;
}
}
}
try
{
TypeWrapper tw = DefineClass(f, null);
// we successfully created the type, so we don't need to include the class as a resource
if (options.nojarstubs)
{
itemRef.Remove();
}
else
{
itemRef.MarkAsStub();
}
//.........这里部分代码省略.........
示例4: GetTypeWrapperCompilerHook
private TypeWrapper GetTypeWrapperCompilerHook(string name)
{
RemapperTypeWrapper rtw;
if(remapped.TryGetValue(name, out rtw))
{
return rtw;
}
else
{
JarItemReference itemRef;
if(classes.TryGetValue(name, out itemRef))
{
classes.Remove(name);
JarItem classdef = itemRef.Jar.Items[itemRef.Index];
ClassFile f;
try
{
ClassFileParseOptions cfp = ClassFileParseOptions.LocalVariableTable;
if(this.EmitStackTraceInfo)
{
cfp |= ClassFileParseOptions.LineNumberTable;
}
f = new ClassFile(classdef.data, 0, classdef.data.Length, name, cfp);
}
catch(ClassFormatError x)
{
StaticCompiler.SuppressWarning(options, Message.ClassNotFound, name);
StaticCompiler.IssueMessage(options, Message.ClassFormatError, name, x.Message);
return null;
}
if(f.Name != name)
{
StaticCompiler.SuppressWarning(options, Message.ClassNotFound, name);
StaticCompiler.IssueMessage(options, Message.WrongClassName, name, f.Name);
return null;
}
if(options.removeUnusedFields)
{
f.RemoveUnusedFields();
}
if(f.IsPublic && options.privatePackages != null)
{
foreach(string p in options.privatePackages)
{
if(f.Name.StartsWith(p))
{
f.SetInternal();
break;
}
}
}
if(f.IsPublic && options.publicPackages != null)
{
bool found = false;
foreach(string package in options.publicPackages)
{
if(f.Name.StartsWith(package))
{
found = true;
break;
}
}
if(!found)
{
f.SetInternal();
}
}
if(!f.IsInterface
&& !f.IsAbstract
&& !f.IsPublic
&& !f.IsInternal
&& !f.IsFinal
&& !baseClasses.ContainsKey(f.Name)
&& !options.targetIsModule
&& options.sharedclassloader == null)
{
f.SetEffectivelyFinal();
}
if(f.SourceFileAttribute != null)
{
if(classdef.path != null)
{
string sourceFile = Path.GetFullPath(Path.Combine(classdef.path.DirectoryName, f.SourceFileAttribute));
if(File.Exists(sourceFile))
{
f.SourcePath = sourceFile;
}
}
if(f.SourcePath == null)
{
if (options.sourcepath != null)
{
string package = f.Name;
int index = package.LastIndexOf('.');
package = index == -1 ? "" : package.Substring(0, index).Replace('.', '/');
f.SourcePath = Path.GetFullPath(Path.Combine(options.sourcepath + "/" + package, f.SourceFileAttribute));
}
else
{
f.SourcePath = f.SourceFileAttribute;
//.........这里部分代码省略.........