Exemple #1
0
        Dictionary <string, string> DumpOptions(FileDescriptorProto source, FileOptions options)
        {
            var optionsKv = new Dictionary <string, string>();

            if (options == null)
            {
                return(optionsKv);
            }

            if (options.ShouldSerializedeprecated())
            {
                optionsKv.Add("deprecated", options.deprecated ? "true" : "false");
            }
            if (options.ShouldSerializeoptimize_for())
            {
                optionsKv.Add("optimize_for", $"{options.optimize_for}");
            }
            if (options.ShouldSerializecc_generic_services())
            {
                optionsKv.Add("cc_generic_services", options.cc_generic_services ? "true" : "false");
            }
            if (options.ShouldSerializego_package())
            {
                optionsKv.Add("go_package", $"\"{options.go_package}\"");
            }
            if (options.ShouldSerializejava_package())
            {
                optionsKv.Add("java_package", $"\"{options.java_package}\"");
            }
            if (options.ShouldSerializejava_outer_classname())
            {
                optionsKv.Add("java_outer_classname", $"\"{options.java_outer_classname}\"");
            }
            if (options.ShouldSerializejava_generate_equals_and_hash())
            {
                optionsKv.Add("java_generate_equals_and_hash", options.java_generate_equals_and_hash ? "true" : "false");
            }
            if (options.ShouldSerializejava_generic_services())
            {
                optionsKv.Add("java_generic_services", options.java_generic_services ? "true" : "false");
            }
            if (options.ShouldSerializejava_multiple_files())
            {
                optionsKv.Add("java_multiple_files", options.java_multiple_files ? "true" : "false");
            }
            if (options.ShouldSerializejava_string_check_utf8())
            {
                optionsKv.Add("java_string_check_utf8", options.java_string_check_utf8 ? "true" : "false");
            }
            if (options.ShouldSerializepy_generic_services())
            {
                optionsKv.Add("py_generic_services", options.py_generic_services ? "true" : "false");
            }

            DumpOptionsMatching(source, ".google.protobuf.FileOptions", options, optionsKv);

            return(optionsKv);
        }