Ejemplo n.º 1
0
 public abstract void ForEachKnownChunk(int Dimension, ChunkIteratorDelegate cmd);
Ejemplo n.º 2
0
 public abstract void ForEachChunk(ChunkIteratorDelegate cmd);
Ejemplo n.º 3
0
        public override void ForEachChunk(ChunkIteratorDelegate cmd)
        {
            string[] f = Directory.GetFiles(mFolder, "c*.*.dat", SearchOption.AllDirectories);
            int Complete = 0;
            foreach (string file in f)
            {

                if (ForEachProgress != null)
                    ForEachProgress(f.Length, Complete++);
                //if(_DEBUG) Console.WriteLine(Path.GetExtension(file));
                if (Path.GetExtension(file) == "dat") continue;
                if (file.EndsWith(".genlock")) continue;
                NbtFile nf = new NbtFile(file);
                try
                {
                    nf.LoadFile();
                    NbtCompound Level = (NbtCompound)nf.RootTag["Level"];
                    long x = (Level["xPos"] as NbtInt).Value;
                    long y = (Level["zPos"] as NbtInt).Value;
                    nf.Dispose();
                    cmd(this, x, y);
                }
                catch (Exception e)
                {
                    if (CorruptChunk != null)
                    {
                        Vector2i pos = GetChunkCoordsFromFile(file);
                        if(pos!=null)
                            CorruptChunk(pos.X, pos.Y, "[" + Complete.ToString() + "]" + e.ToString(), file);
                    }
                    //    continue;
                }
            }
            // This MUST be done.
            ForEachProgress = null;
        }
Ejemplo n.º 4
0
 public override void ForEachKnownChunk(int dimension, ChunkIteratorDelegate cmd)
 {
     List<Vector2i> knownChunks = new List<Vector2i>(Cache.GetKnownChunks(dimension));
     int c=0;
     foreach (Vector2i pos in knownChunks)
     {
         c++;
         cmd(this, pos.X, pos.Y);
         if (ForEachProgress != null)
             ForEachProgress(knownChunks.Count, c);
     }
 }
Ejemplo n.º 5
0
 public abstract void ForEachKnownChunk(int Dimension, ChunkIteratorDelegate cmd);
Ejemplo n.º 6
0
 public abstract void ForEachChunk(ChunkIteratorDelegate cmd);