예제 #1
0
 public SourceCodeInfo.Types.Location GetDoc(IEnumerable <int> path)
 {
     if (path == null)
     {
         return(null);
     }
     return(DocFactory.GetDoc(
                path?.Prepend(Message).Prepend(fieldId).ToArray()
                ));
 }
예제 #2
0
        static void WorkSingleBinFile(string file)
        {
            if (settings.Verbose)
            {
                Console.WriteLine($"Read protobuf descriptor of {file}...");
            }
            FileDescriptorSet descriptor;

            using var stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            try { descriptor = FileDescriptorSet.Parser.ParseFrom(stream); }
            catch (Exception e)
            {
                Console.Error.WriteLine(e);
                return;
            }

            var docs = new Docs.DocFactory(descriptor);

            if (settings.Verbose)
            {
                Console.WriteLine("Load type list...");
            }
            List <NameInfo> names = new List <NameInfo>();

            for (int i = 0; i < descriptor.File.Count; ++i)
            {
                LoadTypes(
                    descriptor.File[i],
                    new Docs.FileDocFactory(docs, i),
                    names
                    );
            }

            for (int i = 0; i < descriptor.File.Count; ++i)
            {
                var filedesc = descriptor.File[i];
                var filedoc  = new Docs.FileDocFactory(docs, i);
                for (int j = 0; j < filedesc.Service.Count; ++j)
                {
                    WorkSingleEntry(
                        new Docs.ServiceDocFactory(filedoc, j),
                        filedesc,
                        filedesc.Service[j],
                        names,
                        file
                        );
                }
            }
        }
예제 #3
0
 public FileDocFactory(DocFactory docFactory, int fileIndex)
 {
     this.docFactory = docFactory ?? throw new ArgumentNullException(nameof(docFactory));
     file            = fileIndex;
 }