📄 insidestaticlabel.cs
字号:
namespace PowerEasy.Templates
{
using PowerEasy.Accessories;
using PowerEasy.Common;
using PowerEasy.CommonModel;
using PowerEasy.Components;
using PowerEasy.Contents;
using PowerEasy.DalFactory;
using PowerEasy.Enumerations;
using PowerEasy.IDal.Contents;
using PowerEasy.Model.CommonModel;
using PowerEasy.Model.Contents;
using PowerEasy.Model.TemplateProc;
using PowerEasy.Model.UserManage;
using PowerEasy.UserManage;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Xml;
public class InsideStaticLabel : IInsideStaticLabel
{
private int ranNum;
public string ADdir()
{
return this.SiteOptionInfo.AdvertisementDir;
}
public string Banner()
{
return this.SiteInfo.BannerUrl;
}
public static string ConversionCode(string content)
{
string input = PathReplaceLable(content);
StringBuilder builder = new StringBuilder();
string pattern = @"\<\!\-\-Code\-\-\>([\s\S]*?)\<\!\-\-Code\-\-\>";
MatchCollection matchs = Regex.Matches(input, pattern, RegexOptions.IgnoreCase);
if (matchs.Count > 0)
{
foreach (Match match in matchs)
{
if (builder.Length > 0)
{
builder.Append("[PE:Code]" + match.Value);
}
else
{
builder.Append(match.Value);
}
input = input.Replace(match.Value, "[PE:Code]");
}
foreach (string str3 in builder.ToString().Split(new string[] { "[PE:Code]" }, StringSplitOptions.RemoveEmptyEntries))
{
input = input.Replace("[PE:Code]", str3);
}
}
return input;
}
public string Convert2Char(string a1, string a2)
{
StringBuilder builder = new StringBuilder();
try
{
int num = Convert.ToInt32(a1);
for (int i = 0; i < num; i++)
{
builder.Append(a2);
}
}
catch (FormatException)
{
builder = new StringBuilder("参数应该为数字");
}
return builder.ToString();
}
public int Convert2Int(string a1)
{
return DataConverter.CLng(a1);
}
public string Convert2JS(string a1)
{
StringBuilder builder = new StringBuilder(string.Empty);
if (!string.IsNullOrEmpty(a1))
{
string[] strArray = a1.Replace(@"\", @"\\").Replace("/", @"\/").Replace("'", @"\'").Replace("\"", "\\\"").Split(new char[] { '\n' });
for (int i = 0; i < strArray.Rank; i++)
{
builder.Append("document.writeln(\"" + strArray.GetValue(i).ToString() + "\");\n");
}
}
return builder.ToString();
}
public string ConvertAbsolutePath(string path)
{
return Utility.ConvertAbsolutePath(this.UpLoadDir(), path);
}
public string ConverToWeek(string a1)
{
string str = string.Empty;
if (string.IsNullOrEmpty(a1))
{
return str;
}
try
{
return Convert.ToDateTime(a1).DayOfWeek.ToString();
}
catch (InvalidCastException)
{
return "日期格式错误";
}
}
public string ConvertSizeToShow(string fileSize)
{
decimal num = DataConverter.CDecimal(fileSize) * 1024M;
decimal num2 = num / 1024M;
if (num2 < 1M)
{
return "B";
}
if (num2 < 1024M)
{
return "KB";
}
decimal num3 = num2 / 1024M;
if (num3 < 1M)
{
return "KB";
}
if (num3 >= 1024M)
{
num3 /= 1024M;
return "GB";
}
return "MB";
}
public string ConvertSoftSize(string fileSize)
{
decimal num = DataConverter.CDecimal(fileSize) * 1024M;
decimal num2 = num / 1024M;
if (num2 < 1M)
{
return num.ToString("0.00");
}
if (num2 < 1024M)
{
return num2.ToString("0.00");
}
decimal num3 = num2 / 1024M;
if (num3 < 1M)
{
return num2.ToString("0.00");
}
if (num3 >= 1024M)
{
num3 /= 1024M;
return num3.ToString("0.00");
}
return num3.ToString("0.00");
}
public string Copyright()
{
return this.SiteInfo.Copyright;
}
public string CreateHtmlPath()
{
return this.SiteOptionInfo.CreateHtmlPath;
}
public string CutText(string oringstr, string len, string substr)
{
int length = DataConverter.CLng(len);
return StringHelper.SubString(oringstr, length, substr);
}
public string EnableComment(int id)
{
if (PowerEasy.Contents.Nodes.GetCacheNodeById(DataConverter.CLng(id)).Settings.EnableComment)
{
return "true";
}
return "false";
}
public string EnableTouristsComment(int id)
{
if (PowerEasy.Contents.Nodes.GetCacheNodeById(DataConverter.CLng(id)).Settings.EnableTouristsComment)
{
return "true";
}
return "false";
}
public string EncodeText(string a1, string a2)
{
string str2;
string str = string.Empty;
if (string.IsNullOrEmpty(a2) || ((str2 = a2) == null))
{
return str;
}
if (!(str2 == "md5_16"))
{
if (str2 != "md5_32")
{
if (str2 == "enbase64")
{
return StringHelper.Base64StringEncode(a1);
}
if (str2 == "debase64")
{
return StringHelper.Base64StringDecode(a1);
}
if (str2 == "htmlencode")
{
return HttpUtility.HtmlEncode(a1);
}
if (str2 != "htmldecode")
{
return str;
}
return HttpUtility.HtmlDecode(a1);
}
}
else
{
return StringHelper.MD5(a1).Substring(8, 0x10);
}
return StringHelper.MD5(a1);
}
private static string ex34850value(string s)
{
switch (s)
{
case "0":
return "Not defined";
case "1":
return "手动";
case "2":
return "自动";
case "3":
return "Aperture priority";
case "4":
return "Shutter priority";
case "5":
return "Creative program (biased toward depth of field)";
case "6":
return "Action program (biased toward fast shutter speed)";
case "7":
return "Portrait mode (for closeup photos with the background out of focus)";
case "8":
return " Landscape mode (for landscape photos with the background in focus)";
}
return "其他模式";
}
private static string ex37384value(string s)
{
switch (s)
{
case "0":
return "未知";
case "1":
return "日光";
case "2":
return "日光灯";
case "3":
return "白炽灯";
case "4":
return "闪光灯";
case "9":
return "晴天";
case "10":
return "多云";
case "11":
return "阴天";
case "12":
return "Daylight fluorescent (D 5700 - 7100K)";
case "13":
return "Day white fluorescent (N 4600 - 5400K)";
case "14":
return "Cool white fluorescent (W 3900 - 4500K)";
case "15":
return "White fluorescent (WW 3200 - 3700K)";
case "17":
return "Standard light A";
case "18":
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -