Пример #1
0
        //================================================================================================================================================
        //================================================================================================================================================
        public static int FireCallback(int messageId, string message, NativeDataType dataType)
        {
            IntPtr temppointer = Marshal.StringToHGlobalUni(message);

            NativeMessageArgs Data = new NativeMessageArgs(temppointer, messageId, dataType);

            int ReturnValue = ReportProgressFunc[0](Data);

            Console.WriteLine("Native Host Returned: {0} For NativeMessageCallback()", ReturnValue);

            Marshal.FreeHGlobal(temppointer);
            return(ReturnValue);
        }
        public NativeDataStruct_0001 Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.Struct;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            if (ReadFileMethods.treatStuffAsByteArray)
            {
                nativeDataData = binaryReader.ReadBytes(sectionSize);
                return(this);
            }

            long startSectionPosition = binaryReader.BaseStream.Position;

            nativeDataType = (NativeDataType)binaryReader.ReadInt32();
            switch (nativeDataType)
            {
            case NativeDataType.GameCube:
                try
                {
                    nativeData = new NativeDataGC(binaryReader, false);
                }
                catch
                {
                    binaryReader.BaseStream.Position = startSectionPosition + 4;
                    nativeData = new NativeDataGC(binaryReader, true);
                }
                break;

            default:
                throw new Exception();
            }

            binaryReader.BaseStream.Position = startSectionPosition + sectionSize;

            return(this);
        }
Пример #3
0
 public NativeMessageArgs(IntPtr message, int type, NativeDataType num)
 {
     Message  = message;
     Type     = type;
     DataType = num;
 }