示例#1
0
        private static void Skip(string filePath, string fromDictionaryPath)
        {
            VerifyFileExists(filePath);
            VerifyFileExists(fromDictionaryPath);

            using (new ConsoleWatch($"Reading [Skip All] {filePath} ({FileLength.MB(filePath)})..."))
            {
                if (filePath.EndsWith(".bion", StringComparison.OrdinalIgnoreCase))
                {
                    using (WordCompressor compressor = (fromDictionaryPath == null ? null : WordCompressor.OpenRead(fromDictionaryPath)))
                        using (BionReader reader = new BionReader(File.OpenRead(filePath), compressor: compressor))
                        {
                            reader.Skip();
                        }
                }
                else
                {
                    using (JsonTextReader reader = new JsonTextReader(new StreamReader(filePath)))
                    {
                        reader.Read();
                        reader.Skip();
                    }
                }
            }
        }
示例#2
0
        private void WriteRunSubsetStart(JsonTextWriter writer)
        {
            int depth = _bionReader.Depth;

            // Read and copy everything in the run until the end object except the large collections
            while (_bionReader.Read() && _bionReader.Depth > depth)
            {
                if (_bionReader.TokenType == BionToken.PropertyName)
                {
                    String8 propertyName = _bionReader.CurrentString8();
                    if (propertyName.Equals(Files) || propertyName.Equals(Results))
                    {
                        _bionReader.Skip();
                        continue;
                    }
                }

                JsonBionConverter.WriteToken(_bionReader, writer);
            }

            // Start a results array and leave open
            writer.WritePropertyName("results");
            writer.WriteStartArray();
        }