use of org.fagu.fmv.soft.find.SoftFound in project fmv by f-agu.
the class SoftInfoContributor method content.
// *********************************************
/**
* @return
*/
private Map<String, String> content() {
Map<String, String> map = new HashMap<>();
for (Soft soft : Softs.getInfoContributors()) {
String msg = null;
if (soft.isFound()) {
StringBuilder buf = new StringBuilder(100);
SoftInfo softInfo = soft.getFirstInfo();
if (softInfo instanceof VersionSoftInfo) {
((VersionSoftInfo) softInfo).getVersion().ifPresent(v -> buf.append(v).append(", "));
}
if (softInfo instanceof VersionDateSoftInfo) {
((VersionDateSoftInfo) softInfo).getDate().ifPresent(d -> {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
buf.append(dateFormat.format(d)).append(", ");
});
}
buf.append(soft.getFile().getAbsolutePath());
msg = buf.toString();
} else {
StringJoiner joiner = new StringJoiner(" ; ");
for (SoftFound softFound : soft.getFounds()) {
StringBuilder buf = new StringBuilder();
FoundReason foundReason = softFound != null ? softFound.getFoundReason() : FoundReasons.NOT_FOUND;
buf.append(foundReason.name());
String reason = softFound.getReason();
if (reason != null) {
buf.append(": ").append(reason);
}
joiner.add(buf.toString());
}
msg = joiner.toString();
}
map.put(soft.getName(), msg);
}
return map;
}
use of org.fagu.fmv.soft.find.SoftFound in project fmv by f-agu.
the class SoftFoundTestCase method testMultiple1.
/**
*/
@Test
public void testMultiple1() {
SoftFound foundBadSoft = SoftFound.notFound();
assertSame(foundBadSoft, SoftFound.multiple(foundBadSoft));
}
use of org.fagu.fmv.soft.find.SoftFound in project fmv by f-agu.
the class VersionPolicyTestCase method testAllOSAllVersion_versionV3.
/**
*/
@Test
public void testAllOSAllVersion_versionV3() {
SoftFound softFound = new VersionSoftPolicy().onAllPlatforms(allVersion()).toSoftFound(versionSoftInfo(Version.V3));
assertTrue(softFound.isFound());
}
use of org.fagu.fmv.soft.find.SoftFound in project fmv by f-agu.
the class VersionPolicyTestCase method testAllOS_versionNull.
/**
*/
@Test
public void testAllOS_versionNull() {
SoftFound softFound = new VersionSoftPolicy().onAllPlatforms(allVersion()).toSoftFound(versionSoftInfo(null));
assertFalse(softFound.isFound());
assertEquals(FoundReasons.BAD_SOFT, softFound.getFoundReason());
assertEquals("version not parsable", softFound.getReason());
}
use of org.fagu.fmv.soft.find.SoftFound in project fmv by f-agu.
the class AutoRotate method isAutoRotateObsolete.
/**
* @param soft
* @return
*/
public static boolean isAutoRotateObsolete(Soft soft) {
SoftFound softFound = soft.getFirstFound();
FFInfo ffInfo = (FFInfo) softFound.getSoftInfo();
// version
Version version = ffInfo.getVersion();
if (version != null) {
return version.isUpperOrEqualsThan(new Version(2, 7));
}
// build number
Integer builtVersion = ffInfo.getBuiltVersion();
if (builtVersion != null) {
return builtVersion.intValue() > 73010;
}
// build date
Date builtDate = ffInfo.getBuiltDate();
if (builtDate != null) {
@SuppressWarnings("deprecation") Date minDate = new Date(2015 - 1900, 6 - 1, 12);
return minDate.before(builtDate);
}
return false;
}
Aggregations