コード例 #1
0
ファイル: httputils.java プロジェクト: jackcaicn/b4a.mblogs
 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 "";
 }
コード例 #2
0
ファイル: register.java プロジェクト: aignatd/ezMetube-B4A
 public static String _jobdone(metube.mncplaymedia.com.mnchttpjob _mnchttp) throws Exception {
   try {
     Debug.PushSubsStack(
         "JobDone (register) ", "register", 3, mostCurrent.activityBA, mostCurrent, 99);
     adr.stringfunctions.stringfunctions _sf = null;
     String _stmp = "";
     anywheresoftware.b4a.objects.collections.JSONParser _parser = null;
     anywheresoftware.b4a.objects.collections.Map _mresult = null;
     byte[] _btmp = null;
     anywheresoftware.b4a.agraham.byteconverter.ByteConverter _bctmp = null;
     anywheresoftware.b4a.objects.StringUtils _su = null;
     Debug.locals.put("MNChttp", _mnchttp);
     BA.debugLineNum = 99;
     BA.debugLine = "Sub JobDone (MNChttp As MNChttpjob)";
     Debug.ShouldStop(4);
     BA.debugLineNum = 100;
     BA.debugLine = "Dim sf			As StringFunctions";
     Debug.ShouldStop(8);
     _sf = new adr.stringfunctions.stringfunctions();
     Debug.locals.put("sf", _sf);
     BA.debugLineNum = 101;
     BA.debugLine = "Dim sTmp 		As String";
     Debug.ShouldStop(16);
     _stmp = "";
     Debug.locals.put("sTmp", _stmp);
     BA.debugLineNum = 102;
     BA.debugLine = "Dim parser 		As JSONParser";
     Debug.ShouldStop(32);
     _parser = new anywheresoftware.b4a.objects.collections.JSONParser();
     Debug.locals.put("parser", _parser);
     BA.debugLineNum = 103;
     BA.debugLine = "Dim mresult		As Map";
     Debug.ShouldStop(64);
     _mresult = new anywheresoftware.b4a.objects.collections.Map();
     Debug.locals.put("mresult", _mresult);
     BA.debugLineNum = 104;
     BA.debugLine = "Dim bTmp()		As Byte";
     Debug.ShouldStop(128);
     _btmp = new byte[(int) (0)];
     ;
     Debug.locals.put("bTmp", _btmp);
     BA.debugLineNum = 105;
     BA.debugLine = "Dim bcTmp		As ByteConverter";
     Debug.ShouldStop(256);
     _bctmp = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
     Debug.locals.put("bcTmp", _bctmp);
     BA.debugLineNum = 106;
     BA.debugLine = "Dim su 			As StringUtils";
     Debug.ShouldStop(512);
     _su = new anywheresoftware.b4a.objects.StringUtils();
     Debug.locals.put("su", _su);
     BA.debugLineNum = 108;
     BA.debugLine = "Log((MNChttp.GetString))";
     Debug.ShouldStop(2048);
     anywheresoftware.b4a.keywords.Common.Log((_mnchttp._getstring()));
     BA.debugLineNum = 110;
     BA.debugLine = "If MNChttp.Success = False Then";
     Debug.ShouldStop(8192);
     if (_mnchttp._success == anywheresoftware.b4a.keywords.Common.False) {
       BA.debugLineNum = 111;
       BA.debugLine =
           "If (sf.InString(MNChttp.ErrorMessage, \"timed out\") > 0) OR (sf.InString(MNChttp.ErrorMessage, \"refused\") > 0) OR _ 			 (sf.InString(MNChttp.ErrorMessage, \"Unable to resolve host\") > 0) OR (sf.InString(MNChttp.ErrorMessage, \"UnknownHostException\") > 0) OR _ 			 (sf.InString(MNChttp.ErrorMessage, \"FileNotFound\") > 0) Then";
       Debug.ShouldStop(16384);
       if ((_sf._vvv4(_mnchttp._errormessage, "timed out") > 0)
           || (_sf._vvv4(_mnchttp._errormessage, "refused") > 0)
           || (_sf._vvv4(_mnchttp._errormessage, "Unable to resolve host") > 0)
           || (_sf._vvv4(_mnchttp._errormessage, "UnknownHostException") > 0)
           || (_sf._vvv4(_mnchttp._errormessage, "FileNotFound") > 0)) {
         BA.debugLineNum = 115;
         BA.debugLine =
             "Msgbox2(\"Offline Connection or Server Down\", \"Moviebay\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))";
         Debug.ShouldStop(262144);
         anywheresoftware.b4a.keywords.Common.Msgbox2(
             "Offline Connection or Server Down",
             "Moviebay",
             "OK",
             "",
             "",
             (android.graphics.Bitmap)
                 (anywheresoftware.b4a.keywords.Common.LoadBitmap(
                         anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png")
                     .getObject()),
             mostCurrent.activityBA);
       } else {
         BA.debugLineNum = 117;
         BA.debugLine = "If sf.InString(MNChttp.ErrorMessage, \"Not Found\") < 0 Then";
         Debug.ShouldStop(1048576);
         if (_sf._vvv4(_mnchttp._errormessage, "Not Found") < 0) {
           BA.debugLineNum = 119;
           BA.debugLine =
               "Msgbox2(\"Unknown Error\", \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))";
           Debug.ShouldStop(4194304);
           anywheresoftware.b4a.keywords.Common.Msgbox2(
               "Unknown Error",
               "MeTube",
               "OK",
               "",
               "",
               (android.graphics.Bitmap)
                   (anywheresoftware.b4a.keywords.Common.LoadBitmap(
                           anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png")
                       .getObject()),
               mostCurrent.activityBA);
         }
         ;
       }
       ;
       BA.debugLineNum = 123;
       BA.debugLine = "Fungsi.mpList.Put(\"Koneksi\", \"Offline\")";
       Debug.ShouldStop(67108864);
       mostCurrent._fungsi._mplist.Put((Object) ("Koneksi"), (Object) ("Offline"));
       BA.debugLineNum = 124;
       BA.debugLine = "MNChttp.Release";
       Debug.ShouldStop(134217728);
       _mnchttp._release();
     } else {
       BA.debugLineNum = 129;
       BA.debugLine = "Try";
       Debug.ShouldStop(1);
       try {
         BA.debugLineNum = 132;
         BA.debugLine = "parser.Initialize(MNChttp.GetString)";
         Debug.ShouldStop(8);
         _parser.Initialize(_mnchttp._getstring());
         BA.debugLineNum = 133;
         BA.debugLine = "MNChttp.Release";
         Debug.ShouldStop(16);
         _mnchttp._release();
       } catch (Exception e97) {
         processBA.setLastException(e97);
         BA.debugLineNum = 135;
         BA.debugLine =
             "Msgbox2(\"Process Failure !\", \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))";
         Debug.ShouldStop(64);
         anywheresoftware.b4a.keywords.Common.Msgbox2(
             "Process Failure !",
             "MeTube",
             "OK",
             "",
             "",
             (android.graphics.Bitmap)
                 (anywheresoftware.b4a.keywords.Common.LoadBitmap(
                         anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png")
                     .getObject()),
             mostCurrent.activityBA);
         BA.debugLineNum = 136;
         BA.debugLine = "Return";
         Debug.ShouldStop(128);
         if (true) return "";
       }
       ;
       BA.debugLineNum = 139;
       BA.debugLine = "Try";
       Debug.ShouldStop(1024);
       try {
         BA.debugLineNum = 140;
         BA.debugLine = "mresult.Initialize";
         Debug.ShouldStop(2048);
         _mresult.Initialize();
         BA.debugLineNum = 141;
         BA.debugLine = "mresult = parser.NextObject";
         Debug.ShouldStop(4096);
         _mresult = _parser.NextObject();
         Debug.locals.put("mresult", _mresult);
       } catch (Exception e104) {
         processBA.setLastException(e104);
         BA.debugLineNum = 143;
         BA.debugLine =
             "Msgbox2(\"Process Failure !\", \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))";
         Debug.ShouldStop(16384);
         anywheresoftware.b4a.keywords.Common.Msgbox2(
             "Process Failure !",
             "MeTube",
             "OK",
             "",
             "",
             (android.graphics.Bitmap)
                 (anywheresoftware.b4a.keywords.Common.LoadBitmap(
                         anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png")
                     .getObject()),
             mostCurrent.activityBA);
         BA.debugLineNum = 144;
         BA.debugLine = "Return";
         Debug.ShouldStop(32768);
         if (true) return "";
       }
       ;
       BA.debugLineNum = 147;
       BA.debugLine = "If mresult.Get(\"error_code\") <> \"0\" Then";
       Debug.ShouldStop(262144);
       if ((_mresult.Get((Object) ("error_code"))).equals((Object) ("0")) == false) {
         BA.debugLineNum = 148;
         BA.debugLine =
             "Msgbox2(mresult.Get(\"error_msg\"), \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))";
         Debug.ShouldStop(524288);
         anywheresoftware.b4a.keywords.Common.Msgbox2(
             BA.ObjectToString(_mresult.Get((Object) ("error_msg"))),
             "MeTube",
             "OK",
             "",
             "",
             (android.graphics.Bitmap)
                 (anywheresoftware.b4a.keywords.Common.LoadBitmap(
                         anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png")
                     .getObject()),
             mostCurrent.activityBA);
       } else {
         BA.debugLineNum = 150;
         BA.debugLine = "Fungsi.mpList.Put(\"Koneksi\", \"Online\")";
         Debug.ShouldStop(2097152);
         mostCurrent._fungsi._mplist.Put((Object) ("Koneksi"), (Object) ("Online"));
         BA.debugLineNum = 151;
         BA.debugLine = "MNChttp.Release";
         Debug.ShouldStop(4194304);
         _mnchttp._release();
         BA.debugLineNum = 153;
         BA.debugLine = "Select MNChttp.JobName";
         Debug.ShouldStop(16777216);
         switch (BA.switchObjectToInt(_mnchttp._jobname)) {
         }
         ;
       }
       ;
     }
     ;
     BA.debugLineNum = 158;
     BA.debugLine = "End Sub";
     Debug.ShouldStop(536870912);
     return "";
   } catch (Exception e) {
     Debug.ErrorCaught(e);
     throw e;
   } finally {
     Debug.PopSubsStack();
   }
 }
コード例 #3
0
ファイル: register.java プロジェクト: aignatd/ezMetube-B4A
 public static String _bsimpan_click() throws Exception {
   try {
     Debug.PushSubsStack(
         "bSimpan_Click (register) ", "register", 3, mostCurrent.activityBA, mostCurrent, 81);
     metube.mncplaymedia.com.mnchttpjob _homejob = null;
     String _strenc = "";
     anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _gen = null;
     anywheresoftware.b4a.objects.collections.Map _mlogin = null;
     anywheresoftware.b4a.objects.collections.List _mlist = null;
     anywheresoftware.b4a.objects.collections.Map _mmap = null;
     BA.debugLineNum = 81;
     BA.debugLine = "Sub bSimpan_Click";
     Debug.ShouldStop(65536);
     BA.debugLineNum = 82;
     BA.debugLine = "Dim HomeJob As MNChttpjob";
     Debug.ShouldStop(131072);
     _homejob = new metube.mncplaymedia.com.mnchttpjob();
     Debug.locals.put("HomeJob", _homejob);
     BA.debugLineNum = 83;
     BA.debugLine = "Dim	strEnc	As String";
     Debug.ShouldStop(262144);
     _strenc = "";
     Debug.locals.put("strEnc", _strenc);
     BA.debugLineNum = 84;
     BA.debugLine = "Dim Gen		As JSONGenerator";
     Debug.ShouldStop(524288);
     _gen = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
     Debug.locals.put("Gen", _gen);
     BA.debugLineNum = 85;
     BA.debugLine = "Dim mlogin	As Map";
     Debug.ShouldStop(1048576);
     _mlogin = new anywheresoftware.b4a.objects.collections.Map();
     Debug.locals.put("mlogin", _mlogin);
     BA.debugLineNum = 86;
     BA.debugLine = "Dim mlist 	As List";
     Debug.ShouldStop(2097152);
     _mlist = new anywheresoftware.b4a.objects.collections.List();
     Debug.locals.put("mlist", _mlist);
     BA.debugLineNum = 87;
     BA.debugLine = "Dim mMap	As Map";
     Debug.ShouldStop(4194304);
     _mmap = new anywheresoftware.b4a.objects.collections.Map();
     Debug.locals.put("mMap", _mmap);
     BA.debugLineNum = 89;
     BA.debugLine = "HomeJob.Initialize(\"Register\", Me)";
     Debug.ShouldStop(16777216);
     _homejob._initialize(processBA, "Register", register.getObject());
     BA.debugLineNum = 91;
     BA.debugLine = "Try";
     Debug.ShouldStop(67108864);
     try {
       BA.debugLineNum = 92;
       BA.debugLine = "HomeJob.Tag = \"Register\"";
       Debug.ShouldStop(134217728);
       _homejob._tag = (Object) ("Register");
       Debug.locals.put("HomeJob", _homejob);
       BA.debugLineNum = 93;
       BA.debugLine =
           "HomeJob.PostString(Fungsi.mpList.Get(\"RegisterURL\"), Fungsi.mpList.Get(\"firstname\") & etFirst.text & \"&\" & Fungsi.mpList.Get(\"lastname\") & etLast.Text & \"&\" & Fungsi.mpList.Get(\"regemail\") & etMail.Text & \"&\" & Fungsi.mpList.Get(\"regpass\") & etPass.Text )";
       Debug.ShouldStop(268435456);
       _homejob._poststring(
           BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("RegisterURL"))),
           BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("firstname")))
               + mostCurrent._etfirst.getText()
               + "&"
               + BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("lastname")))
               + mostCurrent._etlast.getText()
               + "&"
               + BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("regemail")))
               + mostCurrent._etmail.getText()
               + "&"
               + BA.ObjectToString(mostCurrent._fungsi._mplist.Get((Object) ("regpass")))
               + mostCurrent._etpass.getText());
       BA.debugLineNum = 94;
       BA.debugLine = "HomeJob.GetRequest.Timeout = DateTime.TicksPerSecond * 60";
       Debug.ShouldStop(536870912);
       _homejob
           ._getrequest()
           .setTimeout((int) (anywheresoftware.b4a.keywords.Common.DateTime.TicksPerSecond * 60));
     } catch (Exception e70) {
       processBA.setLastException(e70);
       BA.debugLineNum = 96;
       BA.debugLine =
           "Msgbox2(\"Register Failure !\", \"MeTube\", \"OK\", \"\", \"\", LoadBitmap(File.DirAssets, \"warning.png\"))";
       Debug.ShouldStop(-2147483648);
       anywheresoftware.b4a.keywords.Common.Msgbox2(
           "Register Failure !",
           "MeTube",
           "OK",
           "",
           "",
           (android.graphics.Bitmap)
               (anywheresoftware.b4a.keywords.Common.LoadBitmap(
                       anywheresoftware.b4a.keywords.Common.File.getDirAssets(), "warning.png")
                   .getObject()),
           mostCurrent.activityBA);
     }
     ;
     BA.debugLineNum = 98;
     BA.debugLine = "End Sub";
     Debug.ShouldStop(2);
     return "";
   } catch (Exception e) {
     Debug.ErrorCaught(e);
     throw e;
   } finally {
     Debug.PopSubsStack();
   }
 }