Пример #1
0
        public void CopyCaptureFromRemote(string remotepath, string localpath, Form window)
        {
            if (m_Remote != null)
            {
                bool  copied   = false;
                float progress = 0.0f;

                renderdocui.Windows.ProgressPopup modal =
                    new renderdocui.Windows.ProgressPopup(
                        (renderdocui.Windows.ModalCloseCallback)(() => { return(copied); }),
                        true);
                modal.SetModalText("Transferring...");

                Thread progressThread = Helpers.NewThread(new ThreadStart(() =>
                {
                    modal.LogfileProgressBegin();

                    while (!copied)
                    {
                        Thread.Sleep(2);

                        modal.LogfileProgress(progress);
                    }
                }));
                progressThread.Start();

                if (Running)
                {
                    BeginInvoke((ReplayRenderer r) =>
                    {
                        m_Remote.CopyCaptureFromRemote(remotepath, localpath, ref progress);

                        copied = true;
                    });
                }
                else
                {
                    Helpers.NewThread(new ThreadStart(() =>
                    {
                        // prevent pings while copying off-thread
                        lock (m_Remote)
                        {
                            m_Remote.CopyCaptureFromRemote(remotepath, localpath, ref progress);
                        }

                        copied = true;
                    })).Start();
                }

                modal.ShowDialog(window);

                // if the copy didn't succeed, throw
                if (!System.IO.File.Exists(localpath))
                {
                    throw new System.IO.FileNotFoundException("File couldn't be transferred from remote host", remotepath);
                }
            }
            else
            {
                System.IO.File.Copy(remotepath, localpath, true);
            }
        }