Exemplo n.º 1
0
        public static bool InstallApp(IntPtr device, string appPath)
        {
            CFString path   = new CFString(appPath);
            IntPtr   appUrl = CFLibrary.CFURLCreateWithFileSystemPath(IntPtr.Zero, path.typeRef, 2, false);

            string[] k = new string[1];
            k[0] = "PackageType";
            IntPtr[] v = new IntPtr[1];
            v[0] = new CFString("Developer");
            CFDictionary opts = new CFDictionary(k, v);

            int err = AMDeviceSecureTransferPath(0, device, appUrl, opts, IntPtr.Zero, 0);

            if (err == NO_ERR)
            {
                return(AMDeviceSecureInstallApplication(0, device, appUrl, opts, IntPtr.Zero, 0) == NO_ERR);
            }
            return(err == NO_ERR);
        }
Exemplo n.º 2
0
        public static Hashtable LookupApplication(IntPtr device)
        {
            IntPtr ptr = IntPtr.Zero;
            int    b   = AMDeviceLookupApplications(device, 0, out ptr);

            if (b != NO_ERR)
            {
                return(null);
            }
            int length = CFLibrary.CFDictionaryGetCount(ptr);

            IntPtr[] keys   = new IntPtr[length];
            IntPtr[] values = new IntPtr[length];
            CFLibrary.CFDictionaryGetKeysAndValues(ptr, keys, values);

            Hashtable apps = new Hashtable();

            for (int i = 0; i < length; i++)
            {
                CFDictionary dict        = new CFDictionary(values[i]);
                string       bundle      = dict.GetValue(CFBundleIdentifier).ToString();
                string       type        = dict.GetValue(ApplicationType).ToString();
                string       name        = dict.GetValue(CFBundleName).ToString();
                string       displayname = dict.GetValue(CFBundleDisplayName).ToString();
                string       version     = dict.GetValue(CFBundleShortVersionString).ToString();
                string       build       = dict.GetValue(CFBundleVersion).ToString();
                Hashtable    app         = new Hashtable();
                app.Add(CFBundleIdentifier, bundle);
                app.Add(ApplicationType, type);
                app.Add(CFBundleName, name);
                app.Add(CFBundleDisplayName, displayname);
                app.Add(CFBundleShortVersionString, version);
                app.Add(CFBundleVersion, build);
                apps.Add(bundle, app);
            }
            return(apps);
        }