Skip to content

Commit 6814556

Browse files
Initial commit
0 parents  commit 6814556

292 files changed

Lines changed: 23903 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin/

ChiffonUpdaterAgent/.classpath

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="src" path="src"/>
5+
<classpathentry combineaccessrules="false" kind="src" path="/ChiffonUpdaterShared"/>
6+
<classpathentry combineaccessrules="false" kind="src" path="/ChiffonUpdaterStandaloneSDK"/>
7+
<classpathentry combineaccessrules="false" kind="src" path="/ChiffonUpdaterSharedStaticModule"/>
8+
<classpathentry kind="output" path="bin"/>
9+
</classpath>

ChiffonUpdaterAgent/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>ChiffonUpdaterAgent</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.release=disabled
12+
org.eclipse.jdt.core.compiler.source=1.8

ChiffonUpdaterAgent/agent_icon.xcf

9.67 KB
Binary file not shown.
2.52 KB
Loading
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*
2+
* This file is part of ChiffonUpdater
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
7+
package io.github.explodingbottle.chiffonupdater;
8+
9+
import java.awt.Container;
10+
import java.awt.Dimension;
11+
import java.awt.Image;
12+
import java.awt.event.ActionEvent;
13+
import java.awt.event.ActionListener;
14+
import java.awt.event.KeyEvent;
15+
16+
import javax.swing.ImageIcon;
17+
import javax.swing.JButton;
18+
import javax.swing.JComponent;
19+
import javax.swing.JFrame;
20+
import javax.swing.JLabel;
21+
import javax.swing.JScrollPane;
22+
import javax.swing.JTextArea;
23+
import javax.swing.KeyStroke;
24+
import javax.swing.SpringLayout;
25+
26+
public class AboutWindow extends JFrame implements ActionListener {
27+
28+
private static final long serialVersionUID = 2790864815134158902L;
29+
30+
private JButton close;
31+
32+
public AboutWindow() {
33+
Translator translator = AgentMain.getTranslator();
34+
35+
ImageIcon agentIcon = AgentMain.getAgentIcon();
36+
String vers = null;
37+
if (AgentMain.getCurrentSession() != null && AgentMain.getCurrentSession().getCustomizationManager() != null) {
38+
agentIcon = AgentMain.getCurrentSession().getCustomizationManager().getIconToUse();
39+
String custoTitle = AgentMain.getCurrentSession().getCustomizationManager().getCustomAgentTitle();
40+
if (custoTitle != null) {
41+
vers = translator.getTranslation("cua.about.poweredby", custoTitle);
42+
}
43+
}
44+
if (vers == null) {
45+
vers = translator.getTranslation("cua.title");
46+
}
47+
48+
Dimension curDim = new Dimension(400, 300);
49+
setMinimumSize(curDim);
50+
setSize(curDim);
51+
setTitle(translator.getTranslation("cua.popup.about"));
52+
53+
setLocationRelativeTo(null);
54+
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
55+
56+
getRootPane().registerKeyboardAction(e -> {
57+
setVisible(false);
58+
dispose();
59+
AgentMain.getAgentPresence().clearAboutWindow();
60+
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
61+
62+
SpringLayout layout = new SpringLayout();
63+
setLayout(layout);
64+
65+
if (agentIcon != null)
66+
setIconImage(agentIcon.getImage());
67+
68+
JLabel programAbout = new JLabel(
69+
translator.getTranslation("cua.about.text", vers, ChiffonUpdaterVersion.getGlobalVersion()));
70+
71+
JLabel agentIconLabel = null;
72+
if (agentIcon != null) {
73+
ImageIcon rescaled = new ImageIcon(agentIcon.getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH));
74+
agentIconLabel = new JLabel(rescaled);
75+
} else {
76+
agentIconLabel = new JLabel();
77+
}
78+
79+
Container contentPane = getContentPane();
80+
81+
close = new JButton(translator.getTranslation("cua.about.close"));
82+
close.addActionListener(this);
83+
84+
JTextArea licenseArea = new JTextArea(AgentMain.getLicenseText());
85+
licenseArea.setEditable(false);
86+
licenseArea.setWrapStyleWord(true);
87+
licenseArea.setLineWrap(true);
88+
89+
JScrollPane licenseScroller = new JScrollPane(licenseArea);
90+
91+
layout.putConstraint(SpringLayout.WEST, agentIconLabel, 10, SpringLayout.WEST, contentPane);
92+
layout.putConstraint(SpringLayout.EAST, agentIconLabel, 10 + 64, SpringLayout.WEST, contentPane);
93+
layout.putConstraint(SpringLayout.NORTH, agentIconLabel, 10, SpringLayout.NORTH, contentPane);
94+
layout.putConstraint(SpringLayout.SOUTH, agentIconLabel, 10 + 64, SpringLayout.NORTH, contentPane);
95+
96+
layout.putConstraint(SpringLayout.WEST, programAbout, 10, SpringLayout.EAST, agentIconLabel);
97+
layout.putConstraint(SpringLayout.EAST, programAbout, -10, SpringLayout.EAST, contentPane);
98+
layout.putConstraint(SpringLayout.NORTH, programAbout, 0, SpringLayout.NORTH, agentIconLabel);
99+
layout.putConstraint(SpringLayout.SOUTH, programAbout, 20, SpringLayout.SOUTH, agentIconLabel);
100+
101+
layout.putConstraint(SpringLayout.WEST, licenseScroller, 10, SpringLayout.WEST, contentPane);
102+
layout.putConstraint(SpringLayout.EAST, licenseScroller, -10, SpringLayout.EAST, contentPane);
103+
layout.putConstraint(SpringLayout.NORTH, licenseScroller, 20, SpringLayout.SOUTH, programAbout);
104+
layout.putConstraint(SpringLayout.SOUTH, licenseScroller, -50, SpringLayout.SOUTH, contentPane);
105+
106+
layout.putConstraint(SpringLayout.WEST, close, -10 - 100, SpringLayout.EAST, contentPane);
107+
layout.putConstraint(SpringLayout.EAST, close, -10, SpringLayout.EAST, contentPane);
108+
layout.putConstraint(SpringLayout.NORTH, close, 10, SpringLayout.SOUTH, licenseScroller);
109+
layout.putConstraint(SpringLayout.SOUTH, close, -10, SpringLayout.SOUTH, contentPane);
110+
111+
add(agentIconLabel);
112+
add(programAbout);
113+
add(licenseScroller);
114+
add(close);
115+
}
116+
117+
@Override
118+
public void actionPerformed(ActionEvent e) {
119+
if (e.getSource() == close) {
120+
setVisible(false);
121+
dispose();
122+
AgentMain.getAgentPresence().clearAboutWindow();
123+
}
124+
}
125+
126+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* This file is part of ChiffonUpdater
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
7+
package io.github.explodingbottle.chiffonupdater;
8+
9+
import java.io.File;
10+
import java.io.Serializable;
11+
import java.util.List;
12+
13+
public class ActionRecord implements Serializable {
14+
15+
private static final long serialVersionUID = -5627823587205234390L;
16+
17+
private ActionResult status;
18+
private long actionDate;
19+
private boolean wasDowngrade;
20+
private File installLocation;
21+
private String installVersion;
22+
private String targetVersion;
23+
private String productName;
24+
private List<String> features;
25+
26+
public ActionRecord(String productName, ActionResult status, long actionDate, boolean wasDowngrade,
27+
File installLocation, String installVersion, String targetVersion, List<String> features) {
28+
this.status = status;
29+
this.actionDate = actionDate;
30+
this.wasDowngrade = wasDowngrade;
31+
this.installLocation = installLocation;
32+
this.installVersion = installVersion;
33+
this.targetVersion = targetVersion;
34+
this.features = features;
35+
this.productName = productName;
36+
}
37+
38+
public String getProductName() {
39+
return productName;
40+
}
41+
42+
public ActionResult getStatus() {
43+
return status;
44+
}
45+
46+
public long getActionDate() {
47+
return actionDate;
48+
}
49+
50+
public boolean wasDowngrade() {
51+
return wasDowngrade;
52+
}
53+
54+
public File getInstallLocation() {
55+
return installLocation;
56+
}
57+
58+
public String getInstallVersion() {
59+
return installVersion;
60+
}
61+
62+
public String getTargetVersion() {
63+
return targetVersion;
64+
}
65+
66+
public List<String> getFeatures() {
67+
return features;
68+
}
69+
70+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* This file is part of ChiffonUpdater
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
7+
package io.github.explodingbottle.chiffonupdater;
8+
9+
public enum ActionResult {
10+
SUCCEED, FAILED, CANCELLED;
11+
}

0 commit comments

Comments
 (0)