|
|
@ -31,30 +31,30 @@ public class PluginsReaderFromStore { |
|
|
|
* @return 插件信息 |
|
|
|
* @return 插件信息 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Plugin[] readPlugins() throws Exception { |
|
|
|
public static Plugin[] readPlugins() throws Exception { |
|
|
|
String resText; |
|
|
|
String resText; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.store")); |
|
|
|
|
|
|
|
resText = httpClient.getResponseText(); |
|
|
|
|
|
|
|
String charSet = EncodeConstants.ENCODING_UTF_8; |
|
|
|
|
|
|
|
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
throw new Exception(Inter.getLocText("FR-Designer-Plugin_PluginMarket_Coding")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(resText)) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.store")); |
|
|
|
plugins.clear();//先清空set
|
|
|
|
resText = httpClient.getResponseText(); |
|
|
|
JSONArray jsonArray = new JSONArray(resText); |
|
|
|
String charSet = EncodeConstants.ENCODING_UTF_8; |
|
|
|
for (int i = 0, size = jsonArray.length(); i < size; i++) { |
|
|
|
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet); |
|
|
|
Plugin plugin = new Plugin(); |
|
|
|
} catch (Exception e) { |
|
|
|
plugin.parseJSON(jsonArray.optJSONObject(i)); |
|
|
|
throw new Exception(Inter.getLocText("FR-Designer-Plugin_PluginMarket_Coding")); |
|
|
|
if (plugin.isValidate()) { |
|
|
|
} |
|
|
|
plugins.add(plugin); |
|
|
|
if (StringUtils.isNotEmpty(resText)) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
plugins.clear();//先清空set
|
|
|
|
|
|
|
|
JSONArray jsonArray = new JSONArray(resText); |
|
|
|
|
|
|
|
for (int i = 0, size = jsonArray.length(); i < size; i++) { |
|
|
|
|
|
|
|
Plugin plugin = new Plugin(); |
|
|
|
|
|
|
|
plugin.parseJSON(jsonArray.optJSONObject(i)); |
|
|
|
|
|
|
|
if (plugin.isValidate()) { |
|
|
|
|
|
|
|
plugins.add(plugin); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (JSONException e) { |
|
|
|
|
|
|
|
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (JSONException e) { |
|
|
|
|
|
|
|
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return plugins.toArray(new Plugin[plugins.size()]); |
|
|
|
return plugins.toArray(new Plugin[plugins.size()]); |
|
|
|
} |
|
|
|
} |
|
|
@ -65,35 +65,33 @@ public class PluginsReaderFromStore { |
|
|
|
* @return 插件信息 |
|
|
|
* @return 插件信息 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Plugin[] readPluginsForUpdate() throws Exception { |
|
|
|
public static Plugin[] readPluginsForUpdate() throws Exception { |
|
|
|
String resText; |
|
|
|
String resText = null; |
|
|
|
|
|
|
|
String url = SiteCenter.getInstance().acquireUrlByKind("plugin.update"); |
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(url)) { |
|
|
|
|
|
|
|
HashMap<String, String> para = new HashMap<String, String>(); |
|
|
|
|
|
|
|
para.put("plugins", PluginLoader.getLoader().pluginsToString()); |
|
|
|
|
|
|
|
//只有当前设计器的jar高于插件新版本需要的jarTime时, 才提示更新该插件.
|
|
|
|
|
|
|
|
para.put("jarTime", GeneralUtils.readBuildNO()); |
|
|
|
|
|
|
|
HttpClient httpClient = new HttpClient(url, para); |
|
|
|
|
|
|
|
resText = httpClient.getResponseText(); |
|
|
|
|
|
|
|
String charSet = EncodeConstants.ENCODING_UTF_8; |
|
|
|
|
|
|
|
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(resText)) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
HashMap<String, String> para = new HashMap<String, String>(); |
|
|
|
pluginsToUpdate.clear(); |
|
|
|
para.put("plugins", PluginLoader.getLoader().pluginsToString()); |
|
|
|
JSONArray jsonArray = new JSONArray(resText); |
|
|
|
//只有当前设计器的jar高于插件新版本需要的jarTime时, 才提示更新该插件.
|
|
|
|
for (int i = 0, size = jsonArray.length(); i < size; i++) { |
|
|
|
para.put("jarTime", GeneralUtils.readBuildNO()); |
|
|
|
Plugin plugin = new Plugin(); |
|
|
|
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.update"), para); |
|
|
|
plugin.parseJSON(jsonArray.optJSONObject(i)); |
|
|
|
resText = httpClient.getResponseText(); |
|
|
|
if (plugin.isValidate()) { |
|
|
|
String charSet = EncodeConstants.ENCODING_UTF_8; |
|
|
|
pluginsToUpdate.add(plugin); |
|
|
|
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
throw new Exception(Inter.getLocText("FR-Designer-Plugin_PluginMarket_Coding")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(resText)) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
pluginsToUpdate.clear(); |
|
|
|
|
|
|
|
JSONArray jsonArray = new JSONArray(resText); |
|
|
|
|
|
|
|
for (int i = 0, size = jsonArray.length(); i < size; i++) { |
|
|
|
|
|
|
|
Plugin plugin = new Plugin(); |
|
|
|
|
|
|
|
plugin.parseJSON(jsonArray.optJSONObject(i)); |
|
|
|
|
|
|
|
if (plugin.isValidate()) { |
|
|
|
|
|
|
|
pluginsToUpdate.add(plugin); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (JSONException e) { |
|
|
|
|
|
|
|
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (JSONException e) { |
|
|
|
|
|
|
|
throw new Exception(Inter.getLocText("FR-Designer-Plugin_Read_Plugin_List_Error")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return pluginsToUpdate.toArray(new Plugin[pluginsToUpdate.size()]); |
|
|
|
return pluginsToUpdate.toArray(new Plugin[pluginsToUpdate.size()]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|