コード例 #1
0
        private static List <RuntimeFallbacks> ReadRuntimes(ref UnifiedJsonReader reader)
        {
            var runtimeFallbacks = new List <RuntimeFallbacks>();

            reader.ReadStartObject();

            while (reader.Read() && reader.IsTokenTypeProperty())
            {
                string   runtime   = reader.GetStringValue();
                string[] fallbacks = reader.ReadStringArray();

                runtimeFallbacks.Add(new RuntimeFallbacks(runtime, fallbacks));
            }

            reader.CheckEndObject();

            return(runtimeFallbacks);
        }
コード例 #2
0
        private static CompilationOptions ReadCompilationOptions(ref UnifiedJsonReader reader)
        {
            IEnumerable <string> defines = null;
            string languageVersion       = null;
            string platform                 = null;
            bool?  allowUnsafe              = null;
            bool?  warningsAsErrors         = null;
            bool?  optimize                 = null;
            string keyFile                  = null;
            bool?  delaySign                = null;
            bool?  publicSign               = null;
            string debugType                = null;
            bool?  emitEntryPoint           = null;
            bool?  generateXmlDocumentation = null;

            reader.ReadStartObject();

            while (reader.Read() && reader.IsTokenTypeProperty())
            {
                switch (reader.GetStringValue())
                {
                case DependencyContextStrings.DefinesPropertyName:
                    defines = reader.ReadStringArray();
                    break;

                case DependencyContextStrings.LanguageVersionPropertyName:
                    languageVersion = reader.ReadAsString();
                    break;

                case DependencyContextStrings.PlatformPropertyName:
                    platform = reader.ReadAsString();
                    break;

                case DependencyContextStrings.AllowUnsafePropertyName:
                    allowUnsafe = reader.ReadAsNullableBoolean();
                    break;

                case DependencyContextStrings.WarningsAsErrorsPropertyName:
                    warningsAsErrors = reader.ReadAsNullableBoolean();
                    break;

                case DependencyContextStrings.OptimizePropertyName:
                    optimize = reader.ReadAsNullableBoolean();
                    break;

                case DependencyContextStrings.KeyFilePropertyName:
                    keyFile = reader.ReadAsString();
                    break;

                case DependencyContextStrings.DelaySignPropertyName:
                    delaySign = reader.ReadAsNullableBoolean();
                    break;

                case DependencyContextStrings.PublicSignPropertyName:
                    publicSign = reader.ReadAsNullableBoolean();
                    break;

                case DependencyContextStrings.DebugTypePropertyName:
                    debugType = reader.ReadAsString();
                    break;

                case DependencyContextStrings.EmitEntryPointPropertyName:
                    emitEntryPoint = reader.ReadAsNullableBoolean();
                    break;

                case DependencyContextStrings.GenerateXmlDocumentationPropertyName:
                    generateXmlDocumentation = reader.ReadAsNullableBoolean();
                    break;

                default:
                    reader.Skip();
                    break;
                }
            }

            reader.CheckEndObject();

            return(new CompilationOptions(
                       defines ?? Enumerable.Empty <string>(),
                       languageVersion,
                       platform,
                       allowUnsafe,
                       warningsAsErrors,
                       optimize,
                       keyFile,
                       delaySign,
                       publicSign,
                       debugType,
                       emitEntryPoint,
                       generateXmlDocumentation));
        }