public override void OnTaskRemoved(Intent rootIntent) { musicaplayer.Reset(); StopSelf(); MultiHelper.ExecuteGarbageCollection(); base.OnTaskRemoved(rootIntent); }
public void enthread() { imagenesesblur.Clear(); imageneses.Clear(); try { if (File.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser/cachesito.gr3")) { File.Delete(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser/cachesito.gr3"); } var ee = File.CreateText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser/cachesito.gr3"); string todosnombres = String.Join("¹", nombreses.ToArray()); string todoslinks = string.Join("¹", linkeses.ToArray()); string autores = string.Join("¹", autoreses.ToArray()); string duracioness = string.Join("¹", duraciones.ToArray()); ee.Write(todosnombres + "²" + todoslinks + "²" + autores + "²" + duracioness); ee.Close(); MultiHelper.ExecuteGarbageCollection(); } catch (Exception) { /* var asdd = listbox.FirstVisiblePosition; * var adaptadol = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, nombreses); * RunOnUiThread(() => listbox.Adapter = adaptadol); * RunOnUiThread(() => listbox.SetSelection(asdd));*/ } }
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { if (requestCode == voz) { if (resultCode == Result.Ok) { var matches = data.GetStringArrayListExtra(RecognizerIntent.ExtraResults); if (matches.Count != 0) { texto.Text = matches[0]; if (buscando == false) { termino = texto.Text; // Toast.MakeText(this, "Buscando.. por favor espere", ToastLength.Long); foreach (string aa in Directory.GetFiles(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser")) { File.Delete(aa); } MultiHelper.ExecuteGarbageCollection(); Thread proc = new Thread(new ThreadStart(buscar)); proc.Start(); } } else { Toast.MakeText(this, "No se pudo escuchar nada", ToastLength.Long).Show(); } } } base.OnActivityResult(requestCode, resultCode, data); }
protected override void OnDestroy() { detenedor = false; MultiHelper.ExecuteGarbageCollection(); base.OnDestroy(); }
public override void OnBackPressed() { base.OnBackPressed(); cliente.Client.Disconnect(false); Finish(); MultiHelper.ExecuteGarbageCollection(); }
public override void OnDestroy() { StopForeground(true); servidor.Stop(); MultiHelper.ExecuteGarbageCollection(); base.OnDestroy(); }
private void Listen() { _listener = new HttpListener(); _listener.Prefixes.Add("http://" + ipadress + ":" + _port.ToString() + "/"); _listener.UnsafeConnectionNtlmAuthentication = false; _listener.IgnoreWriteExceptions = true; _listener.AuthenticationSchemes = AuthenticationSchemes.None; _listener.Start(); while (_listener.IsListening) { try { MultiHelper.ExecuteGarbageCollection(); HttpListenerContext context = _listener.GetContext(); new Thread(() => { if (_listener.IsListening) { Process(context); } }).Start(); } catch (Exception) { } } }
public void getupdate() { if (MultiHelper.HasInternetConnection()) { RunOnUiThread(() => estado.Text = "Buscando actualizaciones..."); isonline = true; updateinfo = new WebClient().DownloadStringTaskAsync("https://raw.githubusercontent.com/Gr3gorywolf/Multitube.android/master/Updates/newversion.json").Result; checkedupdate = true; } else { isonline = false; RunOnUiThread(() => { new AlertDialog.Builder(this) .SetTitle("Atencion") .SetMessage("No tiene conexion a internet.\n podra usar el reproductor offline y acceder a las configuraciones.") .SetCancelable(false) .SetPositiveButton("Entrar en modo offline", (aa, aaa) => { checkedupdate = true; }) .SetNegativeButton("Salir", (aa, aaa) => { this.Finish(); }) .Create() .Show(); }); } }
public override void OnBackPressed() { this.Finish(); StartActivity(typeof(actmenuprincipal)); MultiHelper.ExecuteGarbageCollection(); base.OnBackPressed(); }
public void checkchange() { while (true) { IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName()); foreach (IPAddress ip in localIPs) { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { if (ipadre != ip.ToString()) { servidor.Stop(); ipadre = ip.ToString(); servidor = new MultitubeWebServer(Android.OS.Environment.ExternalStorageDirectory.ToString(), 12345, ipadre, this); var brandom = new Random(); Intent internado2 = new Intent(this, typeof(serviciointerpreter23)); Intent internado3 = new Intent(this, typeof(serviciointerpreter234)); var pendingIntent3 = PendingIntent.GetService(ApplicationContext, brandom.Next(2000, 50000) + brandom.Next(2000, 50000), internado3, 0); var pendingIntent2 = PendingIntent.GetService(ApplicationContext, brandom.Next(2000, 50000) + brandom.Next(2000, 50000), internado2, 0); Notification.Action accion = new Notification.Action(Resource.Drawable.drwaable, "Parar", pendingIntent2); Notification.Action accion2 = new Notification.Action(Resource.Drawable.drwaable, "Conectarse", pendingIntent3); Notification.BigTextStyle textoo = new Notification.BigTextStyle(); textoo.SetBigContentTitle("Stremeando en " + ipadre + ":12345"); textoo.SetSummaryText("Toque para parar de stremear su media"); textoo.BigText("Para conectarse introduzca " + ipadre + ":12345 " + "en su navegador o entre a multitubeweb.tk y toque conectar luego escanee el codigo que aparece al presionar el boton de + en multitubeweb. al tocar parar se cierrar el servicio de streaming"); #pragma warning disable CS0618 // El tipo o el miembro están obsoletos Notification.Builder nBuilder = new Notification.Builder(this); #pragma warning restore CS0618 // El tipo o el miembro están obsoletos nBuilder.SetContentTitle("Stremeando en " + ipadre + ":12345"); nBuilder.SetContentText("Toque para parar de stremear su media"); nBuilder.SetStyle(textoo); nBuilder.SetColor(Android.Graphics.Color.DarkRed.ToArgb()); nBuilder.SetOngoing(true); // nBuilder.SetContentIntent(pendingIntent2); nBuilder.SetSmallIcon(Resource.Drawable.antena); nBuilder.AddAction(accion); nBuilder.AddAction(accion2); Notification notification = nBuilder.Build(); StartForeground(193423456, notification); if (CheckInternetConnection() && Constants.UseFirebase) { meterdata(); } } } } MultiHelper.ExecuteGarbageCollection(); Thread.Sleep(5000); } }
public void crearlista(string playlistname) { StreamWriter escritor; escritor = File.CreateText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + RemoveIllegalPathCharacters(playlistname)); escritor.Write(" $ "); escritor.Close(); Toast.MakeText(this, "Lista guardada satisfactoriamente", ToastLength.Long).Show(); MultiHelper.ExecuteGarbageCollection(); }
public override void Finish() { base.Finish(); parador = false; if (SocketHelper.IsConnected(cliente) && !reiniciar) { cliente.Client.Send(Encoding.UTF8.GetBytes("desconectarse$")); cliente.Client.Disconnect(false); } else if (SocketHelper.IsConnected(cliente) && reiniciar) { cliente.Client.Send(Encoding.UTF8.GetBytes("desconectarse$")); cliente.Client.Disconnect(false); StartActivity(typeof(actividadsincronizacion)); } clientelocal.Client.Disconnect(false); MultiHelper.ExecuteGarbageCollection(); }
protected override void OnDestroy() { listaimagen = new List <VideoImage>(); nombreses = new List <string>(); viddeos = new List <Video>(); linkeses = new List <string>(); imageneses = new List <Bitmap>(); imagenesesblur = new List <Bitmap>(); listaimagen.Clear(); try { Glide.Get(this).ClearMemory(); } catch (Exception) { } MultiHelper.ExecuteGarbageCollection(); base.OnDestroy(); }
public void alertaok(object sender, EventArgs e) { string archivoentexto = File.ReadAllText(elementoscompletos[posicion]); if (!encontroparecido(linkvideo, archivoentexto.Split('$')[1].Split(';').ToList())) { string nombreentero = archivoentexto.Split('$')[0] + nombrevideo; string linkentero = archivoentexto.Split('$')[1] + linkvideo; File.Delete(elementoscompletos[posicion]); var sd = File.CreateText(elementoscompletos[posicion]); sd.Write(nombreentero + ";$" + linkentero + ";"); sd.Close(); Toast.MakeText(this, "Elemento agregado exitosamente", ToastLength.Long).Show(); if (menulistaoffline.gettearinstancia() != null) { menulistaoffline.gettearinstancia().llenarlista(); } MultiHelper.ExecuteGarbageCollection(); if (YoutubePlayerServerActivity.gettearinstancia() != null) { new Thread(() => { YoutubePlayerServerActivity.gettearinstancia().llenarplaylist(); }).Start(); } this.Finish(); } else { Toast.MakeText(this, "El elemento ya existe en la lista", ToastLength.Long).Show(); if (menulistaoffline.gettearinstancia() != null) { menulistaoffline.gettearinstancia().llenarlista(); } MultiHelper.ExecuteGarbageCollection(); this.Finish(); } }
public override void Finish() { base.Finish(); musicaplayer.Reset(); detenedor = false; if (estabareproduciendo) { if (Clouding_service.gettearinstancia() != null) { Clouding_service.gettearinstancia().musicaplayer.Start(); } else if (Clouding_serviceoffline.gettearinstancia() != null) { Clouding_serviceoffline.gettearinstancia().musicaplayer.Start(); } } MultiHelper.ExecuteGarbageCollection(); }
public void ok(object sender, EventArgs e) { StreamWriter escritor; string elementosfull = ""; escritor = File.CreateText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + RemoveIllegalPathCharacters(textbox.Text)); if (listanombres.Count > 0 && listalinks.Count > 0 && listanombres[0].Trim() != "" && listalinks[0].Trim() != "") { elementosfull = string.Join(";", listanombres) + ";" + "$" + string.Join(";", listalinks) + ";"; } else { elementosfull = " $ "; } escritor.Write(elementosfull); escritor.Close(); // cliente.Client.Send(Encoding.Default.GetBytes("actualizarplaylist()")); menulistaoffline.gettearinstancia().llenarlista(); cliente.Client.Disconnect(false); Toast.MakeText(this, "Lista guardada satisfactoriamente", ToastLength.Long).Show(); Finish(); MultiHelper.ExecuteGarbageCollection(); }
public async void initial_boot() { setinitialsettings(); if (SettingsHelper.HasKey("abrirserver")) { if (SettingsHelper.GetSetting("abrirserver") == "si") { if (serviciostreaming.gettearinstancia() != null) { StopService(new Intent(this, typeof(serviciostreaming))); StartService(new Intent(this, typeof(serviciostreaming))); } else { StartService(new Intent(this, typeof(serviciostreaming))); } } } if (!File.Exists(Constants.CachePath + "/verified")) { if (MultiHelper.HasInternetConnection()) { string serial = StringsHelper.GenerateSerial(); if (Constants.UseFirebase) { var firebase = new FirebaseClient(Constants.FirebaseSuggestionsUrl); await firebase.Child("Descargas").Child(serial).PutAsync("Descargada@" + Android.OS.Build.Model + "@" + System.DateTime.Now); } var arch = File.CreateText(Constants.CachePath + "/verified"); arch.Write(serial); arch.Close(); } } checkedpremissions = true; }
public void descargar(string path, string archivo, string titulo, string link) { WebClient cliente2 = new WebClient(); cliente2.DownloadFileAsync(new Uri("https://i.ytimg.com/vi/" + link.Split('=')[1] + "/mqdefault.jpg"), Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits/" + link.Split('=')[1]); //new if (titulo.Trim().Length > 45) { titulo = titulo.Remove(45); } tituloo = titulo; var manige = DownloadManager.FromContext(this); var requ = new DownloadManager.Request(Android.Net.Uri.Parse(archivo)); requ.SetDescription("Espere por favor"); requ.SetNotificationVisibility(DownloadVisibility.VisibleNotifyCompleted); requ.SetTitle(tituloo); var destino = Android.Net.Uri.FromFile(new Java.IO.File(path)); if (SettingsHelper.GetSetting("rutadescarga") == Android.OS.Environment.DirectoryDownloads) { requ.SetDestinationInExternalPublicDir(SettingsHelper.GetSetting("rutadescarga"), Path.GetFileName(path)); } else { requ.SetDestinationUri(destino); } requ.AllowScanningByMediaScanner(); requ.SetVisibleInDownloadsUi(true); manige.Enqueue(requ); if (Path.GetFileName(path).EndsWith(".mp3")) { ////////////////si es mp3 string datosviejos = ""; if (File.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d")) { datosviejos = File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d"); } else { var asss = File.Create(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d"); asss.Close(); } if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits")) { Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits"); } if (!datosviejos.Contains(link.Split('=')[1])) { var aafff = File.CreateText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d"); aafff.Write(datosviejos + Path.GetFileNameWithoutExtension(path) + "²" + link + "²" + path + "¤"); aafff.Close(); } else { var datosparsed = PlaylistsHelper.GetMedia(Constants.CachePath + "/downloaded.gr3d"); var videoid = link.Split('=')[1]; int indexelemento = datosparsed.FindIndex(ax => ax.Link.Contains(videoid)); datosparsed[indexelemento].Path = path; var aafff = File.CreateText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d"); aafff.Write(PlaylistsHelper.SerializeMedia(datosparsed)); aafff.Close(); } } //////////////////////////////////////////////si es mp4 else { string datosviejos = ""; if (File.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d2")) { datosviejos = File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d2"); } else { var asss = File.Create(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d2"); asss.Close(); } if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits")) { Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits"); } if (!datosviejos.Contains(link.Split('=')[1])) { var aafff = File.CreateText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d2"); aafff.Write(datosviejos + Path.GetFileNameWithoutExtension(path) + "²" + link + "²" + path + "¤"); aafff.Close(); } else { var datosparsed = PlaylistsHelper.GetMedia(Constants.CachePath + "/downloaded.gr3d2"); var videoid = link.Split('=')[1]; int indexelemento = datosparsed.FindIndex(ax => ax.Link.Contains(videoid)); datosparsed[indexelemento].Path = path; var aafff = File.CreateText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d2"); aafff.Write(PlaylistsHelper.SerializeMedia(datosparsed)); aafff.Close(); } MultiHelper.ExecuteGarbageCollection(); } /* * Random brandom = new Random(); * WebClient cliente2= new WebClient(); * cliente2.DownloadFileAsync(new Uri("https://i.ytimg.com/vi/" + link.Split('=')[1] + "/mqdefault.jpg"), Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits/" + link.Split('=')[1]); * int randum = brandom.Next(2000, 50000) + brandom.Next(2000, 50000); * random = randum; * try { * NotificationManager notificationManager = * GetSystemService(Context.NotificationService) as NotificationManager; * if (titulo.Trim().Length > 30) * { * titulo = titulo.Remove(30); * } * tituloo = titulo; * var builder = new Notification.Builder(ApplicationContext); * builder.SetContentTitle("Descargando " + titulo + "..."); * builder.SetContentText("Espere por favor"); * * builder.SetSmallIcon(Resource.Drawable.downloadbutton); * * * * WebClient cliente = new WebClient(); * * byte[] losbits = null; * cliente.DownloadProgressChanged += (aasd, asddd) => * { * * builder.SetContentTitle("Descargando "+titulo+"..."); * builder.SetContentText("Espere por favor"); * builder.SetSmallIcon(Resource.Drawable.downloadbutton); * builder.SetProgress(100, asddd.ProgressPercentage, false); * notificationManager.Notify(randum, builder.Build()); * * }; * cliente.DownloadDataCompleted += (aa, aaa) => * { * * // Intent intentss = new Intent(this,typeof(actividadacciones)); * // intentss.PutExtra("prro", path); * try { * var selectedUri = Android.Net.Uri.Parse( prefs.GetString("rutadescarga",null)+ "/"); * * Intent intentssdd = new Intent(this,typeof(actividadadinfooffline)); * intentssdd.PutExtra("nombre", Path.GetFileName(path)); * intentssdd.PutExtra("link", link); * intentssdd.PutExtra("path", path); * * * * * * PendingIntent intentosd = PendingIntent.GetActivity(this, brandom.Next(2000, 50000) + brandom.Next(2000, 50000), intentssdd, PendingIntentFlags.UpdateCurrent); * * * builder.SetContentTitle("Descarga completada de: "+titulo); * builder.SetContentText("Toque para abrir"); * builder.SetSmallIcon(Resource.Drawable.downloadbutton); * builder.SetContentIntent(intentosd); * builder.SetOngoing(false); * notificationManager.Notify(randum, builder.Build()); * * losbits = aaa.Result; * var a = File.Create(path); * a.Write(losbits, 0, losbits.Length); * a.Close(); * string datosviejos = ""; * link = link.Replace('²', ' '); * link= link.Replace('¤', ' '); * path =path.Replace('²', ' '); * path=path.Replace('¤', ' '); * * * if (Path.GetFileName(path).EndsWith(".mp3")) { * ///////////////////////////si es mp3 * * if (File.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d")) * { * datosviejos = File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d"); * } * if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits")) * { * Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits"); * } * * if(!datosviejos.Contains(Path.GetFileNameWithoutExtension(path) + "²" + link + "²" + path + "¤")) * { * var aafff = File.CreateText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d"); * aafff.Write(datosviejos + Path.GetFileNameWithoutExtension(path) + "²" + link + "²" + path + "¤"); * aafff.Close(); * * } * * * } * //////////////////////////////////////////////si es mp4 * else * { * if (File.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d2")) * { * datosviejos = File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d2"); * } * if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits")) * { * Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits"); * } * * if (!datosviejos.Contains(Path.GetFileNameWithoutExtension(path) + "²" + link + "²" + path + "¤")) * { * var aafff = File.CreateText(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/" + "downloaded.gr3d2"); * aafff.Write(datosviejos + Path.GetFileNameWithoutExtension(path) + "²" + link + "²" + path + "¤"); * aafff.Close(); * * } * clasesettings.recogerbasura(); * } * completada = true; * } * catch (Exception) * { * clasesettings.recogerbasura(); * Toast.MakeText(this, "ha ocurrido un error al descargar intente de nuevo", ToastLength.Long).Show(); * // StopForeground(false); * } * * }; * * cliente.DownloadData(new Uri(archivo)); * } * catch (Exception) * { * NotificationManager notificationManager = * GetSystemService(Context.NotificationService) as NotificationManager; * var builder = new Notification.Builder(ApplicationContext); * builder.SetContentTitle("ERROR AL DESCARGAR: " + titulo); * builder.SetContentText("Intente de nuevo"); * builder.SetSmallIcon(Resource.Drawable.downloadbutton); * builder.SetOngoing(false); * notificationManager.Notify(randum, builder.Build()); * clasesettings.recogerbasura(); * * } */ }
public override void Finish() { MultiHelper.ExecuteGarbageCollection(); base.Finish(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Crearlistaoffline); cliente.Connect(Intent.GetStringExtra("ipadre"), 1024); listbox = FindViewById <ListView>(Resource.Id.listView1); textbox = FindViewById <EditText>(Resource.Id.editText1); botonagregar = FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.imageView2); botoneliminar = FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.imageView3); botonsalir = FindViewById <ImageView>(Resource.Id.imageView1); // elementossincortar = clasesettings.gettearvalor("elementosactuales"); lineall = FindViewById <LinearLayout>(Resource.Id.linearlayout0); lineall2 = FindViewById <LinearLayout>(Resource.Id.linearLayout1); var adaptadolo = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> { "No hay elementos para mostrar.." }); RunOnUiThread(() => { var parcelable = listbox.OnSaveInstanceState(); listbox.Adapter = adaptadolo; listbox.OnRestoreInstanceState(parcelable); }); UiHelper.SetBackgroundAndRefresh(this); AlertDialog.Builder adx = new AlertDialog.Builder(this); adx.SetCancelable(false); adx.SetTitle("Cargar elementos en reproduccion"); adx.SetIcon(Resource.Drawable.alert); adx.SetMessage("Desea cargar todos los elementos que estan en reproduccion actualmente?"); adx.SetNegativeButton("No", nox); adx.SetPositiveButton("Si", six); adx.Create(); adx.Show(); eneliminacion = true; /* adapterlistaremoto adaptador = new adapterlistaremoto(this, listanombres,listalinks); * listbox.Adapter = adaptador;*/ lineall2.SetBackgroundColor(Android.Graphics.Color.ParseColor("#2b2e30")); // animar2(lineall2); botoneliminar.Click += delegate { // animar(botoneliminar); if (!eneliminacion) { //botoneliminar.SetBackgroundResource(Resource.Drawable.playlistcheck); adaptadorlista adalter = new adaptadorlista(this, listanombres, listalinks, textbox.Text, false, true); var parcelable = listbox.OnSaveInstanceState(); listbox.Adapter = adalter; listbox.OnRestoreInstanceState(parcelable); eneliminacion = true; } else { // botoneliminar.SetBackgroundResource(Resource.Drawable.playlistedit); /* adaptadorzz = new adapterlistaremoto(this, listanombres,listalinks); * listbox.Adapter = adaptadorzz; * eneliminacion = false;*/ } }; botonagregar.Click += delegate { // animar(botonagregar); if (textbox.Text.Length >= 3) { var saas = Directory.GetFiles(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist"); if (!saas.Contains(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + textbox.Text)) { StreamWriter escritor; string elementosfull = ""; escritor = File.CreateText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + RemoveIllegalPathCharacters(textbox.Text)); if (listanombres.Count > 0 && listalinks.Count > 0 && listanombres[0].Trim() != "" && listalinks[0].Trim() != "") { elementosfull = string.Join(";", listanombres) + ";" + "$" + string.Join(";", listalinks) + ";"; } else { elementosfull = " $ "; } escritor.Write(elementosfull); escritor.Close(); menulistaoffline.gettearinstancia().llenarlista(); cliente.Client.Disconnect(false); Toast.MakeText(this, "Lista guardada satisfactoriamente", ToastLength.Long).Show(); Finish(); MultiHelper.ExecuteGarbageCollection(); } else { AlertDialog.Builder ad = new AlertDialog.Builder(this); ad.SetTitle("Advertencia"); ad.SetMessage("El elemento " + textbox.Text + " ya existe desea reemplazarlo??"); ad.SetCancelable(false); ad.SetIcon(Resource.Drawable.warningsignonatriangularbackground); ad.SetPositiveButton("Si", ok); ad.SetNegativeButton("No", no); ad.Create(); ad.Show(); } } else { Toast.MakeText(this, "El nombre de la lista de reproduccion debe tener almenos 3 caracteres", ToastLength.Long).Show(); } }; botonsalir.Click += delegate { cliente.Client.Disconnect(false); animar(botonsalir); Finish(); MultiHelper.ExecuteGarbageCollection(); }; }
private void Process(HttpListenerContext context) { context.Response.AddHeader("Access-Control-Allow-Origin", "*"); context.Response.AddHeader("Access-Control-Allow-Credentials", "true"); context.Response.AddHeader("Access-Control-Allow-Methods", "*"); context.Response.AddHeader("Access-Control-Allow-Headers", "*"); if (context.Request.Url.ToString().Contains("&&querry&&")) { if (context.Request.Url.ToString().Contains("meconecte")) { context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.Close(); #pragma warning disable CS0618 // El tipo o el miembro están obsoletos Notification.Builder nBuilder = new Notification.Builder(conteto); #pragma warning restore CS0618 // El tipo o el miembro están obsoletos nBuilder.SetContentTitle("Nuevo dispositivo conectado"); nBuilder.SetContentText("Un nuevo dispositivo está stremeando su media"); #pragma warning disable CS0618 // El tipo o el miembro están obsoletos nBuilder.SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification)); #pragma warning restore CS0618 // El tipo o el miembro están obsoletos nBuilder.SetSmallIcon(Resource.Drawable.antena); Notification notification = nBuilder.Build(); NotificationManager notificationManager = (NotificationManager)conteto.GetSystemService(Context.NotificationService); notificationManager.Notify(5126768, notification); } } //////////////cuando son archivos else { bool esindice = false; string filename = context.Request.Url.AbsolutePath; Console.WriteLine(filename); filename = filename.Substring(1); filename = System.Net.WebUtility.UrlDecode(filename); if (string.IsNullOrEmpty(filename)) { foreach (string indexFile in _indexFiles) { if (File.Exists(Path.Combine(_rootDirectory + "/.gr3cache", indexFile))) { filename = indexFile; esindice = true; break; } } } var nomesinpath = filename; if (!esindice) { if (!filename.Contains(".mp3") && !filename.Contains(".mp4")) { filename = Path.Combine(_rootDirectory, filename); } } else { filename = Path.Combine(_rootDirectory + "/.gr3cache", filename); } if (File.Exists(filename)) { context.Response.StatusCode = (int)HttpStatusCode.OK; //Adding permanent http response headers string mime; string mimo = ""; if (filename.EndsWith("mp3")) { mimo = "audio/*"; } else if (filename.EndsWith("mp4")) { mimo = "video/mp4"; } if (!filename.Contains("downloaded.gr3d")) { using (var stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) { context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) ? mime : mimo; context.Response.ContentLength64 = stream.Length; context.Response.AddHeader("Accept-Ranges", "bytes"); context.Response.AddHeader("Date", DateTime.Now.ToString("r")); context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r")); context.Response.AddHeader("Content-Range", string.Format("bytes {0}-{1}/{2}", 0, Convert.ToInt32(stream.Length) - 1, Convert.ToInt32(stream.Length))); context.Response.ContentLength64 = stream.Length; stream.CopyTo(context.Response.OutputStream); stream.Flush(); } } else { refreshregistry(); byte[] bytesitosdestring; if (filename.EndsWith("2")) { bytesitosdestring = System.Text.Encoding.UTF8.GetBytes(verifiedmp4); } else { bytesitosdestring = System.Text.Encoding.UTF8.GetBytes(verifiedmp3); } using (MemoryStream streamm = new MemoryStream(bytesitosdestring, 0, bytesitosdestring.Length)) { context.Response.ContentType = _mimeTypeMappings.TryGetValue(filename.Split('.')[1], out mime) ? mime : mimo; context.Response.ContentLength64 = streamm.Length; context.Response.SendChunked = true; context.Response.AddHeader("Date", DateTime.Now.ToString("r")); context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r")); streamm.CopyTo(context.Response.OutputStream); streamm.Flush(); } MultiHelper.ExecuteGarbageCollection(); } context.Response.OutputStream.Flush(); context.Response.OutputStream.Close(); context.Response.Close(); } else { context.Response.StatusCode = (int)HttpStatusCode.NotFound; context.Response.Close(); } } }
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Customsearcher); ///////////////////////////////////////declaraciones///////////////////////////////// string ip = Intent.GetStringExtra("ipadre").Trim(); listaimagen = new List <VideoImage>(); viddeos = new List <Video>(); imagelist = new List <Android.Graphics.Bitmap>(); texto = FindViewById <EditText>(Resource.Id.editText1); // ImageView botonbuscar = FindViewById<ImageView>(Resource.Id.imageView1); ImageView botonreconocer = FindViewById <ImageView>(Resource.Id.imageView2); ImageView playpause = FindViewById <ImageView>(Resource.Id.imageView4); tv1 = FindViewById <TextView>(Resource.Id.textView1); lineaa = FindViewById <LinearLayout>(Resource.Id.linearlayout0); ImageView botonhome = FindViewById <ImageView>(Resource.Id.imageView3); lineall2 = FindViewById <LinearLayout>(Resource.Id.linearLayout4); listbox = FindViewById <ListView>(Resource.Id.listView1); // progresooo = FindViewById<ProgressBar>(Resource.Id.progresss); UiHelper.SetBackgroundAndRefresh(this); var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> { "No hay elementos para mostrar.." }); RunOnUiThread(() => { var parcelable = listbox.OnSaveInstanceState(); listbox.Adapter = adaptadol; listbox.OnRestoreInstanceState(parcelable); }); ////////////////////////////////////////////////miselaneo/////////////////////////////////// color = Intent.GetStringExtra("color"); nombreses = new List <string>(); linkeses = new List <string>(); autoreses = new List <string>(); duraciones = new List <string>(); // lineall2.SetBackgroundColor(Android.Graphics.Color.ParseColor("#4f5459")); // animar2(lineall2); tv1.Selected = true; if (color.Trim() != "none") { // lineaa.SetBackgroundColor(Android.Graphics.Color.ParseColor(color.Trim())); } if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache")) { Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache"); } if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser")) { Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser"); } else { } /////////////////////////////////////////////////threads/////////////////////////////////////////////// // lineall2.SetBackgroundColor(Android.Graphics.Color.ParseColor("#2b2e30")); procc = new Thread(new ThreadStart(cojerstream)); procc.Start(); var procc2 = new Thread(new ThreadStart(cargardesdecache)); procc2.Start(); ////////////////////////////////////////events////////////////////////////////////////////////////// texto.KeyPress += (aaxx, e) => { if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) { // Code executed when the enter key is pressed down if (buscando == false) { termino = texto.Text; // Toast.MakeText(this, "Buscando.. por favor espere", ToastLength.Long); foreach (string aa in Directory.GetFiles(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser")) { File.Delete(aa); } MultiHelper.ExecuteGarbageCollection(); Thread proc = new Thread(new ThreadStart(buscar)); proc.Start(); } } else { e.Handled = false; } }; botonhome.Click += delegate { animar(botonhome); procc.Abort(); MultiHelper.ExecuteGarbageCollection(); this.Finish(); }; playpause.Click += delegate { animar(playpause); if (Mainmenu.gettearinstancia() != null) { Mainmenu.gettearinstancia().play.PerformClick(); } else if (YoutubePlayerServerActivity.gettearinstancia() != null) { YoutubePlayerServerActivity.gettearinstancia().imgPlay.PerformClick(); } }; botonreconocer.Click += delegate { animar(botonreconocer); try { var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech); voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm); voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 500); voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 500); voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 10000); voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1); voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default); StartActivityForResult(voiceIntent, voz); } catch (Exception) { } }; listbox.ItemClick += (easter, sender) => { if (nombreses.Count > 0) { if (sender.Position >= 0) { Intent intentar = new Intent(this, typeof(customdialogact)); string ipadree = Intent.GetStringExtra("ipadre"); intentar.PutExtra("ipadress", ipadree); intentar.PutExtra("imagen", "http://i.ytimg.com/vi/" + linkeses[sender.Position].Split('=')[1] + "/mqdefault.jpg"); intentar.PutExtra("url", linkeses[sender.Position]); intentar.PutExtra("titulo", nombreses[sender.Position]); intentar.PutExtra("color", color); StartActivity(intentar); } } }; // Create your application here }
public override void Finish() { base.Finish(); SettingsHelper.SaveSetting("elementosactuales", ""); MultiHelper.ExecuteGarbageCollection(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.perfectmainmenu); fondito = FindViewById <ImageView>(Resource.Id.fondo1); var botoncontrolremoto = FindViewById <LinearLayout>(Resource.Id.linearLayout2); var botonserver = FindViewById <LinearLayout>(Resource.Id.linearLayout3); var botonplayer = FindViewById <LinearLayout>(Resource.Id.linearLayout4); var botonsettings = FindViewById <LinearLayout>(Resource.Id.linearLayout5); var botoninfo = FindViewById <LinearLayout>(Resource.Id.linearLayout6); tv3 = FindViewById <TextView>(Resource.Id.textView3); tv3.Selected = true; ////////////////mimicv2////////////////////// animar4(botoncontrolremoto, 500); animar4(botonserver, 1000); animar4(botonplayer, 1500); animar4(botonsettings, 2000); animar4(botoninfo, 2500); animar4(FindViewById <ImageView>(Resource.Id.imageView1), 250); prefEditor = prefs.Edit(); if (Intent.GetBooleanExtra("fromsplash", false)) { estaonline = Intent.GetBooleanExtra("isonline", false); if (Intent.GetStringExtra("updateinfo").Trim() != "") { var info = JsonConvert.DeserializeObject <UpdateInfo>(Intent.GetStringExtra("updateinfo").Trim()); var versionNumber = Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0).VersionCode; if (info.Numero != versionNumber) { new AlertDialog.Builder(this) .SetTitle("Atencion") .SetMessage("Hay una nueva version disponible de la aplicacion la cual tiene la siguiente descripcion:\n" + info.Descripcion) .SetCancelable(false) .SetPositiveButton("Ir a la descarga", (aa, aaa) => { var uri = Android.Net.Uri.Parse("https://gr3gorywolf.github.io/getromdownload/youtubepc.html"); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }) .SetNegativeButton("Cancelar", (aa, aaa) => { }) .Create() .Show(); } } } else { estaonline = true; } botoninfo.Click += delegate { var intento = new Intent(this, typeof(actbio)); animar20(botoninfo, intento); MultiHelper.ExecuteGarbageCollection(); }; botonplayer.Click += delegate { if (PlaylistsHelper.HasMediaElements) { var intento = new Intent(this, typeof(playeroffline)); animar3(botonserver); animar3(botonsettings); animar3(botoncontrolremoto); animar3(botoninfo); animar2(botonplayer, intento); MultiHelper.ExecuteGarbageCollection(); } else { Toast.MakeText(this, "No tiene elementos descargados para reproducir", ToastLength.Long).Show(); } }; botonsettings.Click += delegate { var intento = new Intent(this, typeof(configuraciones)); animar3(botonserver); animar3(botoncontrolremoto); animar3(botonplayer); animar3(botoninfo); animar2(botonsettings, intento); MultiHelper.ExecuteGarbageCollection(); }; botonserver.Click += delegate { if (estaonline) { var intento = new Intent(this, typeof(YoutubePlayerServerActivity)); animar3(botonsettings); animar3(botoncontrolremoto); animar3(botonplayer); animar3(botoninfo); animar2(botonserver, intento); MultiHelper.ExecuteGarbageCollection(); } else { Toast.MakeText(this, "No hay conexion a internet por favor conectese a internet y reincie la aplicacion", ToastLength.Long).Show(); } }; botoncontrolremoto.Click += delegate { // var intento = new Intent(this, typeof(mainmenu_Offline)); if (estaonline) { animar3(botonsettings); animar3(botonserver); animar3(botonplayer); animar3(botoninfo); animar2(botoncontrolremoto, new Intent(this, typeof(actconectarservidor))); MultiHelper.ExecuteGarbageCollection(); } else { Toast.MakeText(this, "No hay conexion a internet por favor conectese a internet y reincie la aplicacion", ToastLength.Long).Show(); } }; // Create your application here }
public override void OnDestroy() { MultiHelper.ExecuteGarbageCollection(); base.OnDestroy(); }
public override void OnBackPressed() { tr.Abort(); this.Finish(); MultiHelper.ExecuteGarbageCollection(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Reproducirlista); inst = this; //////////////////////////////declaraciones////////////////////////////////// parador = true; playpause = FindViewById <ImageView>(Resource.Id.imageView2); lista = FindViewById <ListView>(Resource.Id.listView1); volverhome = FindViewById <ImageView>(Resource.Id.imageView1); textbox = FindViewById <TextView>(Resource.Id.textView1); background = FindViewById <LinearLayout>(Resource.Id.LinearLayout0); barra = FindViewById <LinearLayout>(Resource.Id.linearLayout2); tl = FindViewById <Android.Support.Design.Widget.TabLayout>(Resource.Id.tabs); tl.AddTab(tl.NewTab().SetText("Local")); tl.AddTab(tl.NewTab().SetText("Remoto")); ////////////////////////////////////////////////////////////////////////////// /////////////////////////////miselaneo+conexion////////////////////////////// // barra.SetBackgroundColor(Android.Graphics.Color.Black); new Thread(() => cojerstream()).Start(); new Thread(() => llenarlistas()).Start(); textbox.Selected = true; /* var adaptadolo = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, new List<string> { "No hay elementos para mostrar.." }); * RunOnUiThread(() => lista.Adapter = adaptadolo);*/ ////////////////////////////////////////////////////////////////////////////// ////////////////////////////Eventos////////////////////////////////////////// // barra.SetBackgroundColor(Android.Graphics.Color.ParseColor("#2b2e30")); playpause.Click += delegate { Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.Default.GetBytes("playpause()")); }; volverhome.Click += delegate { Finish(); MultiHelper.ExecuteGarbageCollection(); }; tl.TabSelected += (aa, sss) => { new Thread(() => { if (sss.Tab.Text == "Local") { query = "Fromremote"; if (listaslocales.Count > 0) { var adap = new adapterlistaremoto(this, listaslocales.Select(asd => asd.Name).ToList(), listaslocales.Select(asd => asd.Portrait).ToList()); RunOnUiThread(() => { var parcelable = lista.OnSaveInstanceState(); lista.Adapter = adap; lista.OnRestoreInstanceState(parcelable); }); } else { var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> { "No hay elementos para mostrar.." }); RunOnUiThread(() => { var parcelable = lista.OnSaveInstanceState(); lista.Adapter = adaptadol; lista.OnRestoreInstanceState(parcelable); }); } } else { query = "Fromlocal"; if (listasremotas.Count > 0) { var adap = new adapterlistaremoto(this, listasremotas.Select(asd => asd.Name).ToList(), listasremotas.Select(asd => asd.Portrait).ToList()); RunOnUiThread(() => { var parcelable = lista.OnSaveInstanceState(); lista.Adapter = adap; lista.OnRestoreInstanceState(parcelable); }); } else { var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> { "No hay elementos para mostrar.." }); RunOnUiThread(() => { var parcelable = lista.OnSaveInstanceState(); lista.Adapter = adaptadol; lista.OnRestoreInstanceState(parcelable); }); } } }).Start(); }; lista.ItemClick += (sender, args) => { playlistidx = args.Position; Intent intento = new Intent(this, typeof(dialogolistasact)); if (query == "Fromremote" && listaslocales.Count > 0) { if (listaslocales[playlistidx].Portrait.Trim() != "") { intento.PutExtra("nombrelista", listaslocales[playlistidx].Name); intento.PutExtra("portada", listaslocales[playlistidx].Portrait); intento.PutExtra("querry", query); StartActivity(intento); } else { Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show(); } } else { if (listasremotas.Count > 0) { if (listasremotas[playlistidx].MediaElements.Count > 0) { intento.PutExtra("nombrelista", listasremotas[playlistidx].Name); intento.PutExtra("portada", listasremotas[playlistidx].Portrait); intento.PutExtra("querry", query); StartActivity(intento); } else { Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show(); } } /* mainmenu.gettearinstancia() * .clientelalistas * .Client * .Send(Encoding * .UTF8 * .GetBytes("Sendplaylist__==__==__" + JsonConvert.SerializeObject(listasremotas[playlistidx])));*/ } /* AlertDialog.Builder ad = new AlertDialog.Builder(this); * ad.SetCancelable(false); * ad.SetTitle("Advertencia"); * ad.SetMessage("Desea reproducir esta lista de reproduccio en el dispositivo servidor??"); * ad.SetIcon(Resource.Drawable.warningsignonatriangularbackground); * posicion = args.Position; * ad.SetPositiveButton("Si", ok); * ad.SetNegativeButton("No", no); * ad.Create(); * ad.Show();*/ }; // Create your application here }