Пример #1
0
        public override bool func_22101_a(string s, IProgressUpdate iprogressupdate)
        {
            iprogressupdate.setLoadingProgress(0);
            var arraylist  = new ArrayList();
            var arraylist1 = new ArrayList();
            var arraylist2 = new ArrayList();
            var arraylist3 = new ArrayList();
            var file       = new File(field_22106_a, s);
            var file1      = new File(file, "DIM-1");

            [email protected]("Scanning folders...");
            func_22108_a(file, arraylist, arraylist1);
            if (file1.exists())
            {
                func_22108_a(file1, arraylist2, arraylist3);
            }
            int i = arraylist.size() + arraylist2.size() + arraylist1.size() + arraylist3.size();

            [email protected](
                (new StringBuilder()).append("Total conversion count is ").append(i).toString());
            func_22107_a(file, arraylist, 0, i, iprogressupdate);
            func_22107_a(file1, arraylist2, arraylist.size(), i, iprogressupdate);
            WorldInfo worldinfo = func_22103_b(s);

            worldinfo.func_22191_a(19132);
            ISaveHandler isavehandler = func_22105_a(s, false);

            isavehandler.func_22094_a(worldinfo);
            func_22109_a(arraylist1, arraylist.size() + arraylist2.size(), i, iprogressupdate);
            if (file1.exists())
            {
                func_22109_a(arraylist3, arraylist.size() + arraylist2.size() + arraylist1.size(), i, iprogressupdate);
            }
            return(true);
        }
Пример #2
0
        public bool saveChunks(bool flag, IProgressUpdate iprogressupdate)
        {
            int i = 0;
            int j = 0;

            if (iprogressupdate != null)
            {
                for (int k = 0; k < chunks.Length; k++)
                {
                    if (chunks[k] != null && chunks[k].needsSaving(flag))
                    {
                        j++;
                    }
                }
            }
            int l = 0;

            for (int i1 = 0; i1 < chunks.Length; i1++)
            {
                if (chunks[i1] == null)
                {
                    continue;
                }
                if (flag && !chunks[i1].neverSave)
                {
                    saveExtraChunkData(chunks[i1]);
                }
                if (!chunks[i1].needsSaving(flag))
                {
                    continue;
                }
                saveChunk(chunks[i1]);
                chunks[i1].isModified = false;
                if (++i == 2 && !flag)
                {
                    return(false);
                }
                if (iprogressupdate != null && ++l % 10 == 0)
                {
                    iprogressupdate.setLoadingProgress((l * 100) / j);
                }
            }

            if (flag)
            {
                if (chunkLoader == null)
                {
                    return(true);
                }
                chunkLoader.saveExtraData();
            }
            return(true);
        }
Пример #3
0
        private void func_22109_a(ArrayList arraylist, int i, int j, IProgressUpdate iprogressupdate)
        {
            int k;

            for (Iterator iterator = arraylist.iterator(); iterator.hasNext(); iprogressupdate.setLoadingProgress(k))
            {
                var    file  = (File)iterator.next();
                File[] afile = file.listFiles();
                func_22104_a(afile);
                file.delete();
                i++;
                k = (int)Math.round((100D * i) / j);
            }
        }
Пример #4
0
        private void func_22107_a(File file, ArrayList arraylist, int i, int j, IProgressUpdate iprogressupdate)
        {
            Collections.sort(arraylist);
            var abyte0 = new byte[4096];
            int i1;

            for (Iterator iterator = arraylist.iterator(); iterator.hasNext(); iprogressupdate.setLoadingProgress(i1))
            {
                var        filematcher = (FileMatcher)iterator.next();
                int        k           = filematcher.func_22205_b();
                int        l           = filematcher.func_22204_c();
                RegionFile regionfile  = RegionFileCache.func_22123_a(file, k, l);
                if (!regionfile.isChunkSaved(k & 0x1f, l & 0x1f))
                {
                    try
                    {
                        var datainputstream =
                            new DataInputStream(new GZIPInputStream(new FileInputStream(filematcher.func_22207_a())));
                        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 (IOException ioexception)
                    {
                        ioexception.printStackTrace();
                    }
                }
                i++;
                i1 = (int)Math.round((100D * i) / j);
            }

            RegionFileCache.func_22122_a();
        }
Пример #5
0
        public bool saveChunks(bool flag, IProgressUpdate iprogressupdate)
        {
            int i = 0;
            int j = 0;
            if (iprogressupdate != null)
            {
                for (int k = 0; k < chunks.Length; k++)
                {
                    if (chunks[k] != null && chunks[k].needsSaving(flag))
                    {
                        j++;
                    }
                }
            }
            int l = 0;
            for (int i1 = 0; i1 < chunks.Length; i1++)
            {
                if (chunks[i1] == null)
                {
                    continue;
                }
                if (flag && !chunks[i1].neverSave)
                {
                    saveExtraChunkData(chunks[i1]);
                }
                if (!chunks[i1].needsSaving(flag))
                {
                    continue;
                }
                saveChunk(chunks[i1]);
                chunks[i1].isModified = false;
                if (++i == 2 && !flag)
                {
                    return false;
                }
                if (iprogressupdate != null && ++l%10 == 0)
                {
                    iprogressupdate.setLoadingProgress((l*100)/j);
                }
            }

            if (flag)
            {
                if (chunkLoader == null)
                {
                    return true;
                }
                chunkLoader.saveExtraData();
            }
            return true;
        }