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 ""; }
public static String _startservicio_click() throws Exception { // BA.debugLineNum = 76;BA.debugLine="Sub StartServicio_click"; // BA.debugLineNum = 77;BA.debugLine="IOIOConnect"; _ioioconnect(); // BA.debugLineNum = 78;BA.debugLine="StartService(Servicio)"; anywheresoftware.b4a.keywords.Common.StartService( mostCurrent.activityBA, (Object) (mostCurrent._servicio.getObject())); // BA.debugLineNum = 79;BA.debugLine="End Sub"; return ""; }
public static String _downloadlist( anywheresoftware.b4a.BA _ba, String _jobname, anywheresoftware.b4a.objects.collections.List _urls) throws Exception { // BA.debugLineNum = 21;BA.debugLine="Sub DownloadList(JobName As String, URLs As List)"; // BA.debugLineNum = 22;BA.debugLine="If internalCheckIfCanStart(JobName) = False Then Return"; if (_internalcheckifcanstart(_ba, _jobname) == anywheresoftware.b4a.keywords.Common.False) { if (true) return ""; } ; // BA.debugLineNum = 23;BA.debugLine="Tasks = URLs"; _tasks = _urls; // BA.debugLineNum = 24;BA.debugLine="HttpUtilsService.Post = False"; mostCurrent._httputilsservice._post = anywheresoftware.b4a.keywords.Common.False; // BA.debugLineNum = 25;BA.debugLine="StartService(HttpUtilsService)"; anywheresoftware.b4a.keywords.Common.StartService( _ba, (Object) (mostCurrent._httputilsservice.getObject())); // BA.debugLineNum = 26;BA.debugLine="End Sub"; return ""; }
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 ""; }