File: XomlCompilerError.cs

package info (click to toggle)
mono 6.14.1%2Bds2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,282,732 kB
  • sloc: cs: 11,182,461; xml: 2,850,281; ansic: 699,123; cpp: 122,919; perl: 58,604; javascript: 30,841; asm: 21,845; makefile: 19,602; sh: 10,973; python: 4,772; pascal: 925; sql: 859; sed: 16; php: 1
file content (159 lines) | stat: -rw-r--r-- 5,021 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
namespace System.Workflow.ComponentModel.Compiler
{
    using System;
    using System.Collections;
    using System.CodeDom;
    using System.CodeDom.Compiler;
    using System.Globalization;
    using System.IO;
    using System.Runtime.InteropServices;
    using System.Workflow.ComponentModel.Serialization;


    // IWorkflowCompilerError is registered from Project System
    [Guid("AEA0CDAE-ADB5-46c6-A5ED-DBD516B3E0C1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComVisible(false), ComImport]
    internal interface IWorkflowCompilerError
    {
        String Document { get; }
        bool IsWarning { get; }
        String Text { get; }
        String ErrorNumber { get; }
        int LineNumber { get; }
        int ColumnNumber { get; }
    }
    [Guid("A5367E37-D7AF-4372-8079-D1D6726AEDC8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComVisible(false), ComImport]
    internal interface IWorkflowCompilerErrorLogger
    {
        void LogError(IWorkflowCompilerError error);
        void LogMessage(string message);
    }

    [Serializable]
    [Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
    public sealed class WorkflowCompilerError : CompilerError, IWorkflowCompilerError
    {
        private Hashtable userData = null;
        private bool incrementLineAndColumn = false;
        private string propertyName = null;

        public WorkflowCompilerError()
        {
        }

        public WorkflowCompilerError(string fileName, int line, int column, string errorNumber, string errorText) :
            base(fileName, line, column, errorNumber, errorText)
        {
        }

        public WorkflowCompilerError(string fileName, WorkflowMarkupSerializationException exception)
        {
            if (exception == null)
                throw new ArgumentNullException("exception");
            this.FileName = fileName;
            this.Line = exception.LineNumber - 1;
            this.Column = exception.LinePosition - 1;
            this.ErrorText = exception.Message;
            this.ErrorNumber = ErrorNumbers.Error_SerializationError.ToString(CultureInfo.InvariantCulture);
            this.incrementLineAndColumn = true;
        }

        internal WorkflowCompilerError(CompilerError error)
        {
            if (error == null)
                throw new ArgumentNullException("error");
            this.Column = error.Column - 1;
            this.ErrorNumber = error.ErrorNumber;
            this.ErrorText = error.ErrorText;
            this.FileName = error.FileName;
            this.IsWarning = error.IsWarning;
            this.Line = error.Line - 1;
            this.incrementLineAndColumn = true;
        }

        public string PropertyName
        {
            get
            {
                return this.propertyName;
            }
            set
            {
                this.propertyName = value;
            }
        }

        public IDictionary UserData
        {
            get
            {
                if (this.userData == null)
                    this.userData = new Hashtable();
                return this.userData;
            }
        }
        public override string ToString()
        {
            if (FileName.Length > 0)
            {
                if (Line <= 0 || Column <= 0)
                    return string.Format(CultureInfo.CurrentCulture, "{0} : {1} {2}: {3}", new object[] { FileName, IsWarning ? "warning" : "error", ErrorNumber, ErrorText });
                else
                    return string.Format(CultureInfo.CurrentCulture, "{0}({1},{2}) : {3} {4}: {5}", new object[] { FileName, this.incrementLineAndColumn ? Line + 1 : Line, this.incrementLineAndColumn ? Column + 1 : Column, IsWarning ? "warning" : "error", ErrorNumber, ErrorText });
            }
            else
            {
                return string.Format(CultureInfo.CurrentCulture, "{0} {1}: {2}", IsWarning ? "warning" : "error", ErrorNumber, ErrorText);
            }
        }


        #region IWorkflowCompilerError Members

        string IWorkflowCompilerError.Document
        {
            get
            {
                return this.FileName;
            }
        }
        bool IWorkflowCompilerError.IsWarning
        {
            get
            {
                return this.IsWarning;
            }
        }
        string IWorkflowCompilerError.Text
        {
            get
            {
                return this.ErrorText;
            }
        }

        string IWorkflowCompilerError.ErrorNumber
        {
            get
            {
                return this.ErrorNumber;
            }
        }

        int IWorkflowCompilerError.LineNumber
        {
            get
            {
                return this.Line;
            }
        }
        int IWorkflowCompilerError.ColumnNumber
        {
            get
            {
                return this.Column;
            }
        }

        #endregion
    }
}