예제 #1
0
        public List <Application> GetApplicationsWithAlarms(Device device)
        {
            string output = executer.Alarms(device.Id);
            var    parser = new ADBParser();

            List <Application> applications = new List <Application> ();
            var results = parser.ParseAlarms(output, device.MajorVersion).GroupBy(result => result.Package);

            foreach (var resultGroup in results)
            {
                var app = new Application()
                {
                    Name = resultGroup.Key
                };

                foreach (var result in resultGroup)
                {
                    DateTime        onDate;
                    Alarm.AlarmType alarmType;

                    if (result.Interval == "0")
                    {
                        onDate = parser.CalculateDateFromWhen(result.When);
                    }
                    else
                    {
                        onDate = parser.CalculateDateFromInterval(result.When, result.Interval);
                    }

                    Enum.TryParse <Alarm.AlarmType> (result.Type, out alarmType);

                    app.Alarms.Add(new Alarm(result.Id, onDate, alarmType));
                }

                applications.Add(app);
            }

            return(applications);
        }
예제 #2
0
 public ADB()
 {
     executer = new ADBExecuter();
     parser   = new ADBParser();
 }