Advertisement
Neo-Craft

D2P

Apr 7th, 2012
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.83 KB | None | 0 0
  1. using Microsoft.VisualBasic;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Diagnostics;
  7.  
  8. public class D2P
  9. {
  10.  
  11.     private static Dictionary<string, object[]> _indexes = new Dictionary<string, object[]>();
  12.  
  13.     private static Dictionary<string, string> _properties = new Dictionary<string, string>();
  14.     private static string readutf(EndianBinaryReader reader)
  15.     {
  16.  
  17.         int len = reader.ReadInt16;
  18.  
  19.         return Encoding.Default.GetString(reader.ReadBytes(len));
  20.  
  21.     }
  22.  
  23.     public static void initStream(string URI)
  24.     {
  25.         EndianBinaryReader _loc_6 = default(EndianBinaryReader);
  26.         int _loc_7 = 0;
  27.         int _loc_8 = 0;
  28.         UInt32 _loc_9 = default(UInt32);
  29.         UInt32 _loc_10 = default(UInt32);
  30.         UInt32 _loc_11 = default(UInt32);
  31.         UInt32 _loc_12 = default(UInt32);
  32.         UInt32 _loc_13 = default(UInt32);
  33.         UInt32 _loc_14 = default(UInt32);
  34.         string _loc_15 = null;
  35.         string _loc_16 = null;
  36.         UInt32 _loc_17 = default(UInt32);
  37.         string _loc_18 = null;
  38.         int _loc_19 = 0;
  39.         int _loc_20 = 0;
  40.         int _loc_21 = 0;
  41.         string _loc_2 = URI;
  42.         string _loc_3 = URI;
  43.  
  44.  
  45.         while ((_loc_3 != null)) {
  46.             _loc_6 = new EndianBinaryReader(MiscUtil.Conversion.EndianBitConverter.Big, new FileStream(_loc_3, FileMode.Open));
  47.             _loc_7 = _loc_6.ReadByte;
  48.             _loc_8 = _loc_6.ReadByte;
  49.             if (_loc_7 != 2 && _loc_8 != 1)
  50.                 return;
  51.             _loc_6.BaseStream.Position = _loc_6.BaseStream.Length - 24;
  52.             _loc_9 = _loc_6.ReadUInt32;
  53.             _loc_10 = _loc_6.ReadUInt32;
  54.             _loc_11 = _loc_6.ReadUInt32;
  55.             _loc_12 = _loc_6.ReadUInt32;
  56.             _loc_13 = _loc_6.ReadUInt32;
  57.             _loc_14 = _loc_6.ReadUInt32;
  58.             _loc_6.BaseStream.Position = _loc_13;
  59.             _loc_3 = null;
  60.             for (int i = 0; i <= _loc_14 - 1; i++) {
  61.                 _loc_15 = readutf(_loc_6);
  62.                 _loc_16 = readutf(_loc_6);
  63.  
  64.                 _properties.Add(_loc_15 + 1000 * VBMath.Rnd(), _loc_16);
  65.  
  66.                 if (_loc_15 == "link") {
  67.                     _loc_21 = _loc_2.LastIndexOf("/");
  68.  
  69.                     if (_loc_21 != -1) {
  70.                         _loc_2 = _loc_2.Substring(0, _loc_21) + "/" + _loc_16;
  71.  
  72.  
  73.                     } else {
  74.                         _loc_2 = _loc_16;
  75.                     }
  76.                     _loc_3 = "maps/" + _loc_2;
  77.  
  78.                 }
  79.             }
  80.  
  81.  
  82.             _loc_6.BaseStream.Position = _loc_11;
  83.             _loc_17 = 0;
  84.  
  85.             while ((_loc_17 < _loc_12)) {
  86.  
  87.                 _loc_18 = readutf(_loc_6);
  88.  
  89.                 _loc_19 = _loc_6.ReadInt32;
  90.                 _loc_20 = _loc_6.ReadInt32;
  91.  
  92.                 _indexes.Add(_loc_18.Substring(_loc_18.IndexOf("/") + 1), {
  93.                     _loc_19 + _loc_9,
  94.                     _loc_20,
  95.                     _loc_6
  96.                 });
  97.  
  98.                 _loc_17 += 1;
  99.             }
  100.  
  101.         }
  102.  
  103.     }
  104.  
  105.     private static byte[] GetDlmFil(string Index)
  106.     {
  107.         byte[] functionReturnValue = null;
  108.         if (!_indexes.ContainsKey(Index))
  109.             return functionReturnValue;
  110.         EndianBinaryReader reader = _indexes[Index][2];
  111.         int o = _indexes[Index][0];
  112.         int l = _indexes[Index][1];
  113.         reader.BaseStream.Position = o;
  114.         return reader.ReadBytes(h);
  115.         return functionReturnValue;
  116.  
  117.     }
  118.  
  119.  
  120.  
  121.  
  122.  
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement