Example #1
0
 private static string CommandActionToken(AbstractBaseRecord record)
 {
     if (!record.InUse())
     {
         return("deleted");
     }
     if (record.Created)
     {
         return("created");
     }
     return("updated");
 }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void readStore(org.neo4j.io.fs.FileSystemAbstraction fileSystem, org.neo4j.kernel.impl.store.RecordStore store, long fromId, long toId, java.util.regex.Pattern pattern) throws java.io.IOException
        private static void ReadStore(FileSystemAbstraction fileSystem, RecordStore store, long fromId, long toId, Pattern pattern)
        {
            toId = Math.Min(toId, store.HighId);
            using (StoreChannel channel = fileSystem.Open(store.StorageFile, OpenMode.READ))
            {
                int        recordSize = store.RecordSize;
                ByteBuffer buf        = ByteBuffer.allocate(recordSize);
                for (long i = fromId; i <= toId; i++)
                {
                    buf.clear();
                    long offset = recordSize * i;
                    int  count  = channel.Read(buf, offset);
                    if (count == -1)
                    {
                        break;
                    }
                    sbyte[] bytes = new sbyte[count];
                    buf.clear();
                    buf.get(bytes);
                    string hex           = HexString.encodeHexString(bytes);
                    int    paddingNeeded = (recordSize * 2 - Math.Max(count * 2, 0)) + 1;
                    string format        = "%s %6s 0x%08X %s%" + paddingNeeded + "s%s%n";
                    string str;
                    string use;

                    try
                    {
                        AbstractBaseRecord record = RecordStore.getRecord(store, i, CHECK);
                        use = record.InUse() ? "+" : "-";
                        str = record.ToString();
                    }
                    catch (InvalidRecordException)
                    {
                        str = StringHelper.NewString(bytes, 0, count, "ASCII");
                        use = "?";
                    }

                    if (pattern == null || pattern.matcher(str).find())
                    {
                        _console.printf(format, use, i, offset, hex, " ", str);
                    }
                }
            }
        }