static async Task CrawlWorker(int workerId, ConcurrentQueue <PackageIdentity> inputQueue, BlockingCollection <PackageResults> outputQueue) { try { var fileName = GetScratchFilePath($"worker_{workerId:000}.txt"); File.Delete(fileName); while (inputQueue.TryDequeue(out var packageId)) { var log = await RunPackageCrawlerAsync(packageId, fileName); var apis = File.Exists(fileName) ? File.ReadLines(fileName).Select(Guid.Parse).ToArray() : Array.Empty <Guid>(); var results = new PackageResults(packageId, log, apis); outputQueue.Add(results); File.Delete(fileName); } Console.WriteLine($"Crawl Worker {workerId:000} has finished."); } catch (Exception ex) { Console.WriteLine("[Fatal] Crawl Worker crashed: " + ex); Environment.Exit(1); } }
private async Task AnalyzeProject(KeyValuePair <string, IProjectAnalyzer> project) { await Task.Run(() => { var projectName = Path.GetFileNameWithoutExtension(project.Key); Console.WriteLine($"Building Project {projectName}"); var results = project.Value.Build().First(); PackagesByProject.TryAdd(projectName, new List <string>()); foreach (var(packageId, attributes) in results.PackageReferences.Where(p => p.Value.ContainsKey("Version"))) { PackagesByProject[projectName].Add(packageId + " " + attributes["Version"]); PackageResults.TryAdd(packageId, attributes["Version"]); } ProjectResults.TryAdd(projectName, results.ProjectReferences.Select(s => Path.GetFileNameWithoutExtension(s !)).ToList()); Console.WriteLine($"Project {projectName} done"); }).ConfigureAwait(false); }
private async Task doPackages(MyInfo info, Update upd, IConfig cfg) { // TODO: SHOULD BE REIMPLEMENTED IN V.12 if (info.Packages < packagesBlock) { return; } for (int i = 0; i < packagesBlock; i++) { //var pack = await upd.openPackage(info.UHash); var pack = await upd.openFreeBonus(info.UHash); if (pack != null) { var package = PackageResults.FromType((int)pack["type"]); cfg.logger.Log("Opened package {0}", package); } } }
private void RequestComplete(PackageResults packageRes, CommResults comRes, AckResults ackType, string strTag) { #region 操作类型 string operateStr = ""; if (strTag == "SetGlobalBrightness") { CommonStaticMethod.GetLanguageString("设置亮度", "Lang_Bright_SetGlobalBrightness", out operateStr); } else if (strTag == "SetRedBrightness") { CommonStaticMethod.GetLanguageString("设置红色亮度", "Lang_Bright_SetRedBrightness", out operateStr); } else if (strTag == "SetGreenBrightness") { CommonStaticMethod.GetLanguageString("设置绿色亮度", "Lang_Bright_SetGreenBrightness", out operateStr); } else if (strTag == "SetBlueBrightness") { CommonStaticMethod.GetLanguageString("设置蓝色亮度", "Lang_Bright_SetBlueBrightness", out operateStr); } else if (strTag == "SetGamma") { CommonStaticMethod.GetLanguageString("设置Gamma", "Lang_Bright_SetRedGammaTable", out operateStr); } else if (strTag == "SetParameterStore2SpiFlash_Complete") { CommonStaticMethod.GetLanguageString("保存配置", "Lang_Bright_SaveScanBdConfig", out operateStr); } else if (strTag == "SetCurrentGain") { CommonStaticMethod.GetLanguageString("设置电流增益", "Lang_Bright_SetCurrentGain", out operateStr); } #endregion string resStr = ""; CommonStaticMethod.GetLanguageString("结果", "Lang_Bright_Result", out resStr); string errStr = ""; CommMsgType commMsgType = CommMsgType.Information; if (ackType != AckResults.ok || comRes != CommResults.ok || packageRes != PackageResults.ok) { commMsgType = CommMsgType.Error; if (packageRes == PackageResults.timeOut) { CommonStaticMethod.GetLanguageString("失败!原因:超时!", "Lang_Bright_Timeout", out errStr); } else { CommonStaticMethod.GetLanguageString("失败!原因:未知!", "Lang_Bright_Unkonwn", out errStr); } } else { CommonStaticMethod.GetLanguageString("成功!", "Lang_Bright_Success", out errStr); } string msg = operateStr + "," + resStr + "-" + errStr; //NotifyMessage(this, new NotifyMessageEventArgs(new CommMsg() { Msg = msg, MsgType = commMsgType })); }
public void Report() { var output = new List <PackageResults>(); foreach (var pkg in packages) { Console.WriteLine($"Processing package {pkg.Id}..."); if (SkipPackages.Contains(pkg.Id) || !Regex.IsMatch(pkg.Id, Filter)) { Console.WriteLine(" Skipping"); continue; } if (!HasDotNetAssemblies(pkg)) { Console.WriteLine(" Not a .NET package"); continue; } var versions = repo.FindPackagesById(pkg.Id) .FilterByPrerelease(false) .OrderByDescending(p => p.Version) .ToList(); var latest = versions.First(); var minor = versions.Last(p => p.Version.Version.Major == latest.Version.Version.Major && p.Version.Version.Minor == latest.Version.Version.Minor); var major = versions.Last(p => p.Version.Version.Major == latest.Version.Version.Major); if (!HasDotNetAssemblies(minor) && !HasDotNetAssemblies(major)) { Console.WriteLine(" Lastest major/minor not .NET packages"); continue; } packageManager.InstallPackage(pkg.Id, major.Version, true, false); packageManager.InstallPackage(pkg.Id, minor.Version, true, false); packageManager.InstallPackage(pkg.Id, latest.Version, true, false); var pkgResult = new PackageResults() { Id = pkg.Id, CurrentVersion = latest.Version, Major = new VersionReport(pkg.Id, latest.Version, major.Version), Minor = new VersionReport(pkg.Id, latest.Version, minor.Version) }; if (HasDotNetAssemblies(minor)) { pkgResult.Minor.Diff = Diff(pkg, minor.Version, latest.Version); } if (HasDotNetAssemblies(major)) { pkgResult.Major.Diff = Diff(pkg, major.Version, latest.Version); } output.Add(pkgResult); if (Limit > 0 && output.Count >= Limit) { break; } } Console.WriteLine(); Console.WriteLine("| Package Name | Current Version | Latest Minor | Latest Major |"); Console.WriteLine("| --------------|:---------------:|:------------------:|:-------------------:|"); foreach (var res in output) { Console.WriteLine($"| {res.Id} | {res.CurrentVersion} | {res.Minor.Report()} | {res.Major.Report()} |"); } }
private void RequestComplete(PackageResults packageRes, CommResults comRes, AckResults ackType, string strTag, PackageBase pack) { if (ackType != AckResults.ok || comRes != CommResults.ok || packageRes != PackageResults.ok) { if (strTag == "SetSaveSendCardsParameters") { _isSaveToHWSuccessful = false; } if (strTag == "SetParameterStore2SpiFlash") { string msg = ""; msg = "保存信息到硬件失败!"; GetLangString(msg, "Lang_ScreenInfo_SaveDataFailt", out msg); SendTextToMessageBox(msg, MessageBoxImage.Error); CloseProcessForm(); return; } if (strTag == "SetReturnFactoryValues") { string msg = ""; msg = "返回出厂设置失败!"; GetLangString(msg, "Lang_ScreenInfo_ReturnFactoryData", out msg); SendTextToMessageBox(msg, MessageBoxImage.Error); CloseProcessForm(); return; } } else { if (strTag == "SetParameterStore2SpiFlash") { CustomTransform.Delay(SpecialPackTimeOut.SAVE_PARAMS_TIMEOUT * 1000, 60); string msg = string.Empty; msg = "保存信息到硬件成功!"; GetLangString(msg, "Lang_ScreenInfo_SendToHWSuccess", out msg); _isSendDataToHW = false; //if (_globalParams.AllBaseInfo.AllInfoDict.ContainsKey(pack.PortName)) //{ // List<ILEDDisplayInfo> infoList = _globalParams.AllBaseInfo.AllInfoDict[pack.PortName].LEDDisplayInfoList; // infoList.Clear(); // for (int i = 0; i < _oldDisplayList.Count; i++) // { // infoList.Add(_oldDisplayList[i]); // } //} SendTextToMessageBox(msg, MessageBoxImage.Exclamation); CloseProcessForm(); Messenger.Default.Send<string>("", MsgToken.MSG_SCREENINFO_CHANGED); } else if (strTag == "SetReturnFactoryValues") { SpecialPackageRequest spcPack = new SpecialPackageRequest(SpecialPackID.RETURN_FACTORY_ID, SpecialPackTimeOut.RETURN_FACTORY); int curID; _serverProxy.SendEndRequestSpecialPacke(spcPack, out curID); RedundancyInfoAccessor reduInfoAccessor = new RedundancyInfoAccessor(_serverProxy, _hwCardType, _selectedPortName); HWSoftwareSpaceRes res = reduInfoAccessor.ClearHWReduInfo(OnClearReduInfoComplete); if (res != HWSoftwareSpaceRes.OK) { string msg = ""; msg = "返回出厂设置失败!"; GetLangString(msg, "Lang_ScreenInfo_ReturnFactoryData", out msg); SendTextToMessageBox(msg,MessageBoxImage.Error); CloseProcessForm(); return; } } } }