public bool hGetNow(string sSc) { if (!sSc.StartsWith("GETNOW")) { return(false); } if (bDebug) { inf("get now"); } infln(""); DLMan.Grab(); return(true); }
public bool hGrab(string sSc) { if (!sSc.StartsWith("GRAB ")) { return(false); } if (bDebug) { inf("grab "); } iGrabCnt++; int iThisCnt = 0; sSc = sSc.Substring(sSc.IndexOf(" ") + 1); int iTargetU = ((int)sSc[0]) - (int)'a'; sSc = sSc.Substring(sSc.IndexOf(", ") + 2); int iOfs1 = Convert.ToInt32(sSc.Substring(0, sSc.IndexOf(", "))); sSc = sSc.Substring(sSc.IndexOf(", ") + 2); int iOfs2 = Convert.ToInt32(sSc.Substring(0, sSc.IndexOf(", "))); sSc = sSc.Substring(sSc.IndexOf(", ") + 2); for (int a = iOfs1; a < gsaVa[iTargetU].Length - iOfs2; a++) { iFileCnt++; iThisCnt++; string sFn = sSc; string sUri = gsaVa[iTargetU][a]; if (sFn.StartsWith("[[ofn")) { string[] sUriParts = GUI.Split(sUri, "/"); string sUPCnt = sFn.Substring("[[ofn".Length); sUPCnt = sUPCnt.Substring(0, sUPCnt.IndexOf("]]")); int iUPCnt = Convert.ToInt32(sUPCnt); int iUPTot = sUriParts.Length; sFn = sUriParts[iUPTot - 1]; for (int b = 1; b < iUPCnt; b++) { sFn = sUriParts[iUPTot - b - 1] + "\\" + sFn; } } else { for (int b = 0; b < iChr; b++) { char cThis = (char)((int)'a' + b); sFn = sFn.Replace("%g", "" + iGrabCnt); sFn = sFn.Replace("%f", "" + iFileCnt); sFn = sFn.Replace("%i", "" + a); if (sFn.Contains(cThis + "]]")) { sFn = sFn.Replace("[[c" + cThis + "]]", saC[b]); sFn = sFn.Replace("[[" + cThis + "]]", gsaV[b]); sFn = sFn.Replace("[[o" + cThis + "]]", gsaOV[b]); if (gsaVa[b].Length > a) { sFn = sFn.Replace("[[v" + cThis + "]]", gsaVa[b][a]); } if (gsaOVa[b].Length > a) { sFn = sFn.Replace("[[ov" + cThis + "]]", gsaOVa[b][a]); } } } } //alUriLst.Add(sUri); //alFPaths.Add(sd.sPath + gsRoot + sFn); FileDL fDL = new FileDL(sUri, GUI.sAppPath + gsRoot + sFn); fDL.scConf = sd.scConf; DLMan.Add(fDL); } infln("- " + "Added " + iThisCnt + " files (" + iFileCnt + " in total)"); return(true); }
public int hScript(int iScOfs, int iDepth, string sSrc, string sSaveTo, string[] saOV, string[][] saOVa, int saOVai) { string[] saV = new string[iChr]; string[][] saVa = new string[iChr][]; for (int a = 0; a < iChr; a++) { saV[a] = sSrc; saVa[a] = new string[] { "" }; } //if (bDebug) { // infln("?! lv." + iDepth + " - ln." + (iScOfs + 1)); //} for (int iSc = iScOfs; iSc < saSc.Length; iSc++) { if (bDebug) { infln("? lv." + iDepth + " - ln." + (iSc + 1) + " - "); } if (saSc[iSc].StartsWith("NAVIGATE ")) { if (bDebug) { inf("navigate "); } string sTmp = saSc[iSc]; sTmp = sTmp.Substring(sTmp.IndexOf(" ") + 1); string[] saNav = GUI.Split(sTmp, ", "); if (saNav.Length == 1) { //Single variable or full url if (bDebug) { inf("(1var/scUrl)"); } if (saNav[0].Length < 5) { saNav[0] = "[[" + saNav[0] + "]]"; } string sUrl = hParseVar(saNav[0]); string sNewSrc = http.nav(sUrl); infln(" Reading url (" + DLMan.sMLen(sUrl, 56) + ")"); iSc = hScript(iSc + 1, iDepth + 1, sNewSrc, sSaveTo, saV, saVa, 0); } else { //Iteration through array if (bDebug) { inf("(iterate)"); } int iResumeAt = iSc; string[] sURLs = hParseRef(saNav[0]); int iOfs1 = Convert.ToInt32(saNav[1]); int iOfs2 = Convert.ToInt32(saNav[2]); for (int a = iOfs1; a < sURLs.Length - iOfs2; a++) { if (bDebug) { infln("? it." + (a + 1) + " - url: " + sURLs[a] + " - "); } string sUrl = hParseVar(sURLs[a]); string sNewSrc = http.nav(sUrl); infln(" Reading url " + (a + 1) + "/" + sURLs.Length + " (" + DLMan.sMLen(sUrl, 48) + ")"); iResumeAt = hScript(iSc + 1, iDepth + 1, sNewSrc, sSaveTo, saV, saVa, a); } iSc = iResumeAt; } } else if (saSc[iSc] == "RETURN") { if (bDebug) { inf("returning"); } return(iSc); } else { gsaV = saV; gsaVa = saVa; gsaOV = saOV; gsaOVa = saOVa; gsaOVai = saOVai; gsRoot = sSaveTo; giSc = iSc; hGrab(saSc[iSc]); hGetNow(saSc[iSc]); hSkew(saSc[iSc]); hSplit(saSc[iSc]); hSetVar(saSc[iSc]); hAddCut(saSc[iSc]); hReplace(saSc[iSc]); hChRoot(saSc[iSc]); hEcho(saSc[iSc]); hMath(saSc[iSc]); hGoto(saSc[iSc]); hEvent(saSc[iSc]); iSc = giSc; sSaveTo = gsRoot; saOVai = gsaOVai; saOVa = gsaOVa; saOV = gsaOV; saVa = gsaVa; saV = gsaV; } } return(saSc.Length); }
public FileDL(string sUri, string sPath, string sName) { sFUri = sUri; sFPath = DLMan.sFilterPath(sPath.Replace("\\", "/")); sFName = DLMan.sFilterName(sName); }
public FileDL(string sUri, string sPath) { sFUri = sUri; sPath = sPath.Replace("\\", "/"); sFPath = DLMan.sFilterPath(sPath.Substring(0, sPath.LastIndexOf("/") + 1)); sFName = DLMan.sFilterName(sPath.Substring(sPath.LastIndexOf("/") + 1)); }
public FileDL(string sUri) { sFUri = sUri; sFName = DLMan.sFilterName(sFUri.Substring(sFUri.LastIndexOf("/") + 1)); }