Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
Autor |
Nachricht |
Sams1
Anmeldungsdatum: 22.01.2012 Beiträge: 12
|
Verfasst am: 23.01.2012, 19:59 Titel: Gute Idee |
|
|
ist ja open source (ProjectX) ich schau mal ob ich die Stelle finde... |
|
Nach oben |
|
 |
Sams1
Anmeldungsdatum: 22.01.2012 Beiträge: 12
|
Verfasst am: 23.01.2012, 20:13 Titel: Auszug aus Java code... |
|
|
Ja hier ist der Bereich wo es nach schnellem Check in Java sein sollte.
(wenn mir einer sagt wie ich ein attachment hinbekomme könnte ich es komplett posten)
public static void performPostCommand(Object[] lastlist)
{
if (!getSettings().getBooleanProperty(Keys.KEY_enablePostProcessing))
return;
String cmdl = "";
switch (getSettings().getIntProperty(Keys.KEY_ConversionMode))
{
case CommonParsing.ACTION_DEMUX:
cmdl = getSettings().getProperty(Keys.KEY_PostCommands_Cmd4);
break;
case CommonParsing.ACTION_TO_VDR:
cmdl = getSettings().getProperty(Keys.KEY_PostCommands_Cmd5);
break;
case CommonParsing.ACTION_TO_M2P:
cmdl = getSettings().getProperty(Keys.KEY_PostCommands_Cmd6);
break;
case CommonParsing.ACTION_TO_PVA:
cmdl = getSettings().getProperty(Keys.KEY_PostCommands_Cmd7);
break;
case CommonParsing.ACTION_TO_TS:
cmdl = getSettings().getProperty(Keys.KEY_PostCommands_Cmd8);
break;
default:
return;
}
cmdl = cmdl.trim();
if (cmdl.length() > 0 && lastlist.length > 0)
{
ArrayList argList = new ArrayList();
String append_str = "";
boolean isQuoted = false;
int appending = cmdl.lastIndexOf(" \"?");
if (appending < 0)
appending = cmdl.lastIndexOf(" ?");
else
isQuoted = true;
if (appending < 0)
argList.add(cmdl.trim());
else
{
append_str = cmdl.substring(appending).replace('"', ' ').trim();
cmdl = cmdl.substring(0, appending).trim();
argList.add(cmdl);
appending = Integer.parseInt(append_str.substring(1));
if (appending == 0 || appending > lastlist.length)
appending = lastlist.length;
for (int l = 0; l < lastlist.length && l < appending; l++)
{
String str = lastlist[l].toString();
str = str.substring(str.indexOf("'") + 1, str.length() - 1);
if (isQuoted)
argList.add("" + (char)34 + str + (char)34);
else
argList.add(str);
}
}
String commandline = "";
String[] arguments = new String[argList.size()];
for (int l = 0; l < arguments.length; l++)
{
arguments[l] = argList.get(l).toString();
commandline += l == 0 ? "" : " ";
commandline += arguments[l];
}
setMessage(Resource.getString("working.post.command") + " {" + commandline + "}");
try {
Process subprocess = Runtime.getRuntime().exec(commandline); // anyone has told that works better
// Process subprocess = Runtime.getRuntime().exec(arguments);
if (getSettings().getBooleanProperty(Keys.KEY_PostProcessCompletion))
{
setMessage("-> waiting for completion of subprocess..");
setMessage("-> returncode of subprocess: " + subprocess.waitFor());
}
} catch (Exception re) {
setExceptionMessage(re);
}
argList = null;
}
}
/**
* should support loading of supported URLs/files via CLI
*/
public static XInputFile getInputFile(String value)
{
XInputFile inputValue = null;
URL url = null;
if (value == null)
return null;
try
{
url = new URL(value);
String protocol = url.getProtocol();
if (protocol.equals("ftp"))
{
XInputDirectory xid = new XInputDirectory(url);
XInputFile[] xif = xid.getFiles();
for (int i = 0; i < xif.length; i++)
{
if ( new URL(xif[i].toString()).getFile().equals(url.getFile()) )
{
inputValue = xif[i];
break;
}
}
}
else if (protocol.equals("file"))
inputValue = new XInputFile(new File(url.getHost() + url.getFile()));
else
System.out.println("!> Protocol not yet supported: " + protocol);
return inputValue;
}
catch (Exception u1)
{}
try {
File f = new File(value);
if (f.exists())
{
inputValue = new XInputFile(f);
return inputValue;
}
} catch (Exception e) {
System.out.println("local Filesystem access: '" + value + "' > " + e);
}
try {
inputValue = new XInputFile(value);
return inputValue;
} catch (Exception e) {
System.out.println("ext. Filesystem access: '" + value + "' > " + e);
}
return null;
} |
|
Nach oben |
|
 |
Cherry
Anmeldungsdatum: 20.06.2007 Beiträge: 249
|
Verfasst am: 24.01.2012, 17:10 Titel: |
|
|
...öffnet das Konsolenfenster, falls es noch nicht offen war.
Sollte es offen, aber versteckt sein, tuts folgender Code:
Code: | ShowWindow(GetConsoleWindow(), SW_SHOW) |
(Beides mit #include "windows.bi" bitte) |
|
Nach oben |
|
 |
|