News:

Who uses forums anymore?

Main Menu

Newest MBNCSUtil bits

Started by MyndFyre, October 09, 2007, 03:35:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joe

#15
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

        /// <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.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Camel


<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!