//向案件中写入adb容器;
        public void AddContainerToCase(PhoneFullInfoContainer container)
        {
            try {
                //AdbDeviceCaseFile adbCSFile = null;
                ////查看是否存在同一个容器案件文件;
                //if (ServiceProvider.Current?.GetInstance<ICaseService>()?.CurrentCase.CaseEvidences.FirstOrDefault(p => p is AdbDeviceCaseFile adbCFile &&
                //adbCFile.Container.Device.Serial == container.Device.Serial) is AdbDeviceCaseFile preAdbFile) {
                //    preAdbFile.Container.CombineWith(container);
                //    container = preAdbFile.Container;
                //}
                //else {
                //    adbCSFile = new AdbDeviceCaseFile(container, DateTime.Now);
                //    ServiceProvider.Current?.GetInstance<ICaseService>().AddNewCaseFile(adbCSFile);
                //}

                ////准备本地存储;
                ////查询是否存在Adb设备目标目录;
                //var containerBinFile = $"{ServiceProvider.Current?.GetInstance<ICaseService>().CurrentCase.Path}/{adbCSFile.BasePath}/{AdbDeviceCaseFile.AdbStorageFile}";

                ////二进制存储容器;
                //var formatter = new BinaryFormatter();
                //using (var fs = File.Create(containerBinFile)) {
                //    formatter.Serialize(fs, container);
                //}
            }
            catch (Exception ex) {
                Logger.WriteLine($"{nameof(AdbViewerService)}->{nameof(AddAdbInfoNode)}:{ex.Message}");
                MsgBoxService.ShowError(ex.Message);
            }
            finally {
                ServiceProvider.Current?.GetInstance <ICaseService>().CurrentCase.Save();
            }
        }
 /// <summary>
 /// 加载ADB节点;在连接手机并获得了信息后处理获得的结果;
 /// </summary>
 /// <param name="container"></param>
 public void LoadAdbPhoneContainer(PhoneFullInfoContainer container)
 {
     try {
         AddAdbInfoNode(container);
         AddContainerToCase(container);
     }
     catch (Exception ex) {
         Logger.WriteLine($"{nameof(AdbViewerService)}->{nameof(LoadAdbPhoneContainer)}:{ex.Message}");
         MsgBoxService.ShowError($"{LanguageService.FindResourceString("FaileToLoadAdbInfo")}:{ex.Message}");
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 加入ADB查看节点;
        /// </summary>
        /// <param name="container">Adb信息容器</param>
        public void AddAdbUnit(PhoneFullInfoContainer container)
        {
            ////检查是否已经加载了相同的设备节点;
            //var preContainerUnit = TreeUnits.FirstOrDefault(p =>
            //    p is AdbDeviceCaseFileUnit fullContainer &&
            //    fullContainer.PhoneInfoContainer.Device.Serial == container.Device.Serial
            //);
            ////若存在,则去除之;
            //if (preContainerUnit != null) {
            //    TreeUnits.Remove(preContainerUnit);
            //}

            //var adbUnit = new AdbDeviceCaseFileUnit(container,null);
            //TreeUnits.Add(adbUnit);
            //NotifyUnitExpand(adbUnit);
        }
        /// <summary>
        /// 加入Adb单位信息;
        /// </summary>
        /// <param name="container"></param>
        public void AddAdbInfoNode(PhoneFullInfoContainer container)
        {
            //if (container == null)
            //    return;

            ////查询是否具有相同的Adb设备;
            //var preAdbCFile = ServiceProvider.Current?.GetInstance<ICaseService>().CurrentCase.CaseEvidences.
            //    FirstOrDefault(p => p.EvidenceTypeGuids?.Contains(nameof(AdbDeviceCaseFile))
            //&& adbCSFile.Container?.Device?.Serial == container.Device.Serial);

            ////若有,则联合后移除;
            //if (preAdbCFile is AdbDeviceCaseFile adbCFile) {
            //    container.CombineWith(adbCFile.Container);
            //}

            ////向树形中加入;
            //AppInvoke(() => {
            //    AddAdbUnit(container);
            //});
        }
        private void AddAdbUnit(PhoneFullInfoContainer container)
        {
            //if(mNodeManagerService?.Value == null) {
            //    RemainingMessageBox.Tell($"{FindResourceString("Failed To Get FsNodeMananerService")}");
            //    return;
            //}

            //var curUnits = mNodeManagerService.Value.CurrentUnits;
            ////检查是否已经加载了相同的设备节点;
            ////若存在,则去除之;
            //if (curUnits.FirstOrDefault(p =>
            //    p is AdbDeviceCaseFileUnit fullContainer &&
            //    fullContainer.PhoneInfoContainer.Device.Serial == container.Device.Serial
            //) is AdbDeviceCaseFileUnit preContainerUnit) {
            //    mNodeManagerService.Value.RemoveUnit(preContainerUnit);
            //}


            //var adbUnit = new AdbDeviceCaseFileUnit(container,null);
            //mNodeManagerService.Value.AddUnit(adbUnit);
            //TreeUnits.Add(adbUnit);
            //NotifyUnitExpand(adbUnit);
        }