protected IEnumerator DownloadWholeFile(FileURL _fileUrl, int _windowSize)
    {
        int rfsize = -1; // remote file size
        int lfsize = -1; // local file size
        var pd     = UnityWebRequestHelper.DownloadProcess.BeforeProcess;

        //check remote file status
        StartCoroutine(DownloadBehaviourCheck(_fileUrl,
                                              (UnityWebRequestHelper.DownloadProcess _dp, int _local, int _remote) =>
        {
            pd     = _dp;
            rfsize = _remote;
            lfsize = _local;
        }
                                              ));

        // wait until DownloadBehaviourCheck finished
        while (pd == UnityWebRequestHelper.DownloadProcess.BeforeProcess)
        {
            yield return(null);
        }

        Debug.LogFormat("remote file size {0}; local file size {1}; Next Process will be {2}", rfsize, lfsize, pd);

        switch (pd)
        {
        case UnityWebRequestHelper.DownloadProcess.RedownloadFromBeginning:
            myFileIOHelper.Remove(_fileUrl.localPath);     //Delete TargetFile first
            lfsize = -1;
            break;

        case UnityWebRequestHelper.DownloadProcess.Resume:     //just keep doing
            break;

        case UnityWebRequestHelper.DownloadProcess.DoNothing:
        default:
            Debug.Log("Do Nothing");
            yield break;
        }

        // ONLY ONE of this DownloadWholeFile() can be processed at any given time
        if (downloading)
        {
            yield return(new WaitForSeconds(1f));
        }

        downloading = true;
        for (int i = lfsize + 1; i < rfsize; i += _windowSize)
        {
            yield return(StartCoroutine(
                             myUnityWebRequestHelper.DownloadParts(
                                 (byte[] _bytes) => {
                myFileIOHelper.AppendTo(_fileUrl.localPath, _bytes);
                myProgressDelegate((float)i / (float)rfsize);
            }, _fileUrl.fullURL, i, _windowSize)
                             ));
        }
        myProgressDelegate(1);
        downloading = false;
    }
        public void TestMethodAppendTo()
        {
            FileIOHelper fileIOHelper = new FileIOHelper();

            byte[] bytess   = new byte[] { 1, 2, 3, 4, 5, 6, 7 };
            string filepath = @"d:\123.546";

            int fileSize = fileIOHelper.CheckFileSize(filepath);

            fileIOHelper.AppendTo(filepath, bytess);
            Console.WriteLine("Append to d:\\123.546 from " + fileSize);
            Assert.AreEqual <int>(fileSize + 7, fileIOHelper.CheckFileSize(filepath));

            System.IO.Stream st = new System.IO.MemoryStream(new byte[] { 5, 4, 3, 2, 1 });
            fileSize = fileIOHelper.CheckFileSize(filepath);
            fileIOHelper.AppendTo(filepath, st);
            Console.WriteLine("Append to d:\\123.546");
            Assert.AreEqual <int>(fileSize + 5, fileIOHelper.CheckFileSize(filepath));
        }