从PC Android设备Programmaticaly访问文件 [英] Programmaticaly access files on android device from PC
问题描述
我有一个C#应用程序需要访问是在我的Android平板电脑的文件,很明显,我可以只使用已安装的驱动器号存储,但我会在多个位置进行部署这一点,需要一个一致的方式来访问文件。我能够programmaticaly叫亚行,但同样,我在多个地点部署它并不能安装在每个系统上的SDK。
I have a C# application that will need to access files that are on my android tablet, obviously I can just use the mounted drive letter for the storage but I will be deploying this at multiple locations and need a consistent way to access the files. I'm able to call ADB programmaticaly, but again, I am deploying it at multiple locations and cant install the SDK on every system.
所以我想我期待之一: 1)programmaticaly使用访问设备的C#(或Java) 或2)使用亚行,而不必安装SDK在每个位置 或3)了解所连接的设备programmaticaly的驱动器号
So I guess I'm looking to either: 1) programmaticaly access the device using C# (or java) or 2) Use ADB without having to install the SDK at each location or 3) Find out the drive letter of the attached device programmaticaly
正如你可能已经猜到我试图使这一尽可能无缝
As you could have guessed I'm trying to make this as seamless as possible
感谢您的任何建议。
P.S。这种方式工作的宏达同步,如果有人知道如何该应用程序做它,这将是完美的应用程序的一个例子。
P.S. An example of an application that works this way is HTC Sync, If anyone knows how that application does it that would be perfect.
推荐答案
下面是我想出了为你也许开始。
Here's what I came up with for you to maybe start with.
var drives = DriveInfo.GetDrives();
var removableFatDrives = drives.Where(
c=>c.DriveType == DriveType.Removable &&
c.DriveFormat == "FAT" &&
c.IsReady);
var andriods = from c in removableFatDrives
from d in c.RootDirectory.EnumerateDirectories()
where d.Name.Contains("android")
select c;
这篇关于从PC Android设备Programmaticaly访问文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!