Esempio n. 1
0
        private void OnChanged(object sender, FileSystemEventArgs e)
        {
            FileStatus a = new FileStatus();
            a.FileName = e.Name;
            a.FilePath = e.FullPath;
            currentFile = a;
            FilesToArchive.Add(a);

            if (!m_bDirty)
            {
                m_Sb.Remove(0, m_Sb.Length);
                m_Sb.Append(e.FullPath);
                m_Sb.Append(" ");
                m_Sb.Append(e.ChangeType.ToString());
                m_Sb.Append("    ");
                m_Sb.Append(DateTime.Now.ToString());
                m_bDirty = true;
                StartUpload(a);
            }
        }
Esempio n. 2
0
        private void StartUpload(FileStatus a)
        {
            a.UploadStartTime = DateTime.Now;
            Aspera.Transfer.Environment.setFaspScpPath("C:\\AsperaTest\\Aspera\\ascp.exe");
            /*
             * Set the local management port to be used by Fasp manager.
             * If not set, Fasp Manager will pick a random port and use it.
             * It is best to not set this port.
             */
            Aspera.Transfer.Environment.setManagementPort(54002);
            FaspManager manager = FaspManager.getInstance();
            MyListener myListener = new MyListener();

            /* Uncomment the following two lines to receive
             * notifications about transfers not initiated by fasp manager
             */
            manager.listenForServerSessions(true);
            manager.addListener(myListener);
            LocalFileLocation uploadSource = new LocalFileLocation();
            uploadSource.addPath(a.FilePath);
            RemoteFileLocation uploadDestination = new RemoteFileLocation("hack2.aspera.us", "xfer", "aspera");
            uploadDestination.addPath(".");
            XferParams uploadXferParams = getDefaultXferParams();
            JobOrder uploadOrder = new JobOrder(uploadSource, uploadDestination, uploadXferParams);
            String uploadJobId = manager.startTransfer(uploadOrder, myListener);
            a.IsUploaded = true;
        }
Esempio n. 3
0
        private static void MoveFileToArchive(FileStatus a)
        {
            try
            {
                m_bDirty = false;
                if (a.IsUploaded)
                    File.Move(a.FilePath, strArchivePath + "\\" + a.FileName);
                a.IsArchived = true;
            }
            catch (Exception)
            {

            }
        }