Exemplo n.º 1
0
        private LibraryStub ReadOneLibrary(ref UnifiedJsonReader reader)
        {
            string hash        = null;
            string type        = null;
            bool   serviceable = false;
            string path        = null;
            string hashPath    = null;
            string runtimeStoreManifestName = null;

            reader.ReadStartObject();

            while (reader.Read() && reader.IsTokenTypeProperty())
            {
                switch (reader.GetStringValue())
                {
                case DependencyContextStrings.Sha512PropertyName:
                    hash = reader.ReadAsString();
                    break;

                case DependencyContextStrings.TypePropertyName:
                    type = reader.ReadAsString();
                    break;

                case DependencyContextStrings.ServiceablePropertyName:
                    serviceable = reader.ReadAsBoolean(defaultValue: false);
                    break;

                case DependencyContextStrings.PathPropertyName:
                    path = reader.ReadAsString();
                    break;

                case DependencyContextStrings.HashPathPropertyName:
                    hashPath = reader.ReadAsString();
                    break;

                case DependencyContextStrings.RuntimeStoreManifestPropertyName:
                    runtimeStoreManifestName = reader.ReadAsString();
                    break;

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

            reader.CheckEndObject();

            return(new LibraryStub()
            {
                Hash = hash,
                Type = Pool(type),
                Serviceable = serviceable,
                Path = path,
                HashPath = hashPath,
                RuntimeStoreManifestName = runtimeStoreManifestName
            });
        }
Exemplo n.º 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));
        }