# SecondView

SecondView Static Function

Task SecondView.Connect(Server server)

Connect to a server directly, you can await this function.

// Create Google Drive server and connect it with SecondView Server google_server = new Server { Protocol = ServerProtocol.GoogleDrive}; SecondView.Connect(google_server);

Task SecondView.Connect(string sitename)

Connect to a server by name in the Site Manager, you can await this function.

The name should be the full path name.

For exmple, if you have a "demo" site under a "Test" folder in the Site Manager dialog, you must use "Test/demo" as the site name.

Server google_server = new Server { Protocol = ServerProtocol.GoogleDrive}; // Create Google Drive server Site.Add("Test/demo",google_server); // Add to Site Manager SecondView.Connect("Test/demo"); // Connect by the name of server

Server SecondView.GetServer()

Get the current connected server.

Task SecondView.Disconnect()

Disconnect from server.

void SecondView.Cancel()

Cancel the currently executing action.

void SecondView.SwitchToLocal()

Switch to local mode.

void SecondView.SwitchToServer()

Switch to server mode.

string SecondView.CurrentDir()

Get the current directory.

ObservableCollection<RushFileInfo> SecondView.FileList()

Get the current file list.

Task SecondView.ChangeDir(string dir)

Change current directory, you can await this function. The dir parameter can be a relative path to current dirctory or an absolute path start with "/".

Task SecondView.CreateDir(string dir)

Create a directory, the dir parameter can be a relative path to current dirctory or an absolute path start with "/".

Task SecondView.DeleteFile(string filepath)

Delete file, the filepath parameter can be a relative path to current dirctory or an absolute path start with "/".

Task SecondView.DeleteDir(string dirpath)

Delete directory, the dirpath parameter can be a relative path to current dirctory or an absolute path start with "/".

Task SecondView.RenameFile(string oldname,string newname)

Rename a file from oldname to newname, these parameters can be relative path to current dirctory or absolute path start with "/".

Task SecondView.RenameDir(string oldname,string newname)

Rename a directory from oldname to newname, these parameters can be relative path to current dirctory or absolute path start with "/".

void SecondView.TransferFile(string name)

Transfer the specified file immediately.

The name parameter can be a relative path to current dirctory or an absolute path start with "/".

//This script will first set FirstView to local mode and switch to the "Documents" directory, //then let SecondView connect to the demo.wftpserver.com server and switch to the "download" directory. //Finally start to download "Autumn.jpg" and "Spring.jpg". FirstView.SwitchToLocal(); await FirstView.ChangeDir("~Documents"); Server source = new Server{ Host ="demo.wftpserver.com", Username="demo", Password="demo" }; await SecondView.Connect(source); await SecondView.ChangeDir("download"); SecondView.TransferFile("Autumn.jpg"); SecondView.TransferFile("/download/Spring.jpg");

void SecondView.TransferDir(string name)

Transfer the directory immediately.

The name parameter can be a relative path to current dirctory or an absolute path start with "/".

//This script will first set FirstView to local mode and switch to the "Documents" directory, //then let SecondView connect to the demo.wftpserver.com server and transfer the "download" directory. FirstView.SwitchToLocal(); await FirstView.ChangeDir("~Documents"); Server source = new Server{ Host ="demo.wftpserver.com", Username="demo", Password="demo" }; await SecondView.Connect(source); SecondView.TransferDir("download");

void SecondView.QueueFile(string name)

Put the specified file to the transfer queue.

It will start transferring the next time you start processing the queue.

void SecondView.QueueDir(string name)

Put the specified directory to the transfer queue.

It will start transferring the next time you start processing the queue.