public BlockLeaf(CoreDumpFileTop top_a, Stream st, long first_frame = 0, bool no_write = false) : base(top_a, st.Position, first_frame) { configuration |= (byte)config_flags.BASE;//mis en mode base FileSource = st; if (!no_write) { WriteHeader(FileSource); } }
public BlockFileTree(CoreDumpFileTop top_a, Stream st, Int32 d, long first_frame = 0, bool no_write = false) : base(top_a, st, d, first_frame, true) { FileSource = st; depth = d; SetExternFile(); if (!no_write) { WriteHeader(FileSource); //on prend en compte la taille du header CreateNewChild(CurrentNodeFile); //on descend jusqu'en bas de l'abre } }
protected BlockType Child;//chaque arbre n'as qu'un seul enfant actif les autres sont des Bloc Encodé public BlockTree(CoreDumpFileTop top_a, Stream st, Int32 d, long first_frame = 0, bool no_write = false) : base(top_a, st.Position, first_frame) { FileSource = st; depth = d; if (!no_write) { WriteHeader(FileSource); //on prend en compte la taille du header CreateNewChild(FileSource); //on descend jusqu'en bas de l'abre } }
static bool test_retrieve(long nb, Stream frame, CoreDumpFileTop test) { //try //{ Console.WriteLine("test f=" + nb); ; Stopwatch sw = new Stopwatch(); sw.Start(); Stream a = test.RetriveFrame(nb); sw.Stop(); Console.WriteLine("temps écoulé =" + sw.Elapsed); //File.Delete("../../res.temp"); using (MemoryStream res = new MemoryStream()) { a.Seek(0, SeekOrigin.Begin); a.CopyTo(res); res.Seek(0, SeekOrigin.Begin); byte b, b2; frame.Seek(0, SeekOrigin.Begin); do { b = (byte)res.ReadByte(); b2 = (byte)frame.ReadByte(); } while (b == b2 && frame.Position != frame.Length); if (b != b2) { Console.WriteLine("echec de " + nb + ": " + frame.Position + "/" + frame.Length); throw new Exception(); } else { Console.WriteLine("réussite de f=" + nb); } Console.WriteLine("fini test"); res.Close(); } return(true); /*}catch(Exception e) * { * Console.WriteLine("echec avec exception de f=" + nb); * throw new Exception(); * return false; * }*/ }
static void rand_test(int ntry, int n_frame, Stream frame, CoreDumpFileTop test) { Random rand = new Random(); int i; for (i = 0; i < ntry; i++) { if (!test_retrieve(rand.Next(0, n_frame), frame, test)) { break; } } if (i != ntry) { Console.WriteLine("echec"); } else { Console.WriteLine("sucess"); } }