public static sbyte[] loadData(string arg0, int arg1, sbyte[] arg2, sbyte[] arg3)
        {
            //return org.moparscape.msc.client.DataOperations.loadData(objName, objData, arg2, arg3);
            // Debug.Log(arg0);

            int i = (arg2[0] & 0xff) * 256 + (arg2[1] & 0xff);
            int j = 0;

            arg0 = arg0.ToUpper();
            for (int k = 0; k < arg0.Length; k++)
            {
                j = (j * 61 + arg0[k]) - 32;
            }

            int l = 2 + i * 10;

            for (int i1 = 0; i1 < i; i1++)
            {
                int j1 = (arg2[i1 * 10 + 2] & 0xff) * 0x1000000 + (arg2[i1 * 10 + 3] & 0xff) * 0x10000 + (arg2[i1 * 10 + 4] & 0xff) * 256 + (arg2[i1 * 10 + 5] & 0xff);
                int k1 = (arg2[i1 * 10 + 6] & 0xff) * 0x10000 + (arg2[i1 * 10 + 7] & 0xff) * 256 + (arg2[i1 * 10 + 8] & 0xff);
                int l1 = (arg2[i1 * 10 + 9] & 0xff) * 0x10000 + (arg2[i1 * 10 + 10] & 0xff) * 256 + (arg2[i1 * 10 + 11] & 0xff);
                if (j1 == j)
                {
                    if (arg3 == null)
                    {
                        arg3 = new sbyte[k1 + arg1];
                    }
                    if (k1 != l1)
                    {
                        DataFileDecrypter.unpackData(arg3, k1, arg2, l1, l);
                    }
                    else
                    {
                        for (long i2 = 0; i2 < k1; i2++)
                        {
                            arg3[i2] = arg2[l + i2];
                        }
                    }
                    return(arg3);
                }
                l += l1;
            }

            return(null);
        }
예제 #2
0
		public static sbyte[] UnpackData(String arg0, String arg1, int arg2)
		{
			sbyte[] abyte0 = link.getFile(arg0);
			if (abyte0 != null)
			{
				//	Debug.Log(arg0 + " loaded");

				int l = ((abyte0[0] & 0xff) << 16) + ((abyte0[1] & 0xff) << 8) + (abyte0[2] & 0xff);
				int i1 = ((abyte0[3] & 0xff) << 16) + ((abyte0[4] & 0xff) << 8) + (abyte0[5] & 0xff);

				sbyte[] abyte1 = new sbyte[abyte0.Length - 6];
				for (int j1 = 0; j1 < abyte0.Length - 6; j1++)
					abyte1[j1] = abyte0[j1 + 6];

				//	drawLoadingBarText(arg2, "Unpacking " + arg1);
				if (i1 != l)
				{
					sbyte[] abyte2 = new sbyte[l];
					DataFileDecrypter.unpackData(abyte2, l, abyte1, i1, 0);
					//if (OnContentLoaded != null)
					//{
					//	OnContentLoaded(this, new ContentLoadedEventArgs("Unpacking " + arg1, arg2));
					//}
					return abyte2;
				}
				else
				{
					//if (OnContentLoaded != null)
					//{
					//	OnContentLoaded(this, new ContentLoadedEventArgs("Unpacking " + arg1, arg2));
					//}
					return abyte1;
				}
			}
			else
			{
				//if (OnContentLoaded != null)
				//{
				//	OnContentLoaded(this, new ContentLoadedEventArgs("Unpacking " + arg1, arg2));
				//}
				return UnpackDataBase(arg0, arg1, arg2);
			}
		}
        public static byte[] loadData(string arg0, int arg1, byte[] arg2, byte[] arg3)
        {
            int i = (arg2[0] & 0xff) * 256 + (arg2[1] & 0xff);
            int j = 0;

            arg0 = arg0.ToUpper();
            for (int k = 0; k < arg0.Length; k++)
            {
                j = (j * 61 + arg0[k]) - 32;
            }

            int l = 2 + i * 10;

            for (int i1 = 0; i1 < i; i1++)
            {
                int j1 = (arg2[i1 * 10 + 2] & 0xff) * 0x1000000 + (arg2[i1 * 10 + 3] & 0xff) * 0x10000 + (arg2[i1 * 10 + 4] & 0xff) * 256 + (arg2[i1 * 10 + 5] & 0xff);
                int k1 = (arg2[i1 * 10 + 6] & 0xff) * 0x10000 + (arg2[i1 * 10 + 7] & 0xff) * 256 + (arg2[i1 * 10 + 8] & 0xff);
                int l1 = (arg2[i1 * 10 + 9] & 0xff) * 0x10000 + (arg2[i1 * 10 + 10] & 0xff) * 256 + (arg2[i1 * 10 + 11] & 0xff);
                if (j1 == j)
                {
                    if (arg3 == null)
                    {
                        arg3 = new byte[k1 + arg1];
                    }
                    if (k1 != l1)
                    {
                        DataFileDecrypter.unpackData(arg3, k1, arg2, l1, l);
                    }
                    else
                    {
                        for (long i2 = 0; i2 < k1; i2++)
                        {
                            arg3[i2] = arg2[l + i2];
                        }
                    }
                    return(arg3);
                }
                l += l1;
            }

            return(null);
        }
