Пример #1
0
        /// <summary>
        /// Releases all resources used by <see cref="XiaomiController"/>
        /// </summary>
        /// <remarks>Needs to be called when application has finished using <see cref="XiaomiController"/></remarks>

        public void Dispose()
        {
            if (AdbCmd.ServerRunning)
            {
                AdbCmd.ExecuteAdbCommandNoReturn(AdbCmd.FormAdbCommand("forward--remove - all"));
                AdbCmd.KillServer();
                Thread.Sleep(1000);
            }
            AdbCmd.KillServer();
            ResourceFolderManager.Unregister(ANDROID_CONTROLLER_TMP_FOLDER);
            instance = null;
        }
Пример #2
0
 /// <summary>
 /// Creates the resource directories.
 /// </summary>
 private void CreateResourceDirectories()
 {
     try {
         if (!Adb.ExecuteAdbCommand(new AdbCommand("version")).Contains(Adb.ADB_VERSION))
         {
             Adb.KillServer();
             Thread.Sleep(1000);
             ResourceFolderManager.Unregister(ANDROID_CONTROLLER_TMP_FOLDER);
             Extract_Resources = true;
         }
     } catch (Exception) {
         Extract_Resources = true;
     }
     ResourceFolderManager.Register(ANDROID_CONTROLLER_TMP_FOLDER);
 }
 private void CreateResourceDirectories()
 {
     try
     {
         if (!Adb.ExecuteAdbCommand(new AdbCommand("version")).Contains(Adb.AdbVersion))
         {
             Adb.KillServer();
             Thread.Sleep(1000);
             ResourceFolderManager.Unregister(AndroidControllerTmpFolder);
             _extractResources = true;
         }
     }
     catch (Exception)
     {
         _extractResources = true;
     }
     ResourceFolderManager.Register(AndroidControllerTmpFolder);
 }
Пример #4
0
        /// <summary>
        /// Signs an Update.zip with test keys to flash on an Android device
        /// </summary>
        /// <param name="unsigned">Full path to unsigned update.zip</param>
        /// <returns>True if successful, false if file <paramref name="unsigned"/> does not exist or if file <paramref name="unsigned"/> is not a zip</returns>
        /// <remarks><para>Outputs signed zip in same directory as unsigned zip</para></remarks>
        public static bool SignUpdateZip(string unsigned)
        {
            if (!File.Exists(unsigned) || Path.GetExtension(unsigned).ToLower() != ".zip")
            {
                return(false);
            }

            bool   result;
            string resDir;

            ResourceFolderManager.Register("Signer");

            resDir = ResourceFolderManager.GetRegisteredFolderPath("Signer");

            ExtractResources(resDir);

            result = Java.RunJar(resDir + "signapk.jar", "\"" + resDir + "testkey.x509.pem\"", "\"" + resDir + "testkey.pk8\"", "\"" + unsigned + "\"", "\"" + unsigned.Replace(".zip", "_signed.zip\""));

            ResourceFolderManager.Unregister("Signer");

            return(result);
        }
Пример #5
0
 /// <summary>
 /// Call to free up resources after use of <c>AAPT</c>
 /// </summary>
 public void Dispose()
 {
     ResourceFolderManager.Unregister("AAPT");
 }