示例#1
0
        /// <summary>
        /// Gets all Asar current defines. They're safe to keep for as long as you want.
        /// </summary>
        /// <returns>All Asar's defines.</returns>
        public static Asardefine[] getalldefines()
        {
            RawAsarDefine *ptr = asar_getalldefines(out int length);

            Asardefine[] output = new Asardefine[length];

            // Copy unmanaged to managed memory to avoid potential errors in case the area
            // gets cleared by Asar.
            for (int i = 0; i < length; i++)
            {
                output[i].Name     = Marshal.PtrToStringAnsi(ptr[i].name);
                output[i].Contents = Marshal.PtrToStringAnsi(ptr[i].contents);
            }

            return(output);
        }
示例#2
0
        /// <summary>
        /// Gets all Asar current defines. They're safe to keep for as long as you want.
        /// </summary>
        /// <returns>All Asar's defines.</returns>
        public static Asardefine[] getalldefines()
        {
            int            length = 0;
            Rawasardefine *ptr    = asar_getalldefines(out length);

            Asardefine[] output = new Asardefine[length];

            // Better create a new array
            // to avoid pointer erros, corruption and may other problems.
            for (int i = 0; i < length; i++)
            {
                output[i].Name     = Marshal.PtrToStringAnsi(ptr[i].name);
                output[i].Contents = Marshal.PtrToStringAnsi(ptr[i].contents);
            }

            return(output);
        }