Esempio n. 1
0
 public virtual void Func_22091_b()
 {
     try
     {
         string file = System.IO.Path.Combine(worldDir, "session.lock");
         using (FileStream fs = File.OpenRead(file))
         {
             java.io.DataInputStream datainputstream = new java.io.DataInputStream(fs);
             try
             {
                 if (datainputstream.ReadLong() != field_22100_d)
                 {
                     throw new net.minecraft.src.MinecraftException("The save is being accessed from another location, aborting"
                                                                    );
                 }
             }
             finally
             {
                 datainputstream.Close();
             }
         }
     }
     catch (System.IO.IOException)
     {
         throw new net.minecraft.src.MinecraftException("Failed to check session lock, aborting"
                                                        );
     }
 }
 // Referenced classes of package net.minecraft.src:
 //            NBTBase, NBTTagCompound
 /// <exception cref="System.IO.IOException"/>
 public static net.minecraft.src.NBTTagCompound ReadCompoundFromStream(Stream inputstream)
 {
     using (Stream s = new GZipStream(inputstream, CompressionMode.Decompress))
     {
         java.io.DataInputStream datainputstream = new java.io.DataInputStream(s);
         try
         {
             net.minecraft.src.NBTTagCompound nbttagcompound = GetCompound(datainputstream);
             return(nbttagcompound);
         }
         finally
         {
             datainputstream.Close();
         }
     }
 }
Esempio n. 3
0
        private void Func_22107_a(string file, List <ChunkFile> arraylist, int i, int j, net.minecraft.src.IProgressUpdate iprogressupdate)
        {
            arraylist.Sort();
            byte[] abyte0 = new byte[4096];
            int    i1;

            for (System.Collections.IEnumerator iterator = arraylist.GetEnumerator(); iterator
                 .MoveNext(); iprogressupdate.SetLoadingProgress(i1))
            {
                net.minecraft.src.ChunkFile chunkfile = (net.minecraft.src.ChunkFile)iterator.Current;
                int k = chunkfile.Func_22205_b();
                int l = chunkfile.Func_22204_c();
                net.minecraft.src.RegionFile regionfile = net.minecraft.src.RegionFileCache.Func_22123_a
                                                              (file, k, l);
                if (!regionfile.IsChunkSaved(k & 0x1f, l & 0x1f))
                {
                    try
                    {
                        using (FileStream fs = File.OpenRead(chunkfile.Func_22207_a()))
                            using (GZipStream ds = new GZipStream(fs, CompressionMode.Decompress))
                            {
                                java.io.DataInputStream datainputstream = new java.io.DataInputStream(ds);
                                //java.io.DataInputStream datainputstream = new java.io.DataInputStream(new java.util.zip.GZIPInputStream(new java.io.FileInputStream(chunkfile.Func_22207_a())));
                                java.io.DataOutputStream dataoutputstream = regionfile.GetChunkDataOutputStream(k & 0x1f, l & 0x1f);
                                for (int j1 = 0; (j1 = datainputstream.Read(abyte0)) != -1;)
                                {
                                    dataoutputstream.Write(abyte0, 0, j1);
                                }
                                dataoutputstream.Close();
                                datainputstream.Close();
                            }
                    }
                    catch (System.IO.IOException ioexception)
                    {
                        Sharpen.Runtime.PrintStackTrace(ioexception);
                    }
                }
                i++;
                i1 = (int)System.Math.Round((100D * (double)i) / (double)j);
            }
            net.minecraft.src.RegionFileCache.Func_22122_a();
        }
Esempio n. 4
0
 private void Func_28174_b()
 {
     try
     {
         field_28181_d.Clear();
         if (field_28180_a == null)
         {
             return;
         }
         string file = field_28180_a.Func_28111_b("idcounts");
         if (file != null && File.Exists(file))
         {
             java.io.DataInputStream          datainputstream = new java.io.DataInputStream(File.OpenRead(file));
             net.minecraft.src.NBTTagCompound nbttagcompound  = net.minecraft.src.CompressedStreamTools
                                                                .GetCompound(datainputstream);
             datainputstream.Close();
             System.Collections.IEnumerator iterator = nbttagcompound.Func_28107_c().GetEnumerator
                                                           ();
             do
             {
                 if (!iterator.MoveNext())
                 {
                     break;
                 }
                 net.minecraft.src.NBTBase nbtbase = (net.minecraft.src.NBTBase)iterator.Current;
                 if (nbtbase is net.minecraft.src.NBTTagShort)
                 {
                     net.minecraft.src.NBTTagShort nbttagshort = (net.minecraft.src.NBTTagShort)nbtbase;
                     string s     = nbttagshort.GetKey();
                     short  word0 = nbttagshort.shortValue;
                     field_28181_d[s] = word0;
                 }
             }while (true);
         }
     }
     catch (System.Exception exception)
     {
         Sharpen.Runtime.PrintStackTrace(exception);
     }
 }