Ejemplo n.º 1
0
 public static String _postfile(
     anywheresoftware.b4a.BA _ba, String _jobname, String _url, String _dir, String _filename)
     throws Exception {
   int _length = 0;
   anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _in = null;
   anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
   // BA.debugLineNum = 34;BA.debugLine="Sub PostFile(JobName As String, URL As String, Dir As
   // String, FileName As String)";
   // BA.debugLineNum = 35;BA.debugLine="If internalCheckIfCanStart(JobName) = False Then Return";
   if (_internalcheckifcanstart(_ba, _jobname) == anywheresoftware.b4a.keywords.Common.False) {
     if (true) return "";
   }
   ;
   // BA.debugLineNum = 36;BA.debugLine="Dim length As Int";
   _length = 0;
   // BA.debugLineNum = 37;BA.debugLine="If Dir = File.DirAssets Then";
   if ((_dir).equals(anywheresoftware.b4a.keywords.Common.File.getDirAssets())) {
     // BA.debugLineNum = 38;BA.debugLine="Log(\"Cannot send files from the assets folder.\")";
     anywheresoftware.b4a.keywords.Common.Log("Cannot send files from the assets folder.");
     // BA.debugLineNum = 39;BA.debugLine="Return";
     if (true) return "";
   }
   ;
   // BA.debugLineNum = 41;BA.debugLine="length = File.Size(Dir, FileName)";
   _length = (int) (anywheresoftware.b4a.keywords.Common.File.Size(_dir, _filename));
   // BA.debugLineNum = 42;BA.debugLine="Dim In As InputStream";
   _in = new anywheresoftware.b4a.objects.streams.File.InputStreamWrapper();
   // BA.debugLineNum = 43;BA.debugLine="In = File.OpenInput(Dir, FileName)";
   _in = anywheresoftware.b4a.keywords.Common.File.OpenInput(_dir, _filename);
   // BA.debugLineNum = 44;BA.debugLine="If length < 1000000 Then '1mb";
   if (_length < 1000000) {
     // BA.debugLineNum = 47;BA.debugLine="Dim out As OutputStream";
     _out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
     // BA.debugLineNum = 48;BA.debugLine="out.InitializeToBytesArray(length)";
     _out.InitializeToBytesArray(_length);
     // BA.debugLineNum = 49;BA.debugLine="File.Copy2(In, out)";
     anywheresoftware.b4a.keywords.Common.File.Copy2(
         (java.io.InputStream) (_in.getObject()), (java.io.OutputStream) (_out.getObject()));
     // BA.debugLineNum = 50;BA.debugLine="HttpUtilsService.PostInputStream = Null";
     mostCurrent._httputilsservice._postinputstream.setObject(
         (java.io.InputStream) (anywheresoftware.b4a.keywords.Common.Null));
     // BA.debugLineNum = 51;BA.debugLine="HttpUtilsService.PostBytes = out.ToBytesArray";
     mostCurrent._httputilsservice._postbytes = _out.ToBytesArray();
   } else {
     // BA.debugLineNum = 53;BA.debugLine="HttpUtilsService.PostInputStream = In";
     mostCurrent._httputilsservice._postinputstream = _in;
     // BA.debugLineNum = 54;BA.debugLine="HttpUtilsService.PostLength = length";
     mostCurrent._httputilsservice._postlength = _length;
   }
   ;
   // BA.debugLineNum = 56;BA.debugLine="Tasks = Array As String(URL)";
   _tasks = anywheresoftware.b4a.keywords.Common.ArrayToList(new String[] {_url});
   // BA.debugLineNum = 57;BA.debugLine="HttpUtilsService.Post = True";
   mostCurrent._httputilsservice._post = anywheresoftware.b4a.keywords.Common.True;
   // BA.debugLineNum = 58;BA.debugLine="StartService(HttpUtilsService)";
   anywheresoftware.b4a.keywords.Common.StartService(
       _ba, (Object) (mostCurrent._httputilsservice.getObject()));
   // BA.debugLineNum = 59;BA.debugLine="End Sub";
   return "";
 }
Ejemplo n.º 2
0
 public static String _download(anywheresoftware.b4a.BA _ba, String _jobname, String _url)
     throws Exception {
   // BA.debugLineNum = 16;BA.debugLine="Sub Download(JobName As String, URL As String)";
   // BA.debugLineNum = 17;BA.debugLine="DownloadList(JobName, Array As String(URL))";
   _downloadlist(
       _ba, _jobname, anywheresoftware.b4a.keywords.Common.ArrayToList(new String[] {_url}));
   // BA.debugLineNum = 18;BA.debugLine="End Sub";
   return "";
 }
