示例#1
0
        //--------------------------- Retorna as informações da iso de Wii
        public static Int32 GetIsoInformation(String file, out string code, out string name, out int region, out long used)
        {
            code   = "";
            name   = "";
            region = -1;
            used   = 0;

            IIOContext context = IOManager.CreateIOContext("ISWIIISO", file, FileAccess.Read, FileShare.ReadWrite,
                                                           0, FileMode.Open, EFileAttributes.None);

            if (context.Result != (int)IORet.RET_IO_OK)
            {
                //Loga erro
                return(context.Result);
            }

            int r = 0;

            WiiDisc d = new WiiDisc(context, false);

            d.Open();
            r = d.BuildDisc(PartitionSelection.OnlyGamePartition);
            if (r == 0)
            {
                name = d.name;
                code = d.code;
                used = d.UsedSectors;

                Byte[] bregion = new byte[4];
                if (context.Read(bregion, WBFSDevice.IsoRegionPos, 4) != IORet.RET_IO_OK)
                {
                    //Loga erro

                    region = -1;
                }
                else
                {
                    region = (int)System.Net.IPAddress.NetworkToHostOrder((int)BitConverter.ToUInt32(bregion, 0));
                }

                bregion = null;
                d.Close();
                context.Close();

                return(0);
            }
            else
            {
                d.Close();
                context.Close();

                return(r);
            }
        }
示例#2
0
        //--------------------------- Retorna as informações da iso de Wii
        public static Int32 GetIsoInformation(String file, out string code, out string name, out long used)
        {
            code = "";
            name = "";
            used = 0;

            IIOContext context = IOManager.CreateIOContext("ISWIIISO", file, FileAccess.Read, FileShare.ReadWrite,
                                                           0, FileMode.Open, EFileAttributes.None);

            if (context.Result != (int)IORet.RET_IO_OK)
            {
                //Loga erro
                return(context.Result);
            }

            int r = 0;

            WiiDisc d = new WiiDisc(context, false);

            d.Open();
            r = d.BuildDisc(PartitionSelection.OnlyGamePartition);
            if (r == 0)
            {
                name = d.name;
                code = d.code;
                used = d.UsedSectors;

                d.Close();
                context.Close();

                return(0);
            }
            else
            {
                d.Close();
                context.Close();

                return(r);
            }
        }