Пример #1
0
		public ResolutionInfo Resolve(FirmwareDatabase.FirmwareRecord record, bool forbidScan = false)
		{
			// purpose of forbidScan: sometimes this is called from a loop in Scan(). we dont want to repeatedly DoScanAndResolve in that case, its already been done.
			bool first = true;

		RETRY:
			ResolutionInfo resolved;
			_resolutionDictionary.TryGetValue(record, out resolved);

			// couldnt find it! do a scan and resolve to try harder
			// NOTE: this could result in bad performance in some cases if the scanning happens repeatedly..
			if (resolved == null && first)
			{
				if (!forbidScan)
				{
					DoScanAndResolve();
				}

				first = false;
				goto RETRY;
			}

			return resolved;
		}
Пример #2
0
		// purpose of forbidScan: sometimes this is called from a loop in Scan(). we don't want to repeatedly DoScanAndResolve in that case, its already been done.
		public ResolutionInfo Resolve(PathEntryCollection pathEntries, IDictionary<string, string> userSpecifications, FirmwareDatabase.FirmwareRecord record, bool forbidScan = false)
		{
			_resolutionDictionary.TryGetValue(record, out var resolved);
			// couldn't find it! do a scan and resolve to try harder
			// NOTE: this could result in bad performance in some cases if the scanning happens repeatedly...
			if (resolved == null && !forbidScan)
			{
				DoScanAndResolve(pathEntries, userSpecifications);
				_resolutionDictionary.TryGetValue(record, out resolved);
			}
			return resolved;
		}