protected bool XMain(bool main, XInput xinput, XOutput xoutput, XOutput xerror, XOutput xlog) { bool bRes = true; while (bRes) { bRes = xinput.XRead(); if (bRes) { if (main) { bRes = XIsProgram(xinput); if (bRes) { bRes = _XProgram(xinput, xoutput, xerror, xlog); } else { bRes = XIsFunction(xinput); if (bRes) { bRes = XFunction(xinput, xoutput, xerror, xlog); } } } if (bRes) { bRes = xoutput.XWrite(); if (bRes) { bRes = xerror.XWrite(); if (bRes) { bRes = xoutput.XWrite(); } } } } } return(bRes); }
public void XMain(XInput xargs) { bool bRes = xargs.XRead(); if (bRes) { string input = xargs.XRead(XIN); string output = xargs.XRead(XOUT); string error = xargs.XRead(XERR); string log = xargs.XRead(XLOG); XInput xinput = null; XOutput xoutput = null; XOutput xerror = null; XOutput xlog = null; if (input == null) { xinput = new XStdInput(); xoutput = new XStdOutput(); xerror = new XStdOutput(); xlog = new XStdOutput(); } else { bRes = XCreateRemoteInput(input, out xinput); if (bRes) { if (output == null) { xoutput = new XStdOutput(); if (error == null) { xerror = new XStdOutput(); } else { bRes = XCreateRemoteOutput(error, out xerror); } if (log == null) { xlog = new XStdOutput(); } else { bRes = XCreateRemoteOutput(log, out xlog); } } else { XOutput xparentOutput = null; bRes = XCreateRemoteOutput(output, out xparentOutput); if (bRes) { string newOutput = null; bRes = XCreateOutput(out xoutput, out newOutput); if (bRes) { xparentOutput.XWrite(XOUT, newOutput); } if (bRes) { string newError = null; bRes = XCreateOutput(out xerror, out newError); if (bRes) { xparentOutput.XWrite(XERR, newError); } } if (bRes) { string newLog = null; bRes = XCreateOutput(out xlog, out newLog); if (bRes) { xparentOutput.XWrite(XLOG, newLog); } } if (bRes) { bRes = xparentOutput.XWrite(); } } } } } bRes = XMain(true, xinput, xoutput, xerror, xlog); bRes = XClose(); } }