/// <summary> /// 获取文件系统 /// </summary> /// <param name="device"></param> /// <param name="iAsync"></param> /// <returns></returns> public FNodeX GetFileSystem(IFileSystemDevice device, SingleTaskReporterBase iAsync) { IAsync = iAsync; CreateFileServiceAbstractX(device, iAsync); if (fileServiceX == null) { return(null); } _systemTree = fileServiceX.GetFileSystem(); return(_systemTree); }
private void CreateFileServiceAbstractX(IFileSystemDevice device, SingleTaskReporterBase iAsync) { if (device is MirrorDevice) { fileServiceX = new MirrorDeviceService(device, iAsync); } else if (device is SDCardDevice) { fileServiceX = new SDCardDeviceService(device, iAsync); } else if (device is CellbriteDevice) { fileServiceX = new CellbriteDeviceService(device, iAsync); } else if (device is CottageDevice) { fileServiceX = new CottageMirrorDeviceService(device, iAsync); } }
public MTPFileNode GetRootFileNode(MTPDevice device, SingleTaskReporterBase asyn) { MTPFileNode root = new MTPFileNode() { Type = MTPFileNodeType.Root, Name = "Root", Childrens = new List <MTPFileNode>(), Level = -1 }; IPortableDeviceContent content = GetDeviceContent(device.DeviceId); IPortableDeviceProperties properties; content.Properties(out properties); IPortableDeviceValues deviceValues; properties.GetValues("DEVICE", null, out deviceValues); List <string> storagesId = GetChildrenObjectIds(content, "DEVICE"); //获取存储卡设备 //asyn.Advance(0, string.Format("获取到{0}个存储设备", storagesId.Count)); foreach (string storageId in storagesId) { MTPFileNode deviceNode = new MTPFileNode() { Type = MTPFileNodeType.Device, Name = GetNameById(storageId, properties), Id = storageId, Childrens = new List <MTPFileNode>(), Parent = root, //Level = 0 }; root.Childrens.Add(deviceNode); } foreach (var parentNode in root.Childrens) { //asyn.Advance(0, string.Format(LanguageHelper.Get("LANGKEY_KaiShiHuoQuDeWenJianXiTong_00553"), parentNode.Name)); List <string> objectsId = GetChildrenObjectIds(content, parentNode.Id); if (objectsId != null && objectsId.Count > 0) { foreach (string objectId in objectsId) { IPortableDeviceValues objectValues; properties.GetValues(objectId, null, out objectValues); MTPFileNode fileNode = new MTPFileNode() { Type = GetFileTypeProperty(objectValues), Name = GetFullNameProperty(objectValues), //FileSize = GetFileSizeProperty(objectValues), Id = objectId, Childrens = new List <MTPFileNode>(), Parent = parentNode, //Level = parentNode.Level + 1 }; parentNode.Childrens.Add(fileNode); //asyn.Advance(10.0 / root.Childrens.Count / objectsId.Count, string.Format(LanguageHelper.Get("LANGKEY_HuoQuJieDian_00554"), fileNode.Name)); if (fileNode.Type != MTPFileNodeType.File) { CreateTree(fileNode, content, properties, asyn); } } } } return(root); }
/// <summary> /// 拷贝指定文件 /// </summary> /// <param name="source">原始路径</param> /// <param name="targetPath">目标拷贝路径</param> /// <param name="asyn"></param> /// <returns></returns> public string CopyFile(string source, string targetPath, SingleTaskReporterBase asyn) { return(DeviceManager.CopyFile(this, source, targetPath, asyn)); }