WriteLine() private method

private WriteLine ( string text ) : void
text string
return void
Exemplo n.º 1
0
        public IILLocal DeclareLocal(Type type, string name, bool pinned = false)
        {
            var localBuilder = _ilGenerator.DeclareLocal(type, pinned);

            if (name == null)
            {
                name = "local" + localBuilder.LocalIndex;
            }
            localBuilder.SetLocalSymInfo(name);
            _sourceCodeWriter.WriteLine(string.Format("{3}{0} {1} // index {2}", type.ToSimpleName(), name, localBuilder.LocalIndex, pinned ? "pinned " : ""));
            return(new ILLocalImpl(localBuilder, name));
        }
Exemplo n.º 2
0
 public ILDynamicTypeDebugImpl(string name, Type baseType, Type[] interfaces)
 {
     _name = name;
     var uniqueName = UniqueName(name);
     _assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(uniqueName), AssemblyBuilderAccess.RunAndSave, "dynamicIL");
     _moduleBuilder = _assemblyBuilder.DefineDynamicModule(uniqueName + ".dll", true);
     var sourceCodeFileName = Path.GetFullPath("dynamicIL/" + uniqueName + ".il");
     _symbolDocumentWriter = _moduleBuilder.DefineDocument(sourceCodeFileName, SymDocumentType.Text, SymLanguageType.ILAssembly, SymLanguageVendor.Microsoft);
     _sourceCodeWriter = new SourceCodeWriter(sourceCodeFileName, _symbolDocumentWriter);
     _sourceCodeWriter.WriteLine(string.Format("class {0} : {1}{2}", name, baseType.ToSimpleName(), string.Concat(interfaces.Select(i => ", " + i.ToSimpleName()))));
     _sourceCodeWriter.OpenScope();
     _typeBuilder = _moduleBuilder.DefineType(name, TypeAttributes.Public, baseType, interfaces);
     _forbidenInstructions = new ILGenForbidenInstructionsCheating(_typeBuilder);
 }
Exemplo n.º 3
0
 public ILDynamicTypeDebugImpl(string name, Type baseType, Type[] interfaces)
 {
     _name = name;
     var uniqueName = UniqueName(name, 259 - (DynamicILDirectoryPath.DynamicIL.Length + 1 + 4));
     _assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(uniqueName), AssemblyBuilderAccess.RunAndSave, DynamicILDirectoryPath.DynamicIL);
     _moduleBuilder = _assemblyBuilder.DefineDynamicModule(uniqueName + ".dll", true);
     var sourceCodeFileName = Path.Combine(DynamicILDirectoryPath.DynamicIL, uniqueName + ".il");
     _symbolDocumentWriter = _moduleBuilder.DefineDocument(sourceCodeFileName, SymDocumentType.Text, SymLanguageType.ILAssembly, SymLanguageVendor.Microsoft);
     _sourceCodeWriter = new SourceCodeWriter(sourceCodeFileName, _symbolDocumentWriter);
     _sourceCodeWriter.WriteLine(
         $"class {name} : {baseType.ToSimpleName()}{string.Concat(interfaces.Select(i => ", " + i.ToSimpleName()))}");
     _sourceCodeWriter.OpenScope();
     _typeBuilder = _moduleBuilder.DefineType(name, TypeAttributes.Public, baseType, interfaces);
     _forbidenInstructions = new ILGenForbidenInstructionsCheating(_typeBuilder);
 }
Exemplo n.º 4
0
        public ILDynamicTypeDebugImpl(string name, Type baseType, Type[] interfaces)
        {
            _name = name;
            var uniqueName = UniqueName(name);

            _assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(uniqueName), AssemblyBuilderAccess.RunAndSave, DynamicILDirectoryPath.DynamicIL);
            _moduleBuilder   = _assemblyBuilder.DefineDynamicModule(uniqueName + ".dll", true);
            var sourceCodeFileName = Path.Combine(DynamicILDirectoryPath.DynamicIL, uniqueName + ".il");

            _symbolDocumentWriter = _moduleBuilder.DefineDocument(sourceCodeFileName, SymDocumentType.Text, SymLanguageType.ILAssembly, SymLanguageVendor.Microsoft);
            _sourceCodeWriter     = new SourceCodeWriter(sourceCodeFileName, _symbolDocumentWriter);
            _sourceCodeWriter.WriteLine(
                $"class {name} : {baseType.ToSimpleName()}{string.Concat(interfaces.Select(i => ", " + i.ToSimpleName()))}");
            _sourceCodeWriter.OpenScope();
            _typeBuilder          = _moduleBuilder.DefineType(name, TypeAttributes.Public, baseType, interfaces);
            _forbidenInstructions = new ILGenForbidenInstructionsCheating(_typeBuilder);
        }
Exemplo n.º 5
0
 public FieldBuilder DefineField(string name, Type type, FieldAttributes fieldAttributes)
 {
     CloseInScope();
     _sourceCodeWriter.WriteLine($"{type.ToSimpleName()} {name};");
     return(_typeBuilder.DefineField(name, type, fieldAttributes));
 }