Author Topic: Newest MBNCSUtil bits  (Read 8984 times)

0 Members and 1 Guest are viewing this topic.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Newest MBNCSUtil bits
« Reply #15 on: November 02, 2007, 06:15:40 pm »
I just submitted this ticket.

I don't feel like figuring out how to do diff's, especially on Windows, but here's a "patch" of sorts for it, taken from CheckRevision.cs

Code: [Select]
        /// <summary>
        /// Extracts the MPQ number from the MPQ specified by the Battle.net server.
        /// </summary>
        /// <remarks>
        /// The MPQ number is a required parameter of the CheckRevision function.  Note that the MPQ number is simply the number represented
        /// in string format in the 8th position (index 7) of the string -- for example, in "IX86ver<b>1</b>.mpq", 1 is the version number.
        /// </remarks>
        /// <param name="mpqName">The name of the MPQ file specified in the SID_AUTH_INFO message.</param>
        /// <returns>The number from 0 to 19 specifying the number in the MPQ file.</returns>
        /// <exception cref="ArgumentException">Thrown if the name of the MPQ version file is less than 8 characters long.</exception>
        /// <exception cref="ArgumentNullException">Thrown if the <i>mpqName</i> parameter is <b>null</b> (<b>Nothing</b> in Visual Basic).
        /// </exception>
        public static int ExtractMPQNumber(string mpqName)
        {
            if (mpqName == null)
                throw new ArgumentNullException("mpqName", Resources.crMpqNameNull);

            if (mpqName.Length < 7)
                throw new ArgumentException(Resources.crMpqNameArgShort);

            string mpqNameLower = mpqName.ToLower();
            int num = -1;

            // ver-IX86-X.mpq
            if (mpqNameLower.StartsWith("ver"))
            {
                num = int.Parse(mpqName[9].ToString());
            }
            // lockdown-IX86-XX.mpq
            else if (mpqNameLower.StartsWith("lockdown"))
            {
                num = int.Parse(mpqName[14].ToString() + mpqName[15].ToString());
            }
            // IX86VerX.mpq
            else
            {
                num = int.Parse(mpqName[7].ToString());
            }

            return num;
        }

EDIT -
Nevermind -- I'm a retard.
« Last Edit: November 02, 2007, 06:23:51 pm by Joe[x86] »
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Camel

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
    • BNU Bot
Re: Newest MBNCSUtil bits
« Reply #16 on: November 02, 2007, 07:40:26 pm »
diff file1 file2

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!