예제 #1
0
        private string Find2(DeviceImage image)
        {
            string maybePath1 = $"/dev/block/platform/*/by-name/{image.ToString().ToLower()}";
            string maybePath2 = $"/dev/block/platform/soc*/*/by-name/{image.ToString().ToLower()}";

            var exeResult = Device.Su($"ls -l {maybePath1}");

            if (exeResult.Item2 == (int)LinuxReturnCode.None)
            {
                return(maybePath1);
            }
            exeResult = Device.Su($"ls -l {maybePath2}");
            if (exeResult.Item2 == (int)LinuxReturnCode.None)
            {
                return(maybePath2);
            }
            return(null);
        }
예제 #2
0
        private string Find2(DeviceImage image)
        {
            string maybePath1 = $"/dev/block/platform/*/by-name/{image.ToString().ToLower()}";
            string maybePath2 = $"/dev/block/platform/soc*/*/by-name/{image.ToString().ToLower()}";

            var exeResult = ShellAsSu.SafetyInput($"ls -l {maybePath1}");

            if (exeResult.IsSuccessful)
            {
                return(maybePath1);
            }
            exeResult = ShellAsSu.SafetyInput($"ls -l {maybePath2}");
            if (exeResult.IsSuccessful)
            {
                return(maybePath2);
            }
            return(null);
        }
예제 #3
0
        private string Find1(DeviceImage image)
        {
            var exeResult = Device.Su($"find /dev/ -name {image.ToString().ToLower()}");

            if (exeResult.Item2 == (int)LinuxReturnCode.KeyHasExpired)
            {
                return(null);//无法使用find命令,当场返回!
            }
            else
            {
                var result = from r in exeResult.Item1.LineAll
                             where PathIsRight(r)
                             select r;
                return(result.First());
            }
        }
예제 #4
0
        private string Find1(DeviceImage image)
        {
            var exeResult = ShellAsSu.SafetyInput($"find /dev/ -name {image.ToString().ToLower()}");

            exeResult.PrintOnLog(this);
            if (exeResult.GetExitCode() == (int)LinuxReturnCode.KeyHasExpired)
            {
                return(null);//无法使用find命令,当场返回!
            }
            else
            {
                var result = from r in exeResult.LineAll
                             where PathIsRight(r)
                             select r;
                return(result.First());
            }
        }