示例#1
0
    /// <summary>
    /// Uploads the file.
    /// </summary>
    public static void UploadFile()
    {
        DebugLevelController.Log("Path: " + FilePath, 1);
        DebugLevelController.Log("Username: "******"Pass: "******"Host: ftp://" + FTPHost, 1);

        //end uploading

        /*t2_ = new Thread(UploadThread);
         * if (!t2_.IsAlive)
         *  t2_.Start();*/
        StaticCoroutine.Start(UploadThread());

        EditorLogGenerator.GenerateLog("Upload started");
        shouldCheck = true;

        Uri uri2 = new Uri("ftp://" + FTPHost + "version.thln");

        client2.Credentials          = new System.Net.NetworkCredential(FTPUserName, FTPPassword);
        client2.UploadFileCompleted += new UploadFileCompletedEventHandler(OnFileUploadCompleted2);
        client2.UploadFileAsync(uri2, "STOR", Application.dataPath + "/../TheLauncher/version/version.thln");
        EditorLogGenerator.GenerateLog("Version File Upload Started");

        Uri uri3 = new Uri("ftp://" + FTPHost + "v.thln");

        client3.Credentials          = new System.Net.NetworkCredential(FTPUserName, FTPPassword);
        client3.UploadDataCompleted += new UploadDataCompletedEventHandler(OnFileUploadCompleted3);
        byte[] bytes3 = File.ReadAllBytes(Application.dataPath + "/../TheLauncher/version/v.thln");
        client3.UploadDataAsync(uri3, "STOR", bytes3);
        EditorLogGenerator.GenerateLog("File List Upload Started");
    }
示例#2
0
    /// <summary>
    /// Selects the build folder.
    /// </summary>
    static void SelectBuildFolder()
    {
        Compress.pathToCompress = null;
        Compress.compressStatus = null;
        string path = EditorUtility.OpenFolderPanel("Select Build Folder (Must only contain files created by unity)", "", "");

        if (path.Length != 0)
        {
            EditorLogGenerator.GenerateLog("Selected Folder:" + path);
            Compress.pathToCompress = path;
        }
    }
示例#3
0
 public static void CompressMe()
 {
     System.IO.Directory.CreateDirectory(Application.dataPath + "/../TheLauncher/");
     System.IO.Directory.CreateDirectory(Application.dataPath + "/../TheLauncher/COMPRESSED/");
     System.IO.Directory.CreateDirectory(Application.dataPath + "/../TheLauncher/version/");
     EditorLogGenerator.GenerateVersionFile(LastVersion);
     EditorLogGenerator.GenerateFileList(pathToCompress);
     currentFolder = Application.dataPath;
     CompressHelper.CompressDirectory(pathToCompress, currentFolder + "/../TheLauncher/COMPRESSED/upload_" + LastVersion + ".thln");
     //StaticCoroutine.Start(CompressHelper.CompressRoutine(pathToCompress, currentFolder + "/../TheLauncher/COMPRESSED/upload_" + LastVersion + ".thln"));
     EditorLogGenerator.GenerateLog("Compression Thread Launched");
     pathToUpload = Application.dataPath + "/../TheLauncher/COMPRESSED/upload_" + LastVersion + ".thln";
 }
示例#4
0
文件: Compress.cs 项目: Anykan/Battle
 public static void CompressMe()
 {
     System.IO.Directory.CreateDirectory(Application.dataPath + "/../TheLauncher/");
     System.IO.Directory.CreateDirectory(Application.dataPath + "/../TheLauncher/COMPRESSED/");
     System.IO.Directory.CreateDirectory(Application.dataPath + "/../TheLauncher/version/");
     EditorLogGenerator.GenerateVersionFile(LastVersion);
     EditorLogGenerator.GenerateFileList(pathToCompress);
     currentFolder = Application.dataPath;
     t1_           = new Thread(() => CompressHelper.CompressDirectory(pathToCompress, currentFolder + "/../TheLauncher/COMPRESSED/upload_" + LastVersion + ".flamacore"));
     if (!t1_.IsAlive)
     {
         t1_.Start();
     }
     EditorLogGenerator.GenerateLog("Compression Thread Launched");
     pathToUpload = Application.dataPath + "/../TheLauncher/COMPRESSED/upload_" + LastVersion + ".flamacore";
 }