예제 #4
0
		public static sbyte[] UnpackDataBase(String filename, String fileTitle, int startPercentage)
		{

			Debug.Log("Using default load");
			int i = 0;
			int k = 0;
			sbyte[] abyte0 = link.getFile(filename);
			if (abyte0 == null)
			{
				try
				{
					Debug.Log("Loading " + fileTitle + " - 0%");
					// drawLoadingBarText(startPercentage, "Loading " + fileTitle + " - 0%");
					var inputstream = new BinaryReader(DataOperations.openInputStream(filename));
					//DataInputStream datainputstream = new DataInputStream(inputstream);
					sbyte[] abyte2 = new sbyte[6] {
                        inputstream.ReadSByte(),inputstream.ReadSByte(),inputstream.ReadSByte(),
                        inputstream.ReadSByte(),inputstream.ReadSByte(),inputstream.ReadSByte()
                    };

					//inputstream.Read(abyte2, 0, 6);
					i = ((abyte2[0] & 0xff) << 16) + ((abyte2[1] & 0xff) << 8) + (abyte2[2] & 0xff);
					k = ((abyte2[3] & 0xff) << 16) + ((abyte2[4] & 0xff) << 8) + (abyte2[5] & 0xff);



					Debug.Log("Loading " + fileTitle + " - 5%");
					// drawLoadingBarText(startPercentage, "Loading " + fileTitle + " - 5%");

					// int l = 0;
					int l = 6;
					abyte0 = new sbyte[k];
					while (l < k)
					{
						int i1 = k - l;
						if (i1 > 1000)
							i1 = 1000;

						for (int t = 0; t < i1; t++)
							abyte0[l + t] = inputstream.ReadSByte();

						// inputstream.Read(abyte0, l, i1);

						l += i1;
						Debug.Log("Loading " + fileTitle + " - " + (5 + (l * 95) / k) + "%");
						//	drawLoadingBarText(startPercentage, "Loading " + fileTitle + " - " + (5 + (l * 95) / k) + "%");
					}

					inputstream.Close();
				}
				catch (IOException _ex) { }
			}

			Debug.Log("Unpacking " + fileTitle);
			//drawLoadingBarText(startPercentage, "Unpacking " + fileTitle);
			if (k != i)
			{
				sbyte[] abyte1 = new sbyte[i];
				DataFileDecrypter.unpackData(abyte1, i, abyte0, k, 0);
				return abyte1;
			}
			else
			{
				//  return unpackData(filename, fileTitle, startPercentage); // abyte0;
				return abyte0;
			}
		}