using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using MSXML2;
using System.Text.RegularExpressions;
namespace wenweifeng
...{
/**//**//**//// <summary>
/// CaiJi 的摘要說明
/// </summary>
public class CaiJi
...{
public CaiJi()
...{
//
// TODO: 在此處添加構造函數邏輯
//
}
~CaiJi()
...{
Dispose();
}
public void Dispose()
...{
GC.SuppressFinalize(this);
}
日期隨機函數日期隨機函數#region 日期隨機函數
/**//**//**//**********************************
* 函數名稱:DateRndName
* 功能說明:日期隨機函數
* 參 數:ra:隨機數
* 調用示例:
* GetRemoteObj o = new GetRemoteObj();
* Random ra = new Random();
* string s = o.DateRndName(ra);
* Response.Write(s);
* o.Dispose();
* ********************************/
/**//**//**//// <summary>
/// 日期隨機函數
/// </summary>
/// <param name="ra">隨機數</param>
/// <returns></returns>
public string DateRndName(Random ra)
...{
DateTime d = DateTime.Now;
string s = null, y, m, dd, h, mm, ss;
y = d.Year.ToString();
m = d.Month.ToString();
if (m.Length < 2) m = "0" + m;
dd = d.Day.ToString();
if (dd.Length < 2) dd = "0" + dd;
h = d.Hour.ToString();
if (h.Length < 2) h = "0" + h;
mm = d.Minute.ToString();
if (mm.Length < 2) mm = "0" + mm;
ss = d.Second.ToString();
if (ss.Length < 2) ss = "0" + ss;
s += y + ',' + m + ',' + dd + ',' + h + "-" + mm + "-" + ss;
s += ra.Next(1000000, 9999999).ToString();
return s;
}
#endregion
取得文件後綴取得文件後綴#region 取得文件後綴
/**//**//**//**********************************
* 函數名稱:GetFileExtends
* 功能說明:取得文件後綴
* 參 數:filename:文件名稱
* 調用示例:
* GetRemoteObj o = new GetRemoteObj();
* string url = @"http://www.baidu.com/img/logo.gif";
* string s = o.GetFileExtends(url);
* Response.Write(s);
* o.Dispose();
* ********************************/
/**//**//**//// <summary>
/// 取得文件後綴
/// </summary>
/// <param name="filename">文件名稱</param>
/// <returns></returns>
public string GetFileExtends(string filename)
...{
string ext = null;
if (filename.IndexOf('.') > 0)
...{
string[] fs = filename.Split('.');
ext = fs[fs.Length - 1];
}
return ext;
}
#endregion