示例#5
0
    void OnGUI()
    {
        GUI.skin = guiSkin;
        tex      = new Texture2D(1, 1, TextureFormat.RGBA32, false);
        tex.SetPixel(0, 0, new Color(0f, 0.41176f, 0.53333f));
        tex.Apply();
        boxback.normal.background   = tex;
        titleStyle.fontSize         = 20;
        titleStyle.normal.textColor = Color.white;

        //Background 1
        tex = new Texture2D(1, 1, TextureFormat.RGBA32, false);
        tex.SetPixel(0, 0, new Color(0f, 0.20392f, 0.25882f));
        tex.Apply();
        GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), tex, ScaleMode.StretchToFill);
        //End Background

        //Horizontal Box: Set version
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("Set Version (as string): ");
        Compress.LastVersion = GUILayout.TextField(Compress.LastVersion);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box

        //Horizontal Box: Select Build
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("\nSelect your build", titleStyle);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box

        //Horizontal Box: Subtitle
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("Must contain only build files and nothing else");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box

        if (GUILayout.Button("Select Build Folder", guiSkin.button))
        {
            SelectBuildFolder();
        }

        //Horizontal Box: Compress and upload
        GUILayout.BeginHorizontal();
        GUILayout.Box("Folder to compress: " + Compress.pathToCompress);
        GUILayout.EndHorizontal();

        if (!String.IsNullOrEmpty(Compress.pathToCompress))
        {
            if (String.IsNullOrEmpty(Compress.compressStatus))
            {
                if (GUILayout.Button("Compress"))
                {
                    bool should = EditorUtility.DisplayDialog(
                        "Compress folder",
                        "The folder |  " + Compress.pathToCompress + "  | is about to be compressed and put in Project Folder/The Launcher/. " +
                        "\nDo you want to continue?",
                        "Yes, compress!",
                        "No, go back"
                        );
                    if (should)
                    {
                        CompressBuild();
                        Debug.Log("Compression Started");
                        Debug.Log("Compression Status:" + Compress.compressStatus);
                        FilePath = Compress.pathToUpload;
                        EditorLogGenerator.GenerateLog("Compression Started");
                        Uploader.UploadStatus = null;
                    }
                }
            }
            GUILayout.BeginHorizontal();
            GUILayout.Box("Compression Status (" + Compress.compressCount + "/" + Compress.totalFiles + ");" + Compress.compressStatus);
            GUILayout.EndHorizontal();
        }


        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("\n---------------------------------------\n");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        //Vertical Box: FTP seciton
        GUILayout.BeginVertical(boxback);
        //Horizontal Box: FTP Upload
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("\nUpload your build\n", titleStyle);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box


        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("FTP Host:");
        FTPHost = GUILayout.TextField(FTPHost);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("FTP Username:"******"FTP Password:"******"Do not include the 'ftp://' part and should include the folder you wish to upload your game. \nEg. test.com/mygame/download/");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        if (!String.IsNullOrEmpty(FilePath))
        {
            GUILayout.BeginHorizontal();
            if (String.IsNullOrEmpty(Uploader.UploadStatus))
            {
                if (GUILayout.Button("UPLOAD"))
                {
                    bool should = EditorUtility.DisplayDialog(
                        "Upload File",
                        FilePath + "  | is about to be uploaded to '" +
                        "\n" + FTPHost
                        + "\n with username: "******"\n with password: "******"Yes, UPLOAD!",
                        "No, go back"
                        );
                    if (should)
                    {
                        Uploader.FTPHost     = FTPHost;
                        Uploader.FTPUserName = FTPUserName;
                        Uploader.FTPPassword = FTPPassword;
                        Uploader.FilePath    = FilePath;
                        Uploader.UploadFile();
                        Debug.Log("Upload Started");
                        EditorLogGenerator.GenerateLog("Upload Started");
                        should = false;
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
        //Vertical Box

        //Horizontal Box: Infos
        if (!String.IsNullOrEmpty(FilePath))
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("File to upload: " + FilePath);
            GUILayout.EndHorizontal();
        }
        GUILayout.BeginHorizontal();
        //Debug.Log (Uploader.client.IsBusy);
        GUILayout.Box(Uploader.UploadStatus);
        GUILayout.EndHorizontal();
        //Horizontal Box
        GUILayout.EndVertical();
        if (!String.IsNullOrEmpty(Uploader.UploadStatus))
        {
            if (Uploader.UploadStatus.Contains("Upload Done"))
            {
                Uploader.UploadStatus = "";
                this.Close();
                EditorUtility.DisplayDialog(
                    "Upload Done!",
                    "File was uploaded to the server. Now the window will be closed.",
                    "OK"
                    );
            }
        }
        if (!String.IsNullOrEmpty(Uploader.UploadStatus))
        {
            if (Uploader.UploadStatus.Contains("Upload Progress"))
            {
                if (GUILayout.Button("Cancel Upload"))
                {
                    Uploader.t2_.Abort();
                    Uploader.shouldCheck  = false;
                    Uploader.UploadStatus = null;
                    Debug.Log("Upload Cancelled");
                    EditorLogGenerator.GenerateLog("Upload Cancelled");
                }
            }
        }
    }
示例#6
0
    void OnGUI()
    {
        window   = (TheLauncher)EditorWindow.GetWindow(typeof(TheLauncher), false, null, false);
        GUI.skin = guiSkin;
        tex      = new Texture2D(1, 1, TextureFormat.RGBA32, false);
        tex.SetPixel(0, 0, new Color(0f, 0.41176f, 0.53333f));
        tex.Apply();
        boxback.normal.background          = tex;
        titleStyle.fontSize                = 20;
        titleStyle.normal.textColor        = Color.white;
        smallButtonStyle.normal.background = tex;
        smallButtonStyle.padding           = new RectOffset(5, 5, 5, 5);
        smallButtonStyle.normal.textColor  = Color.white;
        smallButtonStyle.margin            = new RectOffset(5, 5, 5, 5);
        smallButtonStyle.alignment         = TextAnchor.MiddleCenter;
        tex2 = new Texture2D(1, 1, TextureFormat.RGBA32, false);
        tex2.SetPixel(0, 0, new Color(0f, 0.71176f, 0.83333f));
        tex2.Apply();
        smallButtonStyle.hover.background = tex2;

        //Background 1
        tex = new Texture2D(1, 1, TextureFormat.RGBA32, false);
        tex.SetPixel(0, 0, new Color(0f, 0.20392f, 0.25882f));
        tex.Apply();
        GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), tex, ScaleMode.StretchToFill);
        //End Background

        //Horizontal Box: Set version
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("Set Version (as string): ");
        Compress.LastVersion = GUILayout.TextField(Compress.LastVersion);
        if (GUILayout.Button("Settings", smallButtonStyle))
        {
            showSettings = true;
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box

        //Horizontal Box: Settings
        if (showSettings)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Label("Settings", titleStyle);
            if (GUILayout.Button("Close Settings", smallButtonStyle))
            {
                showSettings = false;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Set No Log", smallButtonStyle))
            {
                DebugLevelController.DebugLogLevel = -1;
                Debug.Log("No Log");
            }
            if (GUILayout.Button("Set Log Level To: User", smallButtonStyle))
            {
                DebugLevelController.DebugLogLevel = 0;
                Debug.Log("User Level Log");
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Set Log Level To: Developer", smallButtonStyle))
            {
                DebugLevelController.DebugLogLevel = 1;
                Debug.Log("Developer Level Log");
            }
            if (GUILayout.Button("Set Log Level To: Hacker", smallButtonStyle))
            {
                DebugLevelController.DebugLogLevel = 2;
                Debug.Log("Hacker Level Log");
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
        //Horizontal Box

        //Horizontal Box: Select Build
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("\nSelect your build", titleStyle);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box

        //Horizontal Box: Subtitle
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("Must contain only build files and nothing else");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box

        if (GUILayout.Button("Select Build Folder", guiSkin.button))
        {
            SelectBuildFolder();
        }

        //Horizontal Box: Compress and upload
        GUILayout.BeginHorizontal();
        GUILayout.Box("Folder to compress: " + Compress.pathToCompress);
        GUILayout.EndHorizontal();

        if (!String.IsNullOrEmpty(Compress.pathToCompress))
        {
            if (String.IsNullOrEmpty(Compress.compressStatus))
            {
                if (GUILayout.Button("Compress"))
                {
                    bool should = EditorUtility.DisplayDialog(
                        "Compress folder",
                        "Please be aware that if you start the copmression and do some changes to your scripts and recompile, the thread will halt and unity may become unresponsive. \n" +
                        "\n The folder |  " + Compress.pathToCompress + "  | is about to be compressed and put in Project Folder/The Launcher/. " +
                        "\nDo you want to continue?",
                        "Yes, compress!",
                        "No, go back"
                        );
                    if (should)
                    {
                        CompressBuild();
                        DebugLevelController.Log("Compression Started");
                        //DebugLevelController.Log ("Compression Status:" + Compress.compressStatus);
                        FilePath = Compress.pathToUpload;
                        EditorLogGenerator.GenerateLog("Compression Started");
                        Uploader.UploadStatus = null;
                    }
                }
            }
            GUILayout.BeginHorizontal();
            GUILayout.Box("Compression Status (" + Compress.compressCount + "/" + Compress.totalFiles + ");" + Compress.compressStatus);
            GUILayout.EndHorizontal();
        }

        if (!String.IsNullOrEmpty(Compress.compressStatus))
        {
            if (GUILayout.Button("Stop Compression Thread"))
            {
                bool should = EditorUtility.DisplayDialog(
                    "Compress folder",
                    "The Launcher will attempt to stop the compression thread right now." +
                    "\nDo you want to continue?",
                    "Yes, stop!",
                    "No, go back"
                    );
                if (should)
                {
                    CompressHelper.abortThreadOnNextTry = true;
                    DebugLevelController.Log("Compression Stopped");
                    FilePath = Compress.pathToUpload;
                    EditorLogGenerator.GenerateLog("Compression Stopped");
                    Uploader.UploadStatus   = null;
                    Compress.compressStatus = null;
                }
            }
        }

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("\n---------------------------------------\n");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        //Vertical Box: FTP seciton
        GUILayout.BeginVertical(boxback);
        //Horizontal Box: FTP Upload
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("\nUpload your build\n", titleStyle);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box


        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("FTP Host:");
        FTPHost = GUILayout.TextField(FTPHost);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("FTP Username:"******"FTP Password:"******"Do not include the 'ftp://' part and should include the folder you wish to upload your game. \nEg. test.com/mygame/download/");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        if (!String.IsNullOrEmpty(FilePath))
        {
            GUILayout.BeginHorizontal();
            if (String.IsNullOrEmpty(Uploader.UploadStatus))
            {
                if (GUILayout.Button("UPLOAD"))
                {
                    bool should = EditorUtility.DisplayDialog(
                        "Upload File",
                        FilePath + "  | is about to be uploaded to '" +
                        "\n" + FTPHost
                        + "\n with username: "******"\n with password: "******"Yes, UPLOAD!",
                        "No, go back"
                        );
                    if (should)
                    {
                        Uploader.FTPHost     = FTPHost;
                        Uploader.FTPUserName = FTPUserName;
                        Uploader.FTPPassword = FTPPassword;
                        Uploader.FilePath    = FilePath;
                        Uploader.UploadFile();
                        DebugLevelController.Log("Upload Started");
                        EditorLogGenerator.GenerateLog("Upload Started");
                        should = false;
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
        //Vertical Box

        //Horizontal Box: Infos
        if (!String.IsNullOrEmpty(FilePath))
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("File to upload: " + FilePath);
            GUILayout.EndHorizontal();
        }
        GUILayout.BeginHorizontal();
        //DebugLevelController.Log (Uploader.client.IsBusy);
        GUILayout.Box(Uploader.UploadStatus);
        GUILayout.EndHorizontal();
        //Horizontal Box
        GUILayout.EndVertical();
        if (!String.IsNullOrEmpty(Uploader.UploadStatus))
        {
            if (Uploader.UploadStatus.Contains("Upload Done"))
            {
                Uploader.UploadStatus = "";
                this.Close();
                EditorUtility.DisplayDialog(
                    "Upload Done!",
                    "File was uploaded to the server. Now the window will be closed.",
                    "OK"
                    );
            }
        }
        if (!String.IsNullOrEmpty(Uploader.UploadStatus))
        {
            if (Uploader.UploadStatus.Contains("Upload Progress"))
            {
                if (GUILayout.Button("Cancel Upload"))
                {
                    Uploader.abortThreadOnNextTry = true;
                    Uploader.shouldCheck          = false;
                    Uploader.UploadStatus         = null;
                    DebugLevelController.Log("Upload Cancelled");
                    EditorLogGenerator.GenerateLog("Upload Cancelled");
                }
            }
        }
    }
示例#7
0
    public static IEnumerator CompressRoutine(string sInDir, string sOutFile)
    {
        lastDone = false;
        Compress.compressCount  = 0;
        Compress.compressStatus = "Getting Files";
        string[] sFiles  = Directory.GetFiles(sInDir, "*.*", SearchOption.AllDirectories);
        int      iDirLen = sInDir[sInDir.Length - 1] == Path.DirectorySeparatorChar ? sInDir.Length : sInDir.Length + 1;

        Compress.totalFiles = sFiles.Length;
        yield return(null);

        t3_ = new Thread(() =>
        {
            FileStream outFile   = new FileStream(sOutFile, FileMode.Create, FileAccess.Write, FileShare.None, 4096, true);
            GZipStream str       = new GZipStream(outFile, CompressionMode.Compress);
            abortThreadOnNextTry = false;
            foreach (string sFilePath in sFiles)
            {
                lastDone = false;
                Compress.compressCount++;
                string sRelativePath    = sFilePath.Substring(iDirLen);
                Compress.compressStatus = "Compressing..";
                //Compress file name
                DebugLevelController.Log("Compressing File Name: " + sRelativePath);
                char[] chars = sRelativePath.ToCharArray();
                str.Write(BitConverter.GetBytes(chars.Length), 0, sizeof(int));
                Compress.compressStatus = "File: " + sRelativePath;
                foreach (char c in chars)
                {
                    str.Write(BitConverter.GetBytes(c), 0, sizeof(char));
                }
                //Compress file content
                DebugLevelController.Log("Compressing File Content: " + sRelativePath, 1);
                int bufferSize = 500 * 1024; //* 1024; // 100MB
                byte[] buffer  = new byte[bufferSize];
                int bytesRead  = 0;
                long DoneBytes = 0;
                using (FileStream fsSource = new FileStream(Path.Combine(sInDir, sRelativePath), FileMode.Open, FileAccess.Read))
                {
                    DebugLevelController.Log("File Stream Created: " + fsSource.Name, 1);
                    while ((bytesRead = fsSource.Read(buffer, 0, bufferSize)) > 0)
                    {
                        if (abortThreadOnNextTry)
                        {
                            return;
                        }
                        DoneBytes += bufferSize;
                        DebugLevelController.Log("Reading Bytes:" + (DoneBytes) + "/" + fsSource.Length + " File:" + sRelativePath, 2);
                        Compress.compressStatus = ((double)(((DoneBytes) / fsSource.Length) * 100)).ToString() + "%" + " File:" + sRelativePath;
                        str.Write(BitConverter.GetBytes(buffer.Length), 0, sizeof(int));
                        str.Write(buffer, 0, buffer.Length);
                    }
                }
                strm = str;
            }
            lastDone = true;
            if (abortThreadOnNextTry)
            {
                Compress.compressStatus = "Compression Aborted!";
                DebugLevelController.Log("Compression Aborted At:" + DateTime.Now.ToShortTimeString());
                strm.Close();
            }
            else
            {
                Compress.compressStatus = "Compression Done!";
                DebugLevelController.Log("Compression Done At:" + DateTime.Now.ToShortTimeString());
                strm.Close();
            }
        });
        if (!t3_.IsAlive)
        {
            t3_.Start();
        }

        /*while (!lastDone)
         *  yield return null;*/
        yield return(null);

        EditorLogGenerator.GenerateLog("Compression Done At:" + DateTime.Now.ToShortTimeString());
        yield return(null);
    }
示例#8
0
文件: Uploader.cs 项目: Anykan/Battle
    /// <summary>
    /// Uploads the file.
    /// </summary>
    public static void UploadFile()
    {
        Debug.Log("Path: " + FilePath);
        Debug.Log("Username: "******"Pass: "******"Host: ftp://" + FTPHost);

        t2_ = new Thread(() => {
            FtpWebRequest ftpClient = (FtpWebRequest)FtpWebRequest.Create("ftp://" + FTPHost + new FileInfo(FilePath).Name);
            ftpClient.Credentials   = new System.Net.NetworkCredential(FTPUserName, FTPPassword);
            ftpClient.Method        = System.Net.WebRequestMethods.Ftp.UploadFile;
            ftpClient.UseBinary     = true;
            ftpClient.KeepAlive     = true;
            System.IO.FileInfo fi   = new System.IO.FileInfo(FilePath);
            ftpClient.ContentLength = fi.Length;
            byte[] buffer           = new byte[4097];
            int bytes               = 0;
            long total_bytes        = (long)fi.Length;
            System.IO.FileStream fs = fi.OpenRead();
            System.IO.Stream rs     = ftpClient.GetRequestStream();
            long fileLength         = new System.IO.FileInfo(FilePath).Length;
            while (total_bytes > 0)
            {
                bytes = fs.Read(buffer, 0, buffer.Length);
                rs.Write(buffer, 0, bytes);
                total_bytes  = total_bytes - bytes;
                UploadStatus = "Upload Progress: " + GetBytesReadable(fileLength - total_bytes) + "/" + GetBytesReadable(fileLength);
            }
            //fs.Flush();
            fs.Close();
            rs.Close();
            FtpWebResponse uploadResponse = (FtpWebResponse)ftpClient.GetResponse();
            if (total_bytes == 0)
            {
                UploadStatus = "Upload Done!";
            }
            else
            {
                UploadStatus = uploadResponse.StatusDescription;
            }
            uploadResponse.Close();
        });
        if (!t2_.IsAlive)
        {
            t2_.Start();
        }

        EditorLogGenerator.GenerateLog("Upload started");
        shouldCheck = true;

        Uri uri2 = new Uri("ftp://" + FTPHost + "version.flamacore");

        client2.Credentials          = new System.Net.NetworkCredential(FTPUserName, FTPPassword);
        client2.UploadFileCompleted += new UploadFileCompletedEventHandler(OnFileUploadCompleted2);
        client2.UploadFileAsync(uri2, "STOR", Application.dataPath + "/../TheLauncher/version/version.flamacore");
        EditorLogGenerator.GenerateLog("Version File Upload Started");

        Uri uri3 = new Uri("ftp://" + FTPHost + "v.flamacore");

        client3.Credentials          = new System.Net.NetworkCredential(FTPUserName, FTPPassword);
        client3.UploadDataCompleted += new UploadDataCompletedEventHandler(OnFileUploadCompleted3);
        byte[] bytes3 = File.ReadAllBytes(Application.dataPath + "/../TheLauncher/version/v.flamacore");
        client3.UploadDataAsync(uri3, "STOR", bytes3);
        EditorLogGenerator.GenerateLog("File List Upload Started");
    }