- 博客(0)
- 资源 (16)
- 收藏
- 关注
FTP操作类
源码己:http://git.oschina.net/kuiyu/dotnetcodes
说明:
推荐使用 edtFTPnet.dll
免费版本下载 http://.enterprisedt.com/products/edtftpnet/overview.html
文档 http://.enterprisedt.com/products/edtftpnet/doc/manual/index.html
实例:
using (var conn = new FTPConnection
{
ServerAddress = ftpserver.Server,
ServerDirectory = "web",
UserName = ftpserver.User,
Password = ftpserver.Pwd,
ServerPort=int.Parse(ftpserver.Port),
CommandEncoding = Encoding.GetEncoding("GBK")
})
{
try
{
conn.Connect();
string ftpdir = string.Format("/images/product/{0}/{1}/{2}/", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
if (!conn.DirectoryExists(ftpdir))
conn.CreateDirectory(ftpdir);
conn.ChangeWorkingDirectory(ftpdir);
conn.UploadFile(Server.MapPath(dir) + newfilename, newfilename); //上传原图
string thumbnailFileName = System.IO.Path.GetFileName(gdsImg.Thumbnail); //缩略图文件名
conn.UploadFile(Server.MapPath(dir) + thumbnailFileName, thumbnailFileName);
}
catch (FtpException e)
{
//记录日志 Console.WriteLine(String.Format("FTP Error: {0} {1}", e.ErrorCode, e.Message));
}
}
2018-08-28
NPOI导入导出Excel
支持NPOI导入导出Excel表格中
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
public static DataTable GetDataTable(string filepath)
{
var dt = new DataTable("xls");
if (filepath.Last()=='s')
{
dt = x2003.ExcelToTableForXLS(filepath);
}
else
{
dt = x2007.ExcelToTableForXLSX(filepath);
}
return dt;
}
2018-08-28
表白代码,c#程序员
用于撩妹Heart = function() {
// x = 16 sin^3 t
// y = 13 cos t - 5 cos 2t - 2 cos 3t - cos 4t
// http://www.wolframalpha.com/input/?i=x+=+16+sin^3+t,+y+=+(13+cos+t+-+5+cos+2t+-+2+cos+3t+-+cos+4t)
var points = [], x, y, t;
for (var i = 10; i < 30; i += 0.2) {
t = i / Math.PI;
x = 16 * Math.pow(Math.sin(t), 3);
y = 13 * Math.cos(t) - 5 * Math.cos(2 * t) - 2 * Math.cos(3 * t) - Math.cos(4 * t);
points.push(new Point(x, y));
}
this.points = points;
this.length = points.length;
}
Heart.prototype = {
get: function(i, scale) {
return this.points[i].mul(scale || 1);
}
}
Seed = function(tree, point, scale, color) {
this.tree = tree;
var scale = scale || 1
var color = color || '#FF0000';
this.heart = {
point : point,
scale : scale,
color : color,
figure : new Heart(),
}
this.cirle = {
point : point,
scale : scale,
color : color,
radius : 5,
}
}
2018-08-28
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人