protected override void BuildInitStatements(CodeStatementCollection trueStatements, CodeStatementCollection topLevelStatements)
        {
            base.BuildInitStatements(trueStatements, topLevelStatements);
            if (base._stringResourceBuilder.HasStrings)
            {
                CodeMemberField field;
                field = new CodeMemberField(typeof(object), "__stringResource")
                {
                    Attributes = field.Attributes | MemberAttributes.Static
                };
                base._sourceDataClass.Members.Add(field);
                CodeAssignStatement statement = new CodeAssignStatement {
                    Left = new CodeFieldReferenceExpression(base._classTypeExpr, "__stringResource")
                };
                CodeMethodInvokeExpression expression = new CodeMethodInvokeExpression {
                    Method = { TargetObject = new CodeThisReferenceExpression(), MethodName = "ReadStringResource" }
                };
                statement.Right = expression;
                trueStatements.Add(statement);
            }
            CodeAssignStatement statement2 = new CodeAssignStatement(new CodePropertyReferenceExpression(new CodeCastExpression(CodeDomUtility.BuildGlobalCodeTypeReference(this.Parser.BaseType), new CodeThisReferenceExpression()), "AppRelativeVirtualPath"), new CodePrimitiveExpression(this.Parser.CurrentVirtualPath.AppRelativeVirtualPathString));

            if (!base._designerMode && (this.Parser.CodeFileVirtualPath != null))
            {
                statement2.LinePragma = BaseCodeDomTreeGenerator.CreateCodeLinePragmaHelper(this.Parser.CodeFileVirtualPath.VirtualPathString, 0xdebb0);
            }
            topLevelStatements.Add(statement2);
        }
Beispiel #2
0
 private void EnsureCodeCompileUnit()
 {
     if (this._snippetCompileUnit == null)
     {
         string str = Util.StringFromVirtualPath(base.VirtualPathObject);
         this._snippetCompileUnit            = new CodeSnippetCompileUnit(str);
         this._snippetCompileUnit.LinePragma = BaseCodeDomTreeGenerator.CreateCodeLinePragmaHelper(base.VirtualPath, 1);
     }
 }
Beispiel #3
0
 private void EnsureCodeCompileUnit()
 {
     if (_snippetCompileUnit == null)
     {
         // Read the contents of the file
         string sourceString = Util.StringFromVirtualPath(VirtualPathObject);
         _snippetCompileUnit            = new CodeSnippetCompileUnit(sourceString);
         _snippetCompileUnit.LinePragma = BaseCodeDomTreeGenerator.CreateCodeLinePragmaHelper(
             VirtualPath, 1);
     }
 }
 private void BuildFrameworkInitializeMethod()
 {
     if (base._sourceDataClass != null)
     {
         CodeMemberMethod method = new CodeMemberMethod();
         base.AddDebuggerNonUserCodeAttribute(method);
         method.Attributes &= ~MemberAttributes.AccessMask;
         method.Attributes &= ~MemberAttributes.ScopeMask;
         method.Attributes |= MemberAttributes.Family | MemberAttributes.Override;
         method.Name        = "FrameworkInitialize";
         this.BuildFrameworkInitializeMethodContents(method);
         if (!base._designerMode && (this.Parser.CodeFileVirtualPath != null))
         {
             method.LinePragma = BaseCodeDomTreeGenerator.CreateCodeLinePragmaHelper(this.Parser.CodeFileVirtualPath.VirtualPathString, 0xdebb0);
         }
         base._sourceDataClass.Members.Add(method);
     }
 }