Global.cs
资源名称:MobileRss.rar [点击查看]
上传用户:xtyqhl
上传日期:2022-06-07
资源大小:212k
文件大小:3k
源码类别:
Windows Mobile
开发平台:
Windows_Unix
- /****************************************************************
- ** 文件名:Global.cs
- ** 创建人:李万龙
- ** 联 系:shenlongju@hotmail.com
- ** 日 期:2008-05-05
- ** 描 述:全局静态方法.
- ** 修改人:
- ** 日 期:
- ** 描 述:
- ** 版 本:1.0.0.0
- ** Copyright (c) 2007-2008 3ESoft
- ******************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Windows.Forms;
- using System.IO;
- namespace _3ESoft.WindowsMobile.RSS
- {
- public class Global
- {
- /// <summary>
- /// 格式化新闻文件地址为:地址+文件名
- /// </summary>
- /// <param name="RSSUrl"></param>
- /// <returns>本地路径</returns>
- public static string FormatUrl(string RSSUrl)
- {
- string FilePath = AppRssDataPath();
- RSSUrl = RSSUrl.Replace("%", "");
- RSSUrl = RSSUrl.Replace("?", "");
- RSSUrl = RSSUrl.Replace("/", "");
- RSSUrl = RSSUrl.Replace(".", "");
- RSSUrl = RSSUrl.Replace("http", "");
- RSSUrl = RSSUrl.Replace(":", "");
- FilePath += RSSUrl + ".img";
- return FilePath;
- }
- /// <summary>
- /// 本地RSS缓存目录
- /// </summary>
- /// <returns></returns>
- public static string AppRssDataPath()
- {
- string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"3ESoftRSSData";
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- return path;
- }
- /// <summary>
- /// 应用RSS显示格式目录
- /// </summary>
- /// <returns></returns>
- public static string AppRssStylePath()
- {
- string path = ApplicationPath() + @"Style";
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- return path;
- }
- /// <summary>
- /// 安装的配制文件目录
- /// </summary>
- /// <returns></returns>
- public static string AppRssConfigFilePath()
- {
- string path = ApplicationPath()+ @"Config";
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- return path;
- }
- /// <summary>
- /// 应用程序执行目录
- /// 根据PPC还是SP应该不同
- /// </summary>
- /// <returns></returns>
- static string ApplicationPath()
- {
- return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
- }
- }
- }