一种是http请求的方式,另一种就是提供WebService接口供调用的。
一种是http请求的方式,另一种就是提供WebService接口供调用的。
更新:2013-12-29
今天维护了一台某公司的网站服务器,就是访问文件突然不存在了,花了些时间看了一下,原因如下:
Global.asax 被改,变成了系统文件,还隐藏了。。
操作类:
using System;
using System.Data;
using System.Text.RegularExpressions;
using System.Xml;
using System.IO;
using System.Collections;
using System.Data.SQLite;
using System.Configuration;//添加.net引用
namespace Tools.Common
{
/// <summary>
/// 对SQLite操作的类
/// 引用:System.Data.SQLite.dll【版本:3.6.23.1(原始文件名:SQlite3.DLL)】
/// </summary>
public class SQLiteHelper
{
/// <summary>
/// 所有成员函数都是静态的,构造函数定义为私有
/// </summary>
private SQLiteHelper()
{
}
/// <summary>
/// 连接字符串
/// </summary>
public static string ConnectionString
{//"Data Source=Test.db3;Pooling=true;FailIfMissing=false";
get
{
////(AppSettings节点下的"SQLiteConnectionString")
string text = ConfigurationManager.AppSettings["SQLiteConnectionString"];
string str2 = ConfigurationManager.AppSettings["IsEncrypt"];
if (str2 == "true")
{
text = DesEncrypt.Decrypt(text);
}
return text;
}
}
private static SQLiteConnection _Conn = null;处理类:
public string ToString(UserGiftCardModel model)
{
if (model == null) return "";
string sb = "";
Type type =model.GetType() ;//assembly.GetType("Reflect_test.PurchaseOrderHeadManageModel", true, true); //命名空间名称 + 类名
//创建类的实例
//object obj = Activator.CreateInstance(type, true);
//获取公共属性
PropertyInfo[] Propertys = type.GetProperties();code:
static void Main(string[] args)
{
Console.WriteLine("本程序去掉当前目录及子目录下的文件前缀");
Console.Write("请输入要去掉的前缀:");
string stringFront = Console.ReadLine();
if (stringFront != "")
{
string dir = AppDomain.CurrentDomain.BaseDirectory;
RenameFile(dir, stringFront);
}
else Console.WriteLine("请输入要去掉的前缀!");
Console.WriteLine("操作已完成");
Console.ReadKey();
}
public static void RenameFile(string ParentDir,string stringFront)
{
string[] files = Directory.GetFiles(ParentDir, "*.cs", SearchOption.TopDirectoryOnly);
foreach (string file in files)
{
string filename = Path.GetFileName(file);
string pathname = Path.GetDirectoryName(file);
if (filename.StartsWith(stringFront, true, null))
{
filename = filename.Substring(stringFront.Length);
FileInfo fi = new FileInfo(file);
fi.MoveTo(Path.Combine(pathname,filename));
}
}
string[] dirs = Directory.GetDirectories(ParentDir);
foreach(string dir in dirs)
{
RenameFile(dir,stringFront);
}
}code:
class Program
{
static void Main(string[] args)
{
try
{
replacefile rf = new replacefile();
rf.doReplace(@"F:c1");
rf.doReplace(@"F:c2");
rf.doReplace(@"F:c3");
Console.WriteLine("替换完成!");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
public class replacefile
{
public string sourceFilejs = @"F:frmleftdown.js";//源文件
public string sourceFilexml = @"F:frmleftdown.xml";//源文件
public void doReplace(string parentPath)
{
string[] files = Directory.GetFiles(parentPath);
foreach (string f in files)
{
if (f=="frmleftdown.js") File.Copy(sourceFilejs, f, true);//替换目录下所有的同名文件
if (f=="frmleftdown.xml") File.Copy(sourceFilexml, f, true);
}
string[] subdirs = Directory.GetDirectories(parentPath);
foreach (string subdir in subdirs)
{
doReplace(subdir);
}
}
}
原始数据:
数据库(数据库名为test)中表的内容:
Powered By Z-BlogPHP 1.7.3
Copyright 2024-2027 pukuimin Rights Reserved.
粤ICP备17100155号