Ejemplo n.º 3
0
 public static String _insertareview(
     anywheresoftware.b4a.BA _ba, String _titulo, String _nota, String _tipo) throws Exception {
   String _fecha = "";
   // BA.debugLineNum = 28;BA.debugLine="Sub InsertaReview(titulo As String, nota As String, tipo
   // As String)";
   // BA.debugLineNum = 29;BA.debugLine="Dim fecha As String";
   _fecha = "";
   // BA.debugLineNum = 30;BA.debugLine="Try";
   try { // BA.debugLineNum = 31;BA.debugLine="fecha=Mi_BD.ExecQuerySingleResult(\"SELECT
     // datetime(CURRENT_TIMESTAMP,'localtime')\")";
     _fecha = _mi_bd.ExecQuerySingleResult("SELECT datetime(CURRENT_TIMESTAMP,'localtime')");
   } catch (Exception e23) {
     (_ba.processBA == null ? _ba : _ba.processBA)
         .setLastException(
             e23); // BA.debugLineNum = 33;BA.debugLine="Log(\"catch ERROR INSERT INTO REVIEW:
     // \"&LastException.Message)";
     anywheresoftware.b4a.keywords.Common.Log(
         "catch ERROR INSERT INTO REVIEW: "
             + anywheresoftware.b4a.keywords.Common.LastException(_ba).getMessage());
   }
   ;
   // BA.debugLineNum = 36;BA.debugLine="Try";
   try { // BA.debugLineNum = 37;BA.debugLine="Mi_BD.ExecNonQuery2(\"INSERT INTO REVIEW
     // (titulo,nota,tipo,fecha_registro) VALUES (?,?,?,'\"&fecha&\"')\", Array As
     // Object(titulo,nota,tipo))";
     _mi_bd.ExecNonQuery2(
         "INSERT INTO REVIEW (titulo,nota,tipo,fecha_registro) VALUES (?,?,?,'" + _fecha + "')",
         anywheresoftware.b4a.keywords.Common.ArrayToList(
             new Object[] {(Object) (_titulo), (Object) (_nota), (Object) (_tipo)}));
   } catch (Exception e28) {
     (_ba.processBA == null ? _ba : _ba.processBA)
         .setLastException(
             e28); // BA.debugLineNum = 39;BA.debugLine="Log(\"catch ERROR INSERT INTO REVIEW:
     // \"&LastException.Message)";
     anywheresoftware.b4a.keywords.Common.Log(
         "catch ERROR INSERT INTO REVIEW: "
             + anywheresoftware.b4a.keywords.Common.LastException(_ba).getMessage());
   }
   ;
   // BA.debugLineNum = 41;BA.debugLine="End Sub";
   return "";
 }
Ejemplo n.º 4
0
 public static String _postbytes(
     anywheresoftware.b4a.BA _ba, String _jobname, String _url, byte[] _data) throws Exception {
   // BA.debugLineNum = 62;BA.debugLine="Sub PostBytes(JobName As String, URL As String, Data() As
   // Byte)";
   // BA.debugLineNum = 63;BA.debugLine="If internalCheckIfCanStart(JobName) = False Then Return";
   if (_internalcheckifcanstart(_ba, _jobname) == anywheresoftware.b4a.keywords.Common.False) {
     if (true) return "";
   }
   ;
   // BA.debugLineNum = 64;BA.debugLine="HttpUtilsService.PostInputStream = Null";
   mostCurrent._httputilsservice._postinputstream.setObject(
       (java.io.InputStream) (anywheresoftware.b4a.keywords.Common.Null));
   // BA.debugLineNum = 65;BA.debugLine="HttpUtilsService.PostBytes = Data";
   mostCurrent._httputilsservice._postbytes = _data;
   // BA.debugLineNum = 66;BA.debugLine="Tasks = Array As String(URL)";
   _tasks = anywheresoftware.b4a.keywords.Common.ArrayToList(new String[] {_url});
   // BA.debugLineNum = 67;BA.debugLine="HttpUtilsService.Post = True";
   mostCurrent._httputilsservice._post = anywheresoftware.b4a.keywords.Common.True;
   // BA.debugLineNum = 68;BA.debugLine="StartService(HttpUtilsService)";
   anywheresoftware.b4a.keywords.Common.StartService(
       _ba, (Object) (mostCurrent._httputilsservice.getObject()));
   // BA.debugLineNum = 69;BA.debugLine="End Sub";
   return "";
 }