Académique Documents
Professionnel Documents
Culture Documents
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.NetworkInformation;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using DeadMosquito.AndroidGoodies;
//using OpenCVForUnity;
//using OpenCVForUnityExample;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public Font f;
public GameObject neterror;
public GameObject neterror12;
public int ccv = 0;
public string Ddf;
private float k = 0;
private float k1 = 0;
private float k2 = 0;
public int cls = 0;
private float k5 = 0;
public int ta = 0;
//public int ll=0;
[SerializeField]
public string tables, tables1, tables14, tables141;
public float ratio;
public GameObject Tap;
public GameObject Wait;
string texturl;
public FileInfo theSourceFile11, theSourceFilechpl;
[SerializeField]
Animator myanim;
Renderer rend;
string ModifyURL = "0";
string lat; //Here we assign the first part t//o the name
string ddf1; //Here we assing the second part to the surname
string wid;
string ht; //Here we assing the second part to the surname
string Rota;
string[] splitArray;
string yuC;
// optical flow
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"Youtube.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"Youtube.txt", ModifyURL);
FileInfo theSourceFile = new FileInfo(Application.persistentDataPath + "/"
+ "phnonote.txt");
//StreamReader reader = theSourceFile.OpenText();
//string texturl;
//texturl = reader.ReadToEnd();
if ((!theSourceFile.Exists) || (theSourceFile.Length == 0))
{
print(Application.persistentDataPath);
//StartCoroutine(Fade());
}
public IEnumerator CaptureCamera(Camera camera, Rect rect)
{
yield return new WaitForEndOfFrame();
Caching.ClearCache();
camera.targetTexture = rt;
camera.Render();
RenderTexture.active = rt;
Texture2D screenShot = new Texture2D((int)rect.width, (int)rect.height,
TextureFormat.RGB24, false);
//screenShot.SetPixels(Camera.GetPixels());
//screenShot.SetPixels(screenShot.GetPixels());
screenShot.ReadPixels(rect, 0, 0);
//screenShot.SetPixels(screenShot.GetPixels());
screenShot.Apply();
camera.targetTexture = null;
RenderTexture.active = null;
GameObject.Destroy(rt);
byte[] bytes = screenShot.EncodeToJPG();
string base64s = Convert.ToBase64String(bytes);
string filename = Application.persistentDataPath + "/Screenshot.jpg";
Debug.Log(Application.persistentDataPath);
System.IO.File.WriteAllBytes(filename, bytes);
string url = "http://34.231.33.25/phpcallasp/";
//string customUrl = url + "indexaspx.php";
Debug.Log(tables1);
//tables1 = 544445459;
//setup a form
WWWForm form = new WWWForm();
form.AddField("usd", base64s);
form.AddField("tables", "others");
form.AddField("phno", tables1);
Debug.Log("Check");
//print (bytes1);
WWW www = new WWW(customUrl, form);
Debug.Log("Wait ");
//if (Timer.Equals (10, 20)) {
yield return StartCoroutine(WaitForRequest(www));
Debug.Log("Wait for WWW");
}
Ddf = www.text;
Debug.Log(Ddf);
if (Ddf != null)
{
if (Ddf.Contains("scanlimitover"))
{
Debug.Log("ScanLimit");
//backCam.Stop(); //SceneManager.UnloadScene("Game");
SceneManager.LoadScene("ScanLimit");
Debug.Log("ScanLimit");
//Debug.Log (Ddf);
}
Debug.Log("mydddf");
//StartCoroutine (Pla yStreamingVideo (Ddf));
if (Ddf.Length > 6000)
{ ///Texture video or chrome video
if (Ddf.Contains("_"))
{
//Ddf.Replace("_", "@");
int count = Ddf.Split('_').Length - 1;
if (count == 4)
{
Debug.Log("4");
splitArray = Ddf.Split(char.Parse("_")); //Here we
assing the splitted string to array by that char
//string[]
splitArray = Ddf.Split(char.Parse); //Here we assing the splitted string to array
by that char
lat = splitArray[0]; //Here we assign the first part
t//o the name
ddf1 = splitArray[1]; //Here we assing the second part
to the surname
wid = splitArray[2];
ht = splitArray[3]; //Here we assing the second part to
the surname
Rota = splitArray[4];
}
else
{
Debug.Log("5");
splitArray = Ddf.Split(char.Parse("_"));
lat = splitArray[0]; //Here we assign the first part
t//o the name//Base64
Debug.Log(lat);
ddf1 = splitArray[1]; //Here we assing the second part
to the surname
Debug.Log(ddf1);
yuC = splitArray[2];
ddf1 = ddf1 + "_" + yuC;
Debug.Log(ddf1);
wid = splitArray[3];
Debug.Log(wid);
ht = splitArray[4]; //Here we assing the second part to
the surname
Debug.Log(ht);
Rota = splitArray[5];
Debug.Log(Rota);
}
int width;
int height;
int.TryParse(wid, out width);
int.TryParse(ht, out height);
Texture2D tex = new Texture2D(width, height,
TextureFormat.RGB24, false);
byte[] sc = Convert.FromBase64String(lat);
tex.LoadImage(sc);
byte[] bytes = tex.EncodeToJPG();
Destroy(tex);
System.IO.File.WriteAllText(Application.persistentDataPath
+ "/" + "texvideowidth.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath
+ "/" + "texvideowidth.txt", wid);
System.IO.File.WriteAllText(Application.persistentDataPath
+ "/" + "texvideoht.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath
+ "/" + "texvideoht.txt", ht);
// SceneManager.LoadScene("MySelf", LoadSceneMode.Single);
if (Rota == "180")
{
if (ddf1.Contains("youtu"))
{
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", ddf1);
//backCam.Stop();
//SceneManager.UnloadScene("Game");
//Caching.CleanCache();
//backCam.Stop();
SceneManager.LoadScene("MyYOUTUBE",
LoadSceneMode.Single);
}
else
{
/*
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", ddf1);
//backCam.Stop();
//SceneManager.UnloadScene("Game");
//Caching.CleanCache();
//backCam.Stop();
SceneManager.LoadScene("MyYOUTUBE",
LoadSceneMode.Single);
}
//Application.LoadLevel (1);
Debug.Log("Texture180");
}
else
{
if (ddf1.Contains("youtu"))
{
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", ddf1);
//backCam.Stop();
//SceneManager.UnloadScene("Game");
//Caching.CleanCache();
//backCam.Stop();
SceneManager.LoadScene("MyYOUTUBE00",
LoadSceneMode.Single);
}
else
{
/*
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", ddf1);
//backCam.Stop();
//SceneManager.UnloadScene("Game");
//Caching.CleanCache();
//backCam.Stop();
SceneManager.LoadScene("MyYOUTUBE00",
LoadSceneMode.Single);
}
}
//Thread.Sleep (20);
//Application.LoadLevel (1);
}
else
{
splitArray = Ddf.Split(char.Parse("@")); //Here we assing
the splitted string to array by that char
//string[]
splitArray = Ddf.Split(char.Parse); //Here we assing the splitted string to array
by that char
int count = Ddf.Split('@').Length - 1;
if (count == 4)
{
Debug.Log("4");
splitArray = Ddf.Split(char.Parse("@")); //Here we
assing the splitted string to array by that char
//string[]
splitArray = Ddf.Split(char.Parse); //Here we assing the splitted string to array
by that char
lat = splitArray[0]; //Here we assign the first part
t//o the name
ddf1 = splitArray[1]; //Here we assing the second part
to the surname
wid = splitArray[2];
ht = splitArray[3]; //Here we assing the second part to
the surname
Rota = splitArray[4];
}
else
{
Debug.Log("5");
splitArray = Ddf.Split(char.Parse("@"));
lat = splitArray[0]; //Here we assign the first part
t//o the name//Base64
ddf1 = splitArray[1]; //Here we assing the second part
to the surname
yuC = splitArray[2];
ddf1 = ddf1 + "_" + yuC;
wid = splitArray[3];
ht = splitArray[4]; //Here we assing the second part to
the surname
Rota = splitArray[5];
}
int width;
int height;
int.TryParse(wid, out width);
int.TryParse(ht, out height);
Texture2D tex = new Texture2D(width, height,
TextureFormat.RGB24, false);
byte[] sc = Convert.FromBase64String(lat);
tex.LoadImage(sc);
byte[] bytes = tex.EncodeToJPG();
Destroy(tex);
//System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"texvideo.txt", ddf1);
System.IO.File.WriteAllText(Application.persistentDataPath
+ "/" + "texvideowidth.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath
+ "/" + "texvideowidth.txt", wid);
System.IO.File.WriteAllText(Application.persistentDataPath
+ "/" + "texvideoht.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath
+ "/" + "texvideoht.txt", ht);
if (Rota == "180")
{
if (ddf1.Contains("youtu"))
{
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", ddf1);
//backCam.Stop();
//SceneManager.UnloadScene("Game");
//Caching.CleanCache();
//backCam.Stop();
SceneManager.LoadScene("MyYOUTUBEGreen",
LoadSceneMode.Single);
}
else
{
/*
System.IO.File.WriteAllText(Application.persistentDataPath + "/" + "texvideo.txt",
null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", ddf1);
//backCam.Stop();
//SceneManager.UnloadScene("Game");
//Caching.CleanCache();
//backCam.Stop();
SceneManager.LoadScene("MyYOUTUBEGreen",
LoadSceneMode.Single);
}
//SceneManager.LoadScene("MySelfGreen",
LoadSceneMode.Single);
//Debug.Log ("Chrom180");
}
else
{
if (ddf1.Contains("youtu"))
{
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", ddf1);
//backCam.Stop();
//SceneManager.UnloadScene("Game");
//Caching.CleanCache();
// backCam.Stop();
SceneManager.LoadScene("MyYOUFlatGreen",
LoadSceneMode.Single);
}
else
{
/*
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath + "/" +
"YOUTUBETEXTURE.txt", ddf1);
//backCam.Stop();
//SceneManager.UnloadScene("Game");
//Caching.CleanCache();
// backCam.Stop();
SceneManager.LoadScene("MyYOUFlatGreen",
LoadSceneMode.Single);
}
Debug.Log("Chrom90");
}
//Thread.Sleep (20);
//backCam.Stop();
}
//SceneManager.LoadScene("texavpro",LoadSceneMode.Single);
StartCoroutine(PlayStreamingVideoVIVO(UrlOrig));
//SceneManager.LoadScene ("MyGame");
}
else*/
//{
System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "YOUTUBETEXTURE.txt", UrlOrig);
Thread.Sleep(20);
// backCam.Stop();
SceneManager.LoadScene("NewUIExample", LoadSceneMode.Single);
// }
}
else if (Ddf.Contains("arhimaya") && Ddf.Contains("file1.php?") &&
Ddf.Contains("username") && Ddf.Contains("targetid"))
{ //open Photo Gallery
string CallYoutubeURL = Ddf;
System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "Youtube.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "Youtube.txt", Ddf);
//backCam.Stop();
SceneManager.LoadScene("PhotoGallery");
//Application.OpenURL(Ddf);
}
else if (Ddf.Contains("tel:"))
{ //open Dialler
ll = 1;
//Int32 a;
//greenlaser = (Texture2D)Resources.Load ("lod");
k2 = 1; //Debug.Log (Ddf);
// backCam.Stop();
Application.OpenURL(Ddf);
Debug.Log("Tel");
if (k2 == 1)
{ //Debug.Log (Ddf);
SceneManager.LoadScene("Game");
Debug.Log("NoTel");
}
SceneManager.LoadScene("Game");
//Debug.Log (Ddf);
Debug.Log("NoTel");
}
else if (Ddf.Contains("youtu"))
{ //open youtube
ll = 1;
//Int32 a;
//greenlaser = (Texture2D)Resources.Load ("lod");
k1 = 1; //Debug.Log (Ddf);
// string[] YoutubeSplit = Ddf.Split(char.Parse("="));
//https://www.youtube.com/watch?v=dkxd7kgwiSU
//string youtubeURL = YoutubeSplit[1];
//string
CallYoutubeURL="https://www.youtube.com/embed/Qa3sHphE8LI?rel=0;autoplay=1";
// string CallYoutubeURL =
"https://www.arhimaya.com/arhimaya/youtubetest.php?youtube=" + youtubeURL;
System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "YOUTUBETEXTURE.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "YOUTUBETEXTURE.txt", Ddf);
// System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "YOUTUBETEXTURE.txt", null);
// System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "YOUTUBETEXTURE.txt", Ddf);
//backCam.Stop(); //SceneManager.UnloadScene("Game");
//Caching.CleanCache();
//SceneManager.LoadScene("MyYOUTUBE", LoadSceneMode.Single);
SceneManager.LoadScene("NewUIExample");
//Application.OpenURL(Ddf);
//Debug.Log("Youtube");
// Debug.Log("Youtube");
//Debug.Log (Ddf);
}
else if (ll == 0 && Ddf.Contains("http"))
{ //open Webpage
k5 = 1;
Debug.Log("http");
// backCam.Stop();
// Application.OpenURL(Ddf);
System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "Youtube.txt", null);
System.IO.File.WriteAllText(Application.persistentDataPath +
"/" + "Youtube.txt", Ddf);
//backCam.Stop();
SceneManager.LoadScene("PhotoGallery");
//Application.OpenURL("www.google.com");
//Debug.Log ("Nohttp");
// SceneManager.LoadScene("Game");
}
}
}
else
{
Debug.Log("WWW Error: " + www.error);
}
}
}
private IEnumerator PlayStreamingVideoVIVO(string Videopath)
{
k = 1;
// backCam.Stop();
//Handheld.PlayFullScreenMovie(path);
Application.OpenURL(Videopath);
Handheld.ClearShaderCache();
if (k == 1)
{
Application.LoadLevel("Game");
}
Ddf = null;
Videopath = null;
yield return new WaitForEndOfFrame();
yield return new WaitForEndOfFrame();
Debug.Log("VideoPlaysbackCompleted");
Application.LoadLevel("Game");