public void ProcessOutput(RegexSurfer Surfer, Terminal Terminal, CancellationToken CancellationToken, SubprocessProgressToken Progress, ProgressControllerFactory ProgressControllerFactory) { using (IProgressController pc = ProgressControllerFactory.CreateController(Progress)) { pc.SetDescription("Проверка прошивки..."); pc.SetProgress(0); Surfer.SeekForMatches(Terminal, CancellationToken, new DelegateExpectation( new Regex(@"Complete (?<progress>\d+)%.*0x(?<written>[0-9a-fA-F]+) bytes written by applet", RegexOptions.Compiled | RegexOptions.Singleline), false, m => pc.SetProgress(0.01 * int.Parse(m.Groups["progress"].Value))), new DelegateExpectation( @"Sent file & Memory area content \(address: 0x[0-9a-fA-F]+, size: \d+ bytes\) (?<result>.+) !", m => { switch (m.Groups["result"].Value) { case "match exactly": return true; case "do not match": throw new ComparingFailsSambaException(); default: throw new ApplicationException("Непонятный вывод:\n\n" + Terminal.Log); } })); } }
public void ProcessOutput(RegexSurfer Surfer, Terminal Terminal, CancellationToken CancellationToken, SubprocessProgressToken Progress, ProgressControllerFactory ProgressControllerFactory) { using (IProgressController pc = ProgressControllerFactory.CreateController(Progress)) { pc.SetDescription("Стирание FLASH..."); pc.SetProgress(0); Surfer.SeekForMatches(Terminal, CancellationToken, new BarrierExpectation(@"GENERIC::EraseAll")); } }
public void ProcessOutput(RegexSurfer Surfer, Terminal Terminal, CancellationToken CancellationToken, SubprocessProgressToken Progress, ProgressControllerFactory ProgressControllerFactory) { using (IProgressController pc = ProgressControllerFactory.CreateController(Progress)) { pc.SetDescription("Передача прошивки {0:P0}", Progress); int written = 0; Surfer.SeekForMatches(Terminal, CancellationToken, new DelegateExpectation( new Regex(@"Complete (?<progress>\d+)%.*0x(?<written>[0-9a-fA-F]+) bytes written by applet", RegexOptions.Compiled | RegexOptions.Singleline), m => { pc.SetProgress(0.01 * int.Parse(m.Groups["progress"].Value)); written += int.Parse(m.Groups["written"].Value, NumberStyles.HexNumber); return written >= _fileSize; })); } }
public SambaBurningToolFactory(IToolLauncher ToolLauncher, ProgressControllerFactory ProgressControllerFactory) { _toolLauncher = ToolLauncher; _progressControllerFactory = ProgressControllerFactory; _toolBodyFactory = new StaticToolBodyFactory(Path.Combine("Tools", "sam-ba"), "sam-ba.exe"); }
public SambaBurningTool(IToolLauncher ToolLauncher, IToolBody ToolBody, ProgressControllerFactory ProgressControllerFactory) { _toolLauncher = ToolLauncher; _toolBody = ToolBody; _progressControllerFactory = ProgressControllerFactory; }