Example #1
0
 public Flash(double capacity, string name, string model, int speed, USBType uSBType) : base(capacity)
 {
     this.speed   = speed;
     this.USBType = uSBType;
     this.name    = name;
     this.model   = model;
     this.memory  = capacity;
 }
    void Start()
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
        FechaHora.text = System.DateTime.Now.AddHours(-3).ToShortTimeString() + "\n" + System.DateTime.Now.AddHours(-3).ToLongDateString();
        StartCoroutine(ActualizarFechaHora());



        if (Application.platform == RuntimePlatform.PS4)
        {
            /*Uncomment when test is sucsesfull */
            try
            {
                FreeMountUsb();
            }
            catch (Exception ex) { txtCamino.text = "Failed to free mount usb's " + ex.Message; }
        }

        string path = @"G:\Games\Playstation\PS2";

        var charDataFile = Resources.Load <TextAsset>("PS2DB");
        //StreamReader reader = new StreamReader(ms, System.Text.Encoding.UTF8, true);
        StreamReader reader = new StreamReader(new MemoryStream(charDataFile.bytes));

        DataTable     dttemp    = ConvertToDataTable(reader);
        List <string> lstofisos = new List <string> ();

        USBType typeofusb = USBType.None;

        string USBPath0    = "/usb0/PS2/";
        string USBPath1    = "/usb1/PS2/";
        string mntUsbPath0 = "mnt/usb0/PS2/";
        string mntUsbPath1 = "mnt/usb0/PS2/";

        if (Directory.Exists(USBPath0) || Directory.Exists(mntUsbPath0))
        {
            typeofusb = USBType.USB0;
        }
        if (Directory.Exists(USBPath1) || Directory.Exists(mntUsbPath1))
        {
            typeofusb = USBType.USB1;
        }
        if (typeofusb == USBType.None)
        {
            //no usb found
            //or no path found
        }



        DirectoryInfo d = null;

        if (typeofusb == USBType.USB0)
        {
            camino = "/usb0/ps2/";
            d      = new DirectoryInfo(USBPath0);
        }

        if (typeofusb == USBType.USB1)
        {
            camino = "/usb1/ps2/";
            d      = new DirectoryInfo(USBPath1);
        }
        if (typeofusb == USBType.None)
        {
            d = new DirectoryInfo(path);
        }
        if (Directory.Exists(d.FullName))
        {
            FileInfo[] fileinfo = d.GetFiles("*.iso");
            foreach (var item in fileinfo)
            {
                //load each ps2 iso item into
                //our custom db
                lstofisos.Add(item.FullName);
            }
        }

        List <PS2Items> items = new List <PS2Items> ();

        for (int i = 0; i < lstofisos.Count; i++)
        {
            //read asb data
            string id          = GetPS2ID(lstofisos [i]);
            var    exmapleitem = new PS2Items();
            exmapleitem.PS2ID = id;
            //exmapleitem.Message = id;// (id,dttemp);
            exmapleitem.Path      = lstofisos[i];
            exmapleitem.PS2_Title = GetNameFromID(id, dttemp);
            exmapleitem.Region    = GetRegionFromID(id, dttemp);
            exmapleitem.Picture   = GetImageFromID(id, dttemp);
            items.Add(exmapleitem);
        }

        listofgames = items;
        CrearDirectorio(items);

        posOriginal  = PanelVideo.transform.localPosition;
        sizeOriginal = PanelVideo.GetComponent <RectTransform>().sizeDelta;
    }