本文整理汇总了C#中Renci.SshNet.SftpClient.GetAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# SftpClient.GetAttributes方法的具体用法?C# SftpClient.GetAttributes怎么用?C# SftpClient.GetAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renci.SshNet.SftpClient
的用法示例。
在下文中一共展示了SftpClient.GetAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//.........这里部分代码省略.........
Console.Write("-");
}
Console.Write("|");
Console.Write(c.Percentage + " % ");
Console.WriteLine();
Console.SetCursorPosition(left, top);
};
*/
string serverloc = ConfigurationSettings.AppSettings["server-ftpdir"];
string serverloc2 = ConfigurationSettings.AppSettings["server-web-ftpdir"];
Console.WriteLine("connecting server ftp");
SftpClient client = new SftpClient(ConfigurationSettings.AppSettings["server-ftpurl"], ConfigurationSettings.AppSettings["server-ftpusername"], ConfigurationSettings.AppSettings["server-ftppassword"]);
client.Connect();
Console.WriteLine("server connected");
#endif
foreach (var depend in depends) {
var to = pre + shufSharp + @"\output\" + depend.Key.Split(new[] {"\\"}, StringSplitOptions.RemoveEmptyEntries).Last() + ".js";
var output = "";
Application application = depend.Value;
if (application.Node) {
output += "require('./mscorlib.js');";
output += "EventEmitter= require('events.js').EventEmitter;";
} else {
//output += "require('./mscorlib.debug.js');";
}
foreach (var depe in application.IncludesAfter) {
output += string.Format("require('{0}');", depe);
}
var lines = new List<string>();
lines.Add(output);
lines.AddRange(File.ReadAllLines(to));
// lines.Add(application.After);
File.WriteAllLines(to, lines);
var name = to.Split(new char[] {'\\'}, StringSplitOptions.RemoveEmptyEntries).Last();
#if FTP
long length = new FileInfo(to).Length;
/* if (!webftp.FileExists(loc + name) || webftp.GetFileSize(loc + name) != length)
{
Console.WriteLine("ftp start " + length.ToString("N0"));
webftp.Upload(loc + name, to);
Console.WriteLine("ftp complete " + to);
}
*/
if (true || !client.Exists(serverloc + name) || client.GetAttributes(serverloc + name).Size != length) {
Console.WriteLine("server ftp start " + length.ToString("N0"));
var fileStream = new FileInfo(to).OpenRead();
client.UploadFile(fileStream, serverloc + name, true);
fileStream.Close();
Console.WriteLine("server ftp complete " + to);
}
if (true || !client.Exists(serverloc2 + name) || client.GetAttributes(serverloc2 + name).Size != length) {
Console.WriteLine("server ftp start " + length.ToString("N0"));
var fileStream = new FileInfo(to).OpenRead();
client.UploadFile(fileStream, serverloc2 + name, true);
fileStream.Close();
Console.WriteLine("server ftp complete " + to);
}
#endif
if (File.Exists(@"C:\code\node\" + name) && /*new FileInfo(@"C:\code\node\" + name).Length != new FileInfo(to).Length*/ true) {
tryDelete(@"C:\code\node\" + name);
tryCopy(to, @"C:\code\node\" + name);
}
}
foreach (var d in Directory.GetDirectories(pre + shufSharp + @"\ShuffleGames\")) {
string game = d.Split('\\').Last();
var to = pre + shufSharp + @"\output\Games\" + game;
if (!Directory.Exists(to))
Directory.CreateDirectory(to);
if (d.EndsWith("bin") || d.EndsWith("obj"))
continue;
File.WriteAllText(to + @"\app.js", File.ReadAllText(d + @"\app.js"));
#if FTP
Console.WriteLine("server ftp start ");
var fileStream = new FileInfo(to + @"\app.js").OpenRead();
if (!client.Exists(serverloc + string.Format("Games/{0}", game)))
client.CreateDirectory(serverloc + string.Format("Games/{0}", game));
client.UploadFile(fileStream, serverloc + string.Format("Games/{0}/app.js", game), true);
fileStream.Close();
Console.WriteLine("server ftp complete " + to);
#endif
}
}
示例2: Main
//.........这里部分代码省略.........
Console.WriteLine();
Console.SetCursorPosition(left, top);
};
string serverloc = ConfigurationSettings.AppSettings["server-ftpdir"];
string serverloc2 = ConfigurationSettings.AppSettings["server-web-ftpdir"];
Console.WriteLine("connecting server ftp");
SftpClient client = new SftpClient(ConfigurationSettings.AppSettings["server-ftpurl"], ConfigurationSettings.AppSettings["server-ftpusername"], ConfigurationSettings.AppSettings["server-ftppassword"]);
client.Connect();
Console.WriteLine("server connected");
#endif
foreach (var depend in depends) {
var to = pre + "\\" + llo + @"\output\" + depend.Key + ".js";
var output = "";
if (depend.Value.Node)
output += "require('./mscorlib.debug.js');\r\n";
else {
//output += "require('./mscorlib.debug.js');";
}
foreach (var depe in depend.Value.IncludesAfter) {
output += string.Format("require('{0}');\r\n", depe);
}
if (depend.Value.Postpend != null) output += depend.Value.Postpend + "\r\n";
var lines = new List<string>();
lines.Add(output);
lines.AddRange(File.ReadAllLines(to).After(1)); //mscorlib
string text = lines.Aggregate("", (a, b) => a + b + "\n");
File.WriteAllText(to, text);
// lines.Add(depend.Value.After);
var name = to.Split(new char[] {'\\'}, StringSplitOptions.RemoveEmptyEntries).Last();
// File.WriteAllText(to, text);
#if FTP
long length = new FileInfo(to).Length;
if (!webftp.FileExists(loc + name) || webftp.GetFileSize(loc + name) != length) {
Console.WriteLine("ftp start " + length.ToString("N0"));
webftp.Upload(loc + name, to);
Console.WriteLine("ftp complete " + to);
}
if (!client.Exists(serverloc + name) || client.GetAttributes(serverloc + name).Size != length) {
Console.WriteLine("server ftp start " + length.ToString("N0"));
var fileStream = new FileInfo(to).OpenRead();
client.UploadFile(fileStream, serverloc + name, true);
fileStream.Close();
Console.WriteLine("server ftp complete " + to);
}
if (!client.Exists(serverloc2 + name) || client.GetAttributes(serverloc2 + name).Size != length) {
Console.WriteLine("server ftp start " + length.ToString("N0"));
var fileStream = new FileInfo(to).OpenRead();
client.UploadFile(fileStream, serverloc2 + name, true);
fileStream.Close();
Console.WriteLine("server ftp complete " + to);
}
#endif
}
string[] games = {"ZombieGame" /*, "TowerD", "ZakGame" */};
foreach (var depend in games) {
var to = pre + llo + @"\output\Games\" + depend + @"\";
string[] exts = {"Client", "Common", "Server"};
foreach (var ext in exts) {
// lines.Add(depend.Value.After);
string fm = to + depend + "." + ext + ".js";
string text = File.ReadAllText(fm);
File.WriteAllText(fm, text);
#if FTP
Console.WriteLine("ftp start " + text.Length.ToString("N0"));
webftp.Upload(loc + "Games/" + depend + "/" + depend + "." + ext + ".js", fm);
Console.WriteLine("ftp complete " + fm);
Console.WriteLine("server ftp start " + text.Length.ToString("N0"));
var fileStream = new FileInfo(fm).OpenRead();
client.UploadFile(fileStream, serverloc + "Games/" + depend + "/" + depend + "." + ext + ".js", true);
fileStream.Close();
fileStream = new FileInfo(fm).OpenRead();
client.UploadFile(fileStream, serverloc2 + "Games/" + depend + "/" + depend + "." + ext + ".js", true);
fileStream.Close();
Console.WriteLine("server ftp complete " + fm);
#endif
}
}
}