/// <summary> /// 分析数据时调用此函数 /// </summary> public static void Do() { UpdataRepository comRepo = Repository.Repository.ComRepository(); UpdataRepository binRepo = Repository.Repository.BinRepository(); try { if (comRepo == null) { Console.WriteLine("The comm data file has not Selected!"); return; } if (binRepo == null) { Console.WriteLine("The encrypted bin data file has not Selected!"); return; } var binSSW = binRepo.sswSendList[0]; AnalyzeSSW(binSSW, comRepo.sswSendList); AnalyzeUSW(binRepo.uswSendList, comRepo.uswSendList); var binQSW = binRepo.qswSendList[0]; AnalyzeQSW(binQSW, comRepo.qswSendList); AnalyzeSSW_resp(comRepo.sswRecvList); AnalyzeUSW_resp(comRepo.uswRecvList, binRepo.uswSendList.Count); if (comRepo.qswRecvList.Count == 0) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("QSW Response Packages Not Found!"); Console.ResetColor(); } else { AnalyzeQSW_resp(comRepo.qswRecvList[comRepo.qswRecvList.Count - 1], binRepo.uswSendList.Count); } } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Analyze Data Error!"); Console.ResetColor(); Console.WriteLine(ex + ex.Message); } }
public static bool BinRepository(string file) { try { if (binRepo != null) { binRepo = null; } binRepo = new UpdataRepository(file); return(true); } catch { return(false); } }
public static bool ComRepository(string file, int fileType) { try { if (comRepo != null) { comRepo = null; } comRepo = new UpdataRepository(file, fileType); return(true); } catch { return(false); } }
public static void Execute() { UpdataRepository comRepo = Repository.Repository.ComRepository(); UpdataRepository binRepo = Repository.Repository.BinRepository(); if (comRepo == null) { Console.WriteLine("The comm data file has not Selected!"); return; } if (binRepo == null) { Console.WriteLine("The encrypted bin data file has not Selected!"); return; } Console.WriteLine("Total packages: {0}. Input package num.", comRepo.qswSendList.Count); var numStr = Console.ReadLine(); try { var num = Convert.ToInt32(numStr); if (num >= comRepo.qswSendList.Count) { Console.WriteLine("Out of Range!"); } Console.Write("Bin File: "); ConsoleHelper.WriteByteArray(binRepo.qswSendList[0].source, comRepo.qswSendList[num].source); Console.Write("\nCom File: "); ConsoleHelper.WriteByteArray(comRepo.qswSendList[num].source, binRepo.qswSendList[0].source); Console.WriteLine(); } catch { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("ERROR! Please retry."); Console.ResetColor(); } }
/// <summary> /// type : 0 num为加密软件中的序号, 0 num为Com数据中的包次序号 /// </summary> /// <param name="type"></param> public static void Execute(int type) { UpdataRepository comRepo = Repository.Repository.ComRepository(); UpdataRepository binRepo = Repository.Repository.BinRepository(); if (comRepo == null) { Console.WriteLine("The comm data file has not Selected!"); return; } if (binRepo == null) { Console.WriteLine("The encrypted bin data file has not Selected!"); return; } if (type == 0) { Comparer(binRepo.uswSendList, comRepo.uswSendList); } else { Comparer(comRepo.uswSendList, binRepo.uswSendList); } }