Files
VisualSapfor/src/_VisualDVM/Repository/Component/Instruction.java

58 lines
1.6 KiB
Java
Raw Normal View History

2024-10-09 22:21:57 +03:00
package _VisualDVM.Repository.Component;
2024-10-07 22:04:09 +03:00
import Common.Utils.CommonUtils;
2024-10-09 22:01:19 +03:00
import _VisualDVM.Utils;
2023-09-17 22:13:42 +03:00
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
public class Instruction extends Component {
@Override
public String getFileName() {
return "Instruction.pdf";
}
@Override
public String getNewFileName() {
return "Instruction_new.pdf";
}
@Override
public boolean isNecessary() {
return false;
}
@Override
public ComponentType getComponentType() {
return ComponentType.Instruction;
}
public void Update() throws Exception {
ReplaceOldFile();
GetVersionInfo();
actual_version = 1;
}
@Override
public String getVersionText() {
return code;
}
//вызывается в первую очередь
@Override
public void unpackActualVersion(String v_string) {
actual_code = v_string;
actual_version = code.isEmpty() ? 1 : ((code.equals(actual_code)) ? 1 : 2);
if (CanBeUpdated())
CheckIfNeedsUpdateOrPublish();
}
@Override
public void unpackMinimalVersion(String v_string) {
//--
}
@Override
public void GetVersionInfo() {
try {
version = 1;
code = Utils.md5Custom(Utils.ReadAllText(getFile()));
DateFormat df = new SimpleDateFormat("MMM dd yyyy HH:mm:ss", Locale.ENGLISH);
date_text = df.format(getFile().lastModified());
} catch (Exception e) {
2024-10-07 22:04:09 +03:00
CommonUtils.MainLog.PrintException(e);
2023-09-17 22:13:42 +03:00
}
}
}