protected override void ProcessNewLines(string[] lines)
 {
     PackageManager.Packages.Clear();
     foreach (string line in lines)
     {
         if (line.Length > 0)
         {
             // get the filepath and package from the line
             Match m = Regex.Match(line, PackageManagerReceiver.PM_PACKAGE_PATTERN, RegexOptions.Compiled);
             if (m.Success)
             {
                 // get the children with that path
                 FileEntry entry;
                 if (PackageManager.Packages.ContainsKey(m.Groups[2].Value))
                 {
                     entry = PackageManager.Packages[m.Groups[1].Value];
                     if (entry != null)
                     {
                         entry.Info = m.Groups[2].Value;
                     }
                 }
                 else
                 {
                     entry      = FileEntry.Find(Device, m.Groups[1].Value);
                     entry.Info = m.Groups[2].Value;
                     PackageManager.Packages.Add(m.Groups[2].Value, entry);
                 }
             }
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// Processes the new lines.
        /// </summary>
        /// <param name="lines">The lines.</param>
        protected override void ProcessNewLines(string[] lines)
        {
            PackageManager.Packages.Clear( );
            lines.ForEach(line => {
                if (line.Trim( ).Length > 0)
                {
                    var m = line.Match(PackageManagerReceiver.PM_PACKAGE_PATTERN, RegexOptions.Compiled);
                    if (m.Success)
                    {
                        // get the children with that path
                        FileEntry entry = null;
                        if (PackageManager.Packages.ContainsKey(m.Groups[2].Value))
                        {
                            entry = PackageManager.Packages[m.Groups[1].Value];
                            if (entry != null)
                            {
                                entry.Info = m.Groups[2].Value;
                            }
                        }
                        else
                        {
                            try {
                                entry      = FileEntry.Find(Device, m.Groups[1].Value);
                                entry.Info = m.Groups[2].Value;
                                PackageManager.Packages.Add(m.Groups[2].Value, entry);
                            } catch (PermissionDeniedException) {
                                // root required for device packages
                                entry      = FileEntry.CreateNoPermissions(Device, m.Groups[1].Value);
                                entry.Info = m.Groups[2].Value;
                                PackageManager.Packages.Add(m.Groups[2].Value, entry);
                            }
                        }
                    }
                }
            });

            /*
             * foreach ( String line in lines ) {
             *      if ( line.Length > 0 ) {
             *              // get the filepath and package from the line
             *              Match m = Regex.Match ( line, PackageManagerReceiver.PM_PACKAGE_PATTERN, RegexOptions.Compiled );
             *              if ( m.Success ) {
             *                      // get the children with that path
             *                      FileEntry entry = null;
             *                      if ( PackageManager.Packages.ContainsKey ( m.Groups[2].Value ) ) {
             *                              entry = PackageManager.Packages[m.Groups[1].Value];
             *                              if ( entry != null ) {
             *                                      entry.Info = m.Groups[2].Value;
             *                              }
             *                      } else {
             *                              try {
             *                                      entry = FileEntry.Find ( Device, m.Groups[1].Value );
             *                                      entry.Info = m.Groups[2].Value;
             *                                      PackageManager.Packages.Add ( m.Groups[2].Value, entry );
             *                              } catch ( PermissionDeniedException ) {
             *                                      // root required for device packages
             *                                      entry = FileEntry.CreateNoPermissions ( Device, m.Groups[1].Value );
             *                                      entry.Info = m.Groups[2].Value;
             *                                      PackageManager.Packages.Add ( m.Groups[2].Value, entry );
             *                              }
             *                      }
             *              }
             *      }
             * }*/
        }
Exemple #3
0
 /// <summary>
 /// Gets the apk file entry.
 /// </summary>
 /// <param name="package">The package.</param>
 /// <returns></returns>
 public FileEntry GetApkFileEntry(string package)
 {
     return(FileEntry.Find(this.Device, GetApkPath(package)));
 }
Exemple #4
0
 /// <summary>
 /// Gets the apk file entry.
 /// </summary>
 /// <param name="package">The package.</param>
 /// <returns></returns>
 public FileEntry GetApkFileEntry(String package)
 {
     return(FileEntry.Find(this.Device, new FileListingService(Device), GetApkPath(package)));
 }