C#中文件相关操作
来源:互联网 发布:flac整轨转分轨软件 编辑:程序博客网 时间:2024/05/04 19:57
class LangFileJs
{
public static ArrayList GetLangList()
{
string pathdir = GetLangDir();
ArrayList al = new ArrayList();
try
{
string[] fileList = Directory.GetFiles(pathdir);
foreach (string file in fileList)
{
al.Add(GetJustName(file));
}
}
catch
{
return null;
}
return al;
}
public static string GetJustName(string filepath)
{
int a = filepath.LastIndexOf('//') + 1;
int b = (filepath.LastIndexOf('.') != -1) ? filepath.LastIndexOf('.') : filepath.Length;
return filepath.Substring(filepath.LastIndexOf('//') + 1, b - a);
}
public static string GetLangDir()
{
return Globals.GetPhysicalPath("langManager//lang//");
}
public static string GetDefautLangFile()
{
return Globals.GetPhysicalPath("langManager//defaultlang.js");
}
public static bool CopyFile(string filename)
{
string pathdir=GetLangDir();
Random r = new Random(System.DateTime.Now.Second);
int ir = r.Next(10000);
while (File.Exists(pathdir + "//" + filename + "copy" + ir.ToString() + ".js"))
{
ir = r.Next(10000);
}
File.Copy(pathdir + "//" + filename + ".js", pathdir + "//" + filename + "copy"+ir.ToString()+".js");
return true;
}
public static bool DeleteFile(string filename)
{
string pathdir = GetLangDir();
File.Delete(pathdir + "//" + filename + ".js");
return true;
}
public static bool ReNameFile(string filename,string filename2)
{
string pathdir = GetLangDir();
if(File.Exists(pathdir + "//" + filename2 + ".js"))
return false;
File.Move(pathdir + "//" + filename + ".js", pathdir + "//" + filename2 + ".js");
return true;
}
public static bool ExistFile(string filename)
{
string pathdir = GetLangDir();
return File.Exists(pathdir + "//" + filename + ".js");
}
}
- C#中文件相关操作
- C#中文件操作
- c#中文件操作
- C#中文件与文件夹相关的操作
- c#中文件操作的一些相关函数
- C#中文件与文件夹相关的操作
- IOS 中文件相关操作
- C# 中文件的操作
- C#中文件操作整理
- C#字符串相关操作和文件操作
- C中文件操作相关函数
- Android中文件的相关操作.
- c语言中文件相关操作
- c# winform下文件操作相关<filedialog>
- C#中文件操作类FileUtil
- C#中文件操作【File】和【Directory】
- 黑马程序员C#中文件操作
- C#中文件监视的操作
- C#调用非托管DLL
- 大量java日期格式化、日期处理函数
- websphere的网络资料大全
- 制定软件项目测试计划的方法
- JSP+MySQL+Tomcat+Apache乱码解决一例
- C#中文件相关操作
- 多媒体通信中内容分发网络技术分析
- C++里怎样判断字符串中含有汉字
- 云计算与分布式计算
- 使用COLUMN函数编制单元信息
- VMware中安装Ubuntu后鼠标滚轮问题解决
- COOK100推荐:在家做新奥尔良烤翅的做法
- 从集中到分布,解读网络视频IT架构变迁
- Symbian 中各种提示、输入对话框的使用