示例#1
0
func printFile(gen *Generator, file *pbmeta.FileDescriptor) {

	gen.Println("// Generated by github.com/davyxu/protoc-gen-sharpnet")
	gen.Println("// DO NOT EDIT!")
	gen.Println("// Source: ", file.FileName())

	gen.In()
	for _, v := range file.Define.Dependency {
		gen.Println("// ", v)
	}
	gen.Out()

	gen.Println("namespace ", file.PackageName())
	gen.Println("{")
	gen.In()

	for i := 0; i < file.MessageCount(); i++ {

		msg := file.Message(i)
		printMessage(gen, msg, file)
	}

	gen.Println()

	for i := 0; i < file.EnumCount(); i++ {

		enum := file.Enum(i)
		printEnum(gen, enum)
	}

	gen.Out()
	gen.Println("}")
}
示例#2
0
func printFile(gen *Generator, file *pbmeta.FileDescriptor) {

	gen.Println("// This code is generated by github.com/davyxu/protoc-gen-sharpnet, DO NOT EDIT")
	gen.Println("// Generated from: ", file.FileName())

	for _, v := range file.Define.Dependency {
		gen.Println("// Note: requires additional type generated from: ", v)
	}

	gen.Println("namespace ", file.PackageName())
	gen.Println("{")
	gen.In()

	for i := 0; i < file.MessageCount(); i++ {

		msg := file.Message(i)
		printMessage(gen, msg, file)
	}

	gen.Println()

	for i := 0; i < file.EnumCount(); i++ {

		enum := file.Enum(i)
		printEnum(gen, enum)
	}

	gen.Out()
	gen.Println("}")
}