예제 #1
0
 private static void proc_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     if (!String.IsNullOrEmpty(e.Data))
     {
         _console.WriteToConsole(e.Data.Replace("\r", "") + "\n");
     }
 }
예제 #2
0
        /// <summary>
        /// Reads the current partition table's values.
        /// </summary>
        /// <returns>
        /// A dictionary that maps partition names to their sizes.
        /// </returns>
        public Dictionary <string, uint> ReadPartitionTable()
        {
            Dictionary <string, uint> partTable = new Dictionary <string, uint>();

            string partInfo = AdbCommand.ExecuteShellCommand(Constants.PARTED_PRINT);

            if (!String.IsNullOrEmpty(partInfo))
            {
                _parent.WriteToConsole(partInfo.Replace("\r", ""));
                ProcessPartitionTable(partInfo, partTable);
            }

            return(partTable);
        }
예제 #3
-1
        /// <summary>
        /// Executes a partitioning command, throwing a PartitionException if an error occurs
        /// </summary>
        /// <param name="Command">The command to execute</param>
        /// <param name="console">A fmMain object to write output to</param>
        public static void ExecutePartitionCommand(string Command, fmMain console)
        {
            string output = null;

            Process proc = Process.Start(CreateAdbStartInfo("shell " + Command));

            proc.WaitForExit();

            string stdErr = proc.StandardError.ReadToEnd();

            if (!String.IsNullOrEmpty(stdErr))
            {
                throw new PartitionException(stdErr);
            }

            output = proc.StandardOutput.ReadToEnd();

            if (!String.IsNullOrEmpty(output))
            {
                console.WriteToConsole(output.Replace("\r", ""));
            }
        }