Ejemplo n.º 1
0
        // Token: 0x0600001B RID: 27 RVA: 0x0000259C File Offset: 0x0000079C
        private ParsedDocument Parse(string source, ProjectVisualStudio project)
        {
            ParsedDocument result;

            using (TextReader textReader = File.OpenText(source))
            {
                result = this.Parse(textReader, source, project);
            }
            return(result);
        }
Ejemplo n.º 2
0
        // Token: 0x0600001A RID: 26 RVA: 0x00002560 File Offset: 0x00000760
        private ParsedDocument Parse(TextReader content, string fileName, ProjectVisualStudio project)
        {
            CSharpParser csharpParser = new CSharpParser(this.GetCompilerArguments(project));
            SyntaxTree   syntaxTree   = csharpParser.Parse(content, fileName);

            syntaxTree.Freeze();
            CSharpUnresolvedFile parsedFile = syntaxTree.ToTypeSystem();

            return(new ParsedDocument(syntaxTree, parsedFile));
        }
        // Token: 0x0600000F RID: 15 RVA: 0x00002380 File Offset: 0x00000580
        private ProjectDocument FindOrCreateDocument(string source)
        {
            VSProject vsproject = ProjectVisualStudio.FindVSProjectBySource(source);

            if (vsproject == null)
            {
                return(null);
            }
            ProjectVisualStudio projectVisualStudio;

            if (this.projects.ContainsKey(vsproject))
            {
                projectVisualStudio = this.projects[vsproject];
            }
            else
            {
                projectVisualStudio      = new ProjectVisualStudio(vsproject);
                this.projects[vsproject] = projectVisualStudio;
            }
            return(projectVisualStudio.FindOrCreateDocument(source));
        }
Ejemplo n.º 4
0
        // Token: 0x06000020 RID: 32 RVA: 0x000026A0 File Offset: 0x000008A0
        private CompilerSettings GetCompilerSettingsFromVSProject(VSProject vsproject)
        {
            CompilerSettings compilerSettings = new CompilerSettings();

            if (vsproject == null || vsproject.Project == null || vsproject.Project.ConfigurationManager.ActiveConfiguration == null || vsproject.Project.ConfigurationManager.ActiveConfiguration.Properties == null)
            {
                compilerSettings.AllowUnsafeBlocks = true;
                return(compilerSettings);
            }
            Properties properties = vsproject.Project.ConfigurationManager.ActiveConfiguration.Properties;

            if (properties.Count == 0)
            {
                return(compilerSettings);
            }
            try
            {
                string text = (string)properties.Item("DefineConstants").Value;
                bool   allowUnsafeBlocks = (bool)properties.Item("AllowUnsafeBlocks").Value;
                bool   flag                  = (bool)properties.Item("Optimize").Value;
                string ver                   = (string)properties.Item("LanguageVersion").Value;
                bool   checkForOverflow      = (bool)properties.Item("CheckForOverflowUnderflow").Value;
                int    warningLevel          = (int)properties.Item("WarningLevel").Value;
                bool   treatWarningsAsErrors = (bool)properties.Item("TreatWarningsAsErrors").Value;
                string text2                 = (string)properties.Item("NoWarn").Value;
                if (!string.IsNullOrEmpty(text))
                {
                    foreach (string item in from s in text.Split(new char[]
                    {
                        ';',
                        ',',
                        ' ',
                        '\t'
                    })
                             where !string.IsNullOrWhiteSpace(s)
                             select s)
                    {
                        compilerSettings.ConditionalSymbols.Add(item);
                    }
                }
                compilerSettings.AllowUnsafeBlocks     = allowUnsafeBlocks;
                compilerSettings.LanguageVersion       = ProjectVisualStudio.ConvertLanguageVersion(ver);
                compilerSettings.CheckForOverflow      = checkForOverflow;
                compilerSettings.WarningLevel          = warningLevel;
                compilerSettings.TreatWarningsAsErrors = treatWarningsAsErrors;
                if (!string.IsNullOrEmpty(text2))
                {
                    string[] array = text2.Split(new char[]
                    {
                        ';',
                        ',',
                        ' ',
                        '\t'
                    });
                    int i = 0;
                    while (i < array.Length)
                    {
                        string s2 = array[i];
                        int    item2;
                        try
                        {
                            item2 = int.Parse(s2);
                        }
                        catch (Exception)
                        {
                            goto IL_209;
                        }
                        goto IL_1FC;
IL_209:
                        i++;
                        continue;
IL_1FC:
                        compilerSettings.DisabledWarnings.Add(item2);
                        goto IL_209;
                    }
                }
            }
            catch (Exception)
            {
                return(compilerSettings);
            }
            return(compilerSettings);
        }
Ejemplo n.º 5
0
 // Token: 0x06000019 RID: 25 RVA: 0x00002552 File Offset: 0x00000752
 private CompilerSettings GetCompilerArguments(ProjectVisualStudio project)
 {
     return(project.CompilerSettings as CompilerSettings);
 }
Ejemplo n.º 6
0
 // Token: 0x06000018 RID: 24 RVA: 0x00002535 File Offset: 0x00000735
 public ProjectDocument(ProjectVisualStudio project, string source)
 {
     this.project        = project;
     this.parsedDocument = this.Parse(source, project);
 }