diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form
index 4fd4e5e..b8f85f6 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form
@@ -88,7 +88,7 @@
-
+
@@ -128,6 +128,14 @@
+
+
+
+
+
+
+
+
@@ -160,6 +168,14 @@
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java
index 33b8c4f..80072e7 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java
@@ -3,6 +3,7 @@ package com.luoboduner.moo.info.ui.form;
import cn.hutool.core.io.unit.DataSizeUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
+import com.google.common.collect.Maps;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
@@ -12,6 +13,8 @@ import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import oshi.hardware.*;
import oshi.software.os.OperatingSystem;
+import oshi.util.EdidUtil;
+import oshi.util.FormatUtil;
import javax.swing.*;
import javax.swing.border.TitledBorder;
@@ -20,6 +23,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* OverviewForm
@@ -43,6 +47,8 @@ public class OverviewForm {
private JLabel graphicsCardInfo;
private JLabel baseBoardLabel;
private JLabel baseBoardInfoLabel;
+ private JLabel diskStorageLabel;
+ private JLabel diskStorageInfoLabel;
public static OverviewForm getInstance() {
if (overviewForm == null) {
@@ -68,6 +74,7 @@ public class OverviewForm {
Style.emphaticLabelFont(overviewForm.getMemoryLabel());
Style.emphaticLabelFont(overviewForm.getGraphicsCardLabel());
Style.emphaticLabelFont(overviewForm.getBaseBoardLabel());
+ Style.emphaticLabelFont(overviewForm.getDiskStorageLabel());
}
private static void initInfo() {
@@ -85,6 +92,28 @@ public class OverviewForm {
overviewForm.getMemoryInfo().setText(getMemoryInfo(hardware.getMemory()));
overviewForm.getGraphicsCardInfo().setText(getGraphicsCardInfo(hardware));
overviewForm.getBaseBoardInfoLabel().setText(getBaseBoardInfo(hardware.getComputerSystem().getBaseboard()));
+ overviewForm.getDiskStorageInfoLabel().setText(getDiskStorageInfo(hardware));
+
+ List displays = hardware.getDisplays();
+ for (Display display : displays) {
+ byte[] edid = display.getEdid();
+ byte[][] desc = EdidUtil.getDescriptors(edid);
+ Map infoMap = Maps.newHashMap();
+ for (byte[] b : desc) {
+ int descriptorType = EdidUtil.getDescriptorType(b);
+ if (descriptorType == 0xff || descriptorType == 0xfe || descriptorType == 0xfd || descriptorType == 0xfb || descriptorType == 0xfa) {
+ } else if (descriptorType == 0xfc) {
+ infoMap.put("name", EdidUtil.getDescriptorText(b));
+ } else {
+ if (EdidUtil.getDescriptorType(b) > 0x0f || EdidUtil.getDescriptorType(b) < 0x00) {
+ infoMap.put("size", EdidUtil.getTimingDescriptor(b));
+ }
+ }
+ }
+
+ System.err.println(infoMap);
+
+ }
}
/**
@@ -151,6 +180,26 @@ public class OverviewForm {
return detailBuilder.toString();
}
+ /**
+ * Disk Storage info text,like:"KBG40ZNV512G KIOXIA (标准磁盘驱动器) 512 GB"
+ *
+ * @param hardware
+ * @return
+ */
+ private static String getDiskStorageInfo(HardwareAbstractionLayer hardware) {
+ List detailList = new ArrayList<>();
+ StringBuilder detailBuilder;
+ List diskStores = hardware.getDiskStores();
+ for (HWDiskStore hwDiskStore : diskStores) {
+ detailBuilder = new StringBuilder();
+ detailBuilder.append(hwDiskStore.getModel());
+ detailBuilder.append(" ").append(hwDiskStore.getSize() > 0 ? FormatUtil.formatBytesDecimal(hwDiskStore.getSize()) : "?");
+
+ detailList.add(detailBuilder.toString());
+ }
+ return StringUtils.join(detailList, " + ");
+ }
+
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
@@ -198,7 +247,7 @@ public class OverviewForm {
final JSeparator separator1 = new JSeparator();
panel1.add(separator1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JPanel panel5 = new JPanel();
- panel5.setLayout(new GridLayoutManager(4, 3, new Insets(10, 10, 10, 10), -1, -1));
+ panel5.setLayout(new GridLayoutManager(5, 3, new Insets(10, 10, 10, 10), -1, -1));
panel1.add(panel5, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
cpuLabel = new JLabel();
cpuLabel.setText("CPU");
@@ -212,6 +261,9 @@ public class OverviewForm {
baseBoardLabel = new JLabel();
baseBoardLabel.setText("BaseBoard");
panel5.add(baseBoardLabel, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ diskStorageLabel = new JLabel();
+ diskStorageLabel.setText("DiskStorage");
+ panel5.add(diskStorageLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cpuInfo = new JLabel();
cpuInfo.setText("CPU info");
panel5.add(cpuInfo, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
@@ -224,6 +276,9 @@ public class OverviewForm {
baseBoardInfoLabel = new JLabel();
baseBoardInfoLabel.setText("BaseBoard info");
panel5.add(baseBoardInfoLabel, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ diskStorageInfoLabel = new JLabel();
+ diskStorageInfoLabel.setText("DiskStorage info");
+ panel5.add(diskStorageInfoLabel, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer4 = new Spacer();
panel5.add(spacer4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
}