Esempio n. 1
0
        private void find_drive_type()
        {
            drive_type_ = drive_type.portable;

            bool is_android = false, is_phone = false, is_tablet = false, is_apple = false, is_iphone = false;

            if (friendly_name_.ToLower().StartsWith("apple"))
            {
                is_apple = true;
            }
            if (friendly_name_.ToLower().Contains(" iphone"))
            {
                is_iphone = true;
            }

            try {
                if (root_.IsFolder)
                {
                    var items = (root_.GetFolder as Folder).Items();
                    if (items.Count == 1)
                    {
                        var child = items.Item(0) as FolderItem;
                        var name  = child.Name;
                        if (child.IsFolder)
                        {
                            if (name == "Phone")
                            {
                                is_phone = true;
                            }
                            else if (name == "Tablet")
                            {
                                is_tablet = true;
                            }
                            // at this point, see if child has a sub-folder called Android
                            var folder = (child.GetFolder as Folder).ParseName("android");
                            is_android = folder != null;
                        }
                    }
                }
                if (is_phone)
                {
                    drive_type_ = is_android ? drive_type.android_phone : drive_type.iphone;
                }
                else if (is_tablet)
                {
                    drive_type_ = is_android ? drive_type.android_tablet : drive_type.ipad;
                }
                else if (is_android)
                {
                    drive_type_ = drive_type.android_unknown;
                }
                if (is_apple)
                {
                    drive_type_ = is_iphone ? drive_type.iphone : drive_type.iOS_unknown;
                }
            } catch {
                // just leave drive type as portable
            }
        }
Esempio n. 2
0
 public win_drive(DriveInfo di, IReadOnlyList <char> external_drives)
 {
     try {
         root_          = di.RootDirectory.FullName;
         drive_type_    = find_drive_type(di, external_drives);
         friendly_name_ = find_friendly_name(di);
     } catch (Exception e) {
         // "bad drive " + di + " : " + e;
         valid_ = false;
     }
 }
Esempio n. 3
0
 public static bool is_iOS(this drive_type dt)
 {
     return(dt == drive_type.iphone || dt == drive_type.ipad || dt == drive_type.iOS_unknown);
 }
Esempio n. 4
0
 public static bool is_portable(this drive_type dt)
 {
     return(dt == drive_type.android_unknown || dt == drive_type.android_phone || dt == drive_type.android_tablet || dt == drive_type.portable ||
            dt == drive_type.iphone || dt == drive_type.ipad || dt == drive_type.iOS_unknown);
 }
Esempio n. 5
0
 public static bool is_android(this drive_type dt)
 {
     return(dt == drive_type.android_unknown || dt == drive_type.android_phone || dt == drive_type.android_tablet);
 }