Example #1
0
        public bool CheckFileExists(string fileName)
        {
            //Every file saved on the server is retrieved from the server (not downloaded)
            Upload tempUpload            = uploadService.GetAllFiles();
            IList <Upload.File> fileList = tempUpload.GetFileList();

            //Loop for every file in the file list
            for (int i = 0; i < fileList.Count; i++)
            {
                //If the file that is being looked for exists on teh server
                if (fileList[i].GetName() == fileName)
                {
                    //Return that the file exists
                    return(true);
                }
            }

            //Return that the file does not exist
            return(false);
        }
    void OnGUI()
    {
        GUILayout.BeginVertical();

        GUILayout.Label(uploadedImage,GUILayout.Height(317),GUILayout.Width(150));

        //======================================Loading_Message==========================================
        GUILayout.Label(loadingMessage2);
        //======================================Loading_Message==========================================

        //======================================File_Browser_Content==========================================
        if (m_fileBrowser != null)
        {
            GUI.skin = gameSkin;
            m_fileBrowser.OnGUI();
           GUI.skin = null;
        }
        else
        {
            OnGUIMain();
        }
        //======================================File_Browser_Content==========================================

        GUILayout.Label(path ?? "None selected");
        GUILayout.BeginHorizontal();
        //======================================UploadFile==========================================
        if (showAllFilesBtn == true && showUploadBtn == true && showBtn == true && GUILayout.Button("Upload File" , GUILayout.Width(150), GUILayout.Height(30)))
        {

                showUploadBtn = false;
                showBtn = false;
                Debug.Log("PATH IS ::: " + path);
                loadingMessage2 = "Please Wait...";
            if(path ==null || path.Equals(""))
            {
                loadingMessage2 = "Please Select A File";
            }
                fileName = "testFile11"+DateTime.Now.Millisecond;
                uploadService = sp.BuildUploadService(); // Initializing Upload Service.
                uploadService.UploadFile(fileName, path, "IMAGE", "Description", callBack); //Using App42 Unity UploadService.
            }
        //================================================================================
        GUILayout.EndVertical();
        GUILayout.Space(40);
        GUILayout.BeginArea(new Rect(155,5,200,371));
        GUILayout.BeginVertical();
        //========Setting Up ScrollView====================================================
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(155));
        if(listOfImages.Count > 1)
        {
            for(int i=0; i<listOfImages.Count; i++)
            {
                Texture2D myImage = (Texture2D)listOfImages[i];
                GUILayout.Label(myImage,GUILayout.Height(100),GUILayout.Width(100));
            }
            loadingMessage = "";
        }
         GUILayout.EndScrollView();
        //========ScrollView===============================================================

        //======================================Loading_Message==========================================
        GUILayout.Label(loadingMessage);
        //======================================Loading_Message==========================================

        //======================================GetAllFiles===============================
        if (showAllFilesBtn == true && GUILayout.Button("Get All Files" , GUILayout.Width(150), GUILayout.Height(30)))
            {
                loadingMessage = "Loading...";
                uploadService = sp.BuildUploadService(); // Initializing Upload Service.
                uploadService.GetAllFiles(allFilesCallBack);
            }
        //================================================================================
        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }