Skip to content

Commit

Permalink
Added sublimetext configuration option for OmniSharp; tested autocomp…
Browse files Browse the repository at this point in the history
…letion in test project
  • Loading branch information
jptrosclair committed Dec 5, 2014
1 parent 8763c79 commit da6e070
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 85 deletions.
3 changes: 2 additions & 1 deletion FtpClient.sublime-project
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@
"cmd": ["make", "test"],
"working_dir": "$project_path"
}
]
],
"solution_file": "./FtpClient.sln"
}
171 changes: 87 additions & 84 deletions Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ static void Main(string[] args) {
Download(cl);
Delete(cl);
}
}*/

}*/

StreamResponses();

//TestServer();
Expand Down Expand Up @@ -75,12 +75,12 @@ static void Main(string[] args) {
//TestUnixList();
//TestNetBSDServer();

// TestConnectionFailure();

//TestGetObjectInfo();

//TestFtpPath();

// TestConnectionFailure();

//TestGetObjectInfo();

//TestFtpPath();

//TestUnixListing();
}
catch (Exception ex) {
Expand All @@ -89,85 +89,88 @@ static void Main(string[] args) {

Console.WriteLine("--DONE--");
Console.ReadKey();
}

static void StreamResponses() {
using (FtpClient cl = new FtpClient()) {
cl.Credentials = new NetworkCredential(m_user, m_pass);
cl.Host = m_host;
cl.EncryptionMode = FtpEncryptionMode.None;

using (FtpDataStream s = (FtpDataStream)cl.OpenWrite("test.txt")) {
FtpReply r = s.CommandStatus;

Console.WriteLine();
Console.WriteLine("Response to STOR:");
Console.WriteLine("Code: {0}", r.Code);
Console.WriteLine("Message: {0}", r.Message);
Console.WriteLine("Informational: {0}", r.InfoMessages);

r = s.Close();
Console.WriteLine();
Console.WriteLine("Response after close:");
Console.WriteLine("Code: {0}", r.Code);
Console.WriteLine("Message: {0}", r.Message);
Console.WriteLine("Informational: {0}", r.InfoMessages);
}
}
}

static void TestUnixListing() {
using (FtpClient cl = new FtpClient()) {
cl.Host = "ftptest";
cl.Credentials = new NetworkCredential("ftptest", "ftptest");

if (!cl.FileExists("test.txt")) {
using (Stream s = cl.OpenWrite("test.txt")) {
s.Close();
}
}

foreach (FtpListItem i in cl.GetListing(null, FtpListOption.ForceList)) {
Console.WriteLine(i);
}
}
}

static void TestFtpPath() {
string path = "/home/sigurdhj/errors/16.05.2014/asdasd/asd asd asd aa asd/Kooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::asdasd";

Console.WriteLine(path.GetFtpDirectoryName());
Console.WriteLine("./foobar".GetFtpDirectoryName());
Console.WriteLine("foobar".GetFtpDirectoryName());
Console.WriteLine(path.GetFtpFileName());
Console.WriteLine("/foo/bar".GetFtpFileName());
Console.WriteLine("./foo/bar".GetFtpFileName());
Console.WriteLine("./bar".GetFtpFileName());
Console.WriteLine("/bar".GetFtpFileName());
Console.WriteLine("bar".GetFtpFileName());
}

static void TestGetObjectInfo() {
using (FtpClient cl = new FtpClient()) {
FtpListItem item;

cl.Host = "ftptest";
cl.Credentials = new NetworkCredential("ftptest", "ftptest");
cl.Encoding = Encoding.Default;

item = cl.GetObjectInfo("/Examples/OpenRead.cs");
Console.WriteLine(item.ToString());
}
}

static void StreamResponses() {
using (FtpClient cl = new FtpClient()) {
cl.Credentials = new NetworkCredential(m_user, m_pass);
cl.Host = m_host;
cl.EncryptionMode = FtpEncryptionMode.None;
cl.ValidateCertificate += new FtpSslValidation(delegate(FtpClient control, FtpSslValidationEventArgs e) {
e.Accept = true;
});

using (FtpDataStream s = (FtpDataStream)cl.OpenWrite("test.txt")) {
FtpReply r = s.CommandStatus;

Console.WriteLine();
Console.WriteLine("Response to STOR:");
Console.WriteLine("Code: {0}", r.Code);
Console.WriteLine("Message: {0}", r.Message);
Console.WriteLine("Informational: {0}", r.InfoMessages);

r = s.Close();
Console.WriteLine();
Console.WriteLine("Response after close:");
Console.WriteLine("Code: {0}", r.Code);
Console.WriteLine("Message: {0}", r.Message);
Console.WriteLine("Informational: {0}", r.InfoMessages);
}
}
}

static void TestUnixListing() {
using (FtpClient cl = new FtpClient()) {
cl.Host = "ftptest";
cl.Credentials = new NetworkCredential("ftptest", "ftptest");

if (!cl.FileExists("test.txt")) {
using (Stream s = cl.OpenWrite("test.txt")) {
s.Close();
}
}

foreach (FtpListItem i in cl.GetListing(null, FtpListOption.ForceList)) {
Console.WriteLine(i);
}
}
}

static void TestFtpPath() {
string path = "/home/sigurdhj/errors/16.05.2014/asdasd/asd asd asd aa asd/Kooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo::asdasd";

Console.WriteLine(path.GetFtpDirectoryName());
Console.WriteLine("./foobar".GetFtpDirectoryName());
Console.WriteLine("foobar".GetFtpDirectoryName());
Console.WriteLine(path.GetFtpFileName());
Console.WriteLine("/foo/bar".GetFtpFileName());
Console.WriteLine("./foo/bar".GetFtpFileName());
Console.WriteLine("./bar".GetFtpFileName());
Console.WriteLine("/bar".GetFtpFileName());
Console.WriteLine("bar".GetFtpFileName());
}

static void TestGetObjectInfo() {
using (FtpClient cl = new FtpClient()) {
FtpListItem item;

cl.Host = "ftptest";
cl.Credentials = new NetworkCredential("ftptest", "ftptest");
cl.Encoding = Encoding.Default;

item = cl.GetObjectInfo("/Examples/OpenRead.cs");
Console.WriteLine(item.ToString());
}
}

static void TestManualEncoding() {
using (FtpClient cl = new FtpClient()) {
cl.Host = "ftptest";
cl.Credentials = new NetworkCredential("ftptest", "ftptest");
cl.Encoding = Encoding.Default;

using (Stream s = cl.OpenWrite("test.txt")) {
s.Close();
cl.Encoding = Encoding.Default;

using (Stream s = cl.OpenWrite("test.txt")) {
s.Close();
}
}
}
Expand Down Expand Up @@ -277,9 +280,9 @@ static void TestNetBSDServer() {
static void TestUnixList() {
using (FtpClient client = new FtpClient()) {
client.Credentials = new NetworkCredential("ftptest", "ftptest");
client.Host = "ftptest";
foreach (FtpListItem i in client.GetListing(null, FtpListOption.ForceList | FtpListOption.Recursive)) {
Console.WriteLine(i.FullName);
client.Host = "ftptest";
foreach (FtpListItem i in client.GetListing(null, FtpListOption.ForceList | FtpListOption.Recursive)) {
Console.WriteLine(i.FullName);
}
}
}
Expand Down

0 comments on commit da6e070

Please sign in to comment.