Skip to content

Instantly share code, notes, and snippets.

@Raggles
Created October 18, 2017 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raggles/4282b7414713e1f848bb70039beccc9d to your computer and use it in GitHub Desktop.
Save Raggles/4282b7414713e1f848bb70039beccc9d to your computer and use it in GitHub Desktop.
Original SallDLL
package au.com.invensys.scada.syscfg;
import au.com.invensys.scada.utils.Logger;
import au.com.invensys.scada.utils.Utils;
import java.io.File;
import java.io.IOException;
public class SallDLL
{
native void sallMain(String paramString1, String paramString2, String paramString3, String paramString4);
public void call(String firmware, String sallFilePath, String cFilePath, String errorFilePath)
{
String Path = Utils.concatenatePathStrings("CalcsRTU_SALL", firmware + File.separator + "buildsal\\sall.dll");
String Dllpath = Utils.concatenatePathStrings(System.getProperty("SYSCFG_UTILS", ""), Path);
String sallDllPath = Utils.concatenatePathStrings(System.getProperty("user.dir"), Dllpath);
Logger.instance().logError("Sall Compilation Path: " + sallDllPath);
System.load(sallDllPath);
firmware = changePartNumber(firmware);
Logger.instance().logError("firmware : " + firmware);
File cFile = new File(cFilePath);
try
{
if (cFile.exists())
{
cFile.delete();
Logger.instance().logError("file deleted");
}
boolean temp = cFile.createNewFile();
Logger.instance().logError("file created :" + temp);
}
catch (IOException e)
{
e.printStackTrace();
}
SallDLL salldll = new SallDLL();
salldll.sallMain(firmware, sallFilePath, cFilePath, errorFilePath);
}
public String changePartNumber(String firmware)
{
firmware = firmware.substring(firmware.indexOf("-") + 1, firmware.length()).replace("_", "-");
if (firmware.charAt(firmware.length() - 1) == '-')
{
firmware = firmware.concat("_");
return firmware;
}
return firmware;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment