本文整理汇总了C#中SiteConfig类的典型用法代码示例。如果您正苦于以下问题:C# SiteConfig类的具体用法?C# SiteConfig怎么用?C# SiteConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SiteConfig类属于命名空间,在下文中一共展示了SiteConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAll
public SiteConfig GetAll()
{
List<Option> options = _options.ToList();
var model = new SiteConfig
{
AdminEmail = options.Where(op => op.Name.Equals("AdminEmail")).FirstOrDefault().Value,
BlogDescription = options.Where(op => op.Name.Equals("BlogDescription")).FirstOrDefault().Value,
BlogKeywords = options.Where(op => op.Name.Equals("BlogKeywords")).FirstOrDefault().Value,
BlogName = options.Where(op => op.Name.Equals("BlogName")).FirstOrDefault().Value,
CommentsNotify =
Convert.ToBoolean(options.Where(op => op.Name.Equals("CommentsNotify")).FirstOrDefault().Value),
CommentModeratingStatus =
Convert.ToBoolean(options.Where(op => op.Name.Equals("CommentModeratingStatus"))
.FirstOrDefault().Value),
MailServerLogin = options.Where(op => op.Name.Equals("MailServerLogin")).FirstOrDefault().Value,
MailServerPass = options.Where(op => op.Name.Equals("MailServerPass")).FirstOrDefault().Value,
MailServerPort =
Convert.ToInt32(options.Where(op => op.Name.Equals("MailServerPort")).FirstOrDefault().Value),
MailServerUrl = options.Where(op => op.Name.Equals("MailServerUrl")).FirstOrDefault().Value,
PostPerPage =
Convert.ToInt32(options.Where(op => op.Name.Equals("PostPerPage")).FirstOrDefault().Value),
SiteUrl = options.Where(op => op.Name.Equals("SiteUrl")).FirstOrDefault().Value,
UsersCanRegister = Convert.ToBoolean(options.Where(op => op.Name.Equals("UsersCanRegister"))
.FirstOrDefault().Value)
};
return model;
}
示例2: ApplyClickThrough
public static string ApplyClickThrough( SiteConfig siteConfig, string entryId, string content )
{
if ( siteConfig.EnableClickThrough && content != null && !SiteSecurity.IsValidContributor())
{
StringBuilder contentSb = new StringBuilder();
int currentIndex = 0;
foreach( Match match in FindHyperLinks(content) )
{
contentSb.Append(content.Substring(currentIndex,match.Index-currentIndex));
currentIndex = match.Index+match.Length;
if(!match.Groups["postfix"].Value.Equals("\""))
{
// Patched with the {4} to avoid duplicated quotes at the end of the href
contentSb.AppendFormat("<a{0} href=\"{1}&url={2}{4}{3}>",
match.Groups["prefix"].Value,GetClickThroughUrl(siteConfig, entryId),
HttpUtility.UrlEncode(HttpUtility.HtmlDecode(match.Groups["link"].Value)),
match.Groups["postfix"].Value,
(match.Groups["postfix"].Value.StartsWith("\"") ? "" : "\""));
}
else
{
contentSb.AppendFormat("<a{0} href=\"{1}&url={2}\">",
match.Groups["prefix"].Value,GetClickThroughUrl(siteConfig, entryId),
HttpUtility.UrlEncode(HttpUtility.HtmlDecode(match.Groups["link"].Value)));
}
}
contentSb.Append(content.Substring(currentIndex));
content = contentSb.ToString();
}
return content;
}
示例3: PingbackAPI
public PingbackAPI()
{
siteConfig = SiteConfig.GetSiteConfig();
logDataService = LoggingDataServiceFactory.GetService(SiteConfig.GetLogPathFromCurrentContext());
dataService = BlogDataServiceFactory.GetService(SiteConfig.GetContentPathFromCurrentContext(), logDataService);
}
示例4: SiteControllerBase
public SiteControllerBase()
{
Config = new SiteConfig();
ViewBag.Config = Config;
ViewBag.StylesheetUrls = Repository.Stylesheets.Select(u => Url.Action("display", "upload", new { category = u.Category, fileName = u.FileName }));
ViewBag.LegacyStylesheetUrls = Repository.LegacyStylesheets.Select(u => Url.Action("display", "upload", new { category = u.Category, fileName = u.FileName }));
ViewBag.ScriptUrls = Repository.Scripts.Select(u => Url.Action("display", "upload", new { category = u.Category, fileName = u.FileName }));
}
示例5: Index
public virtual ActionResult Index(SiteConfig model)
{
_optionService.Update(model);
_uow.SaveChanges();
_cacheService.RemoveSiteConfig();
return PartialView(MVC.Admin.Shared.Views._Alert, new Alert
{
Message = "تنظیمات سایت با موفقیت به روز رسانی شد",
Mode = AlertMode.Success
});
}
示例6: SerializeTest
public void SerializeTest(){
SiteConfig config = new SiteConfig();
XmlSerializer ser = new XmlSerializer(typeof(SiteConfig));
using( StringWriter writer = new StringWriter() ){
ser.Serialize( writer, config );
//Debug.Write( writer.ToString() );
}
}
示例7: ShowInfo
private void ShowInfo()
{
SiteConfig bll = new SiteConfig();
Com_Config model = bll.loadConfig(Utils.GetXmlMapPath(LoneuKeys.FILE_SITE_XML_CONFING));
webname.Text = model.webname;
webcompany.Text = model.webcompany;
weburl.Text = model.weburl;
webtel.Text = model.webtel;
webfax.Text = model.webfax;
webmail.Text = model.webmail;
webcrod.Text = model.webcrod;
webtitle.Text = model.webtitle;
webkeyword.Text = model.webkeyword;
webdescription.Text = model.webdescription;
webcopyright.Text = model.webcopyright;
emailstmp.Text = model.emailstmp;
emailport.Text = model.emailport.ToString();
emailfrom.Text = model.emailfrom;
emailusername.Text = model.emailusername;
if (!string.IsNullOrEmpty(model.emailpassword))
{
emailpassword.Attributes["value"] = defaultpassword;
}
emailnickname.Text = model.emailnickname;
attachpath.Text = model.attachpath;
attachextension.Text = model.attachextension;
attachsave.SelectedValue = model.attachsave.ToString();
attachfilesize.Text = model.attachfilesize.ToString();
attachimgsize.Text = model.attachimgsize.ToString();
attachimgmaxheight.Text = model.attachimgmaxheight.ToString();
attachimgmaxwidth.Text = model.attachimgmaxwidth.ToString();
thumbnailheight.Text = model.thumbnailheight.ToString();
thumbnailwidth.Text = model.thumbnailwidth.ToString();
watermarktype.SelectedValue = model.watermarktype.ToString();
watermarkposition.Text = model.watermarkposition.ToString();
watermarkimgquality.Text = model.watermarkimgquality.ToString();
watermarkpic.Text = model.watermarkpic;
watermarktransparency.Text = model.watermarktransparency.ToString();
watermarktext.Text = model.watermarktext;
watermarkfont.Text = model.watermarkfont;
watermarkfontsize.Text = model.watermarkfontsize.ToString();
}
示例8: ExecuteCmdlet
public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
SiteConfig siteConfig = null;
string location = null;
switch (ParameterSetName)
{
case ParameterSet1Name:
WebApp = WebsitesClient.GetWebApp(ResourceGroupName, Name, Slot);
location = WebApp.Location;
var parameters = new HashSet<string>(MyInvocation.BoundParameters.Keys, StringComparer.OrdinalIgnoreCase);
if (parameters.Any(p => CmdletHelpers.SiteConfigParameters.Contains(p)))
{
siteConfig = new SiteConfig
{
DefaultDocuments = parameters.Contains("DefaultDocuments") ? DefaultDocuments : null,
NetFrameworkVersion = parameters.Contains("NetFrameworkVersion") ? NetFrameworkVersion : null,
PhpVersion = parameters.Contains("PhpVersion") ? PhpVersion : null,
RequestTracingEnabled =
parameters.Contains("RequestTracingEnabled") ? (bool?)RequestTracingEnabled : null,
HttpLoggingEnabled = parameters.Contains("HttpLoggingEnabled") ? (bool?)HttpLoggingEnabled : null,
DetailedErrorLoggingEnabled =
parameters.Contains("DetailedErrorLoggingEnabled") ? (bool?)DetailedErrorLoggingEnabled : null,
HandlerMappings = parameters.Contains("HandlerMappings") ? HandlerMappings : null,
ManagedPipelineMode =
parameters.Contains("ManagedPipelineMode")
? (ManagedPipelineMode?)Enum.Parse(typeof(ManagedPipelineMode), ManagedPipelineMode)
: null,
WebSocketsEnabled = parameters.Contains("WebSocketsEnabled") ? (bool?)WebSocketsEnabled : null,
Use32BitWorkerProcess =
parameters.Contains("Use32BitWorkerProcess") ? (bool?)Use32BitWorkerProcess : null
};
}
// Update web app configuration
WebsitesClient.UpdateWebAppConfiguration(ResourceGroupName, location, Name, Slot, siteConfig, AppSettings.ConvertToStringDictionary(), ConnectionStrings.ConvertToConnectionStringDictionary());
if (parameters.Contains("AppServicePlan"))
{
WebsitesClient.UpdateWebApp(ResourceGroupName, location, Name, Slot, AppServicePlan);
}
break;
case ParameterSet2Name:
// Web app is direct or pipeline input
string servicePlanName;
string rg;
location = WebApp.Location;
siteConfig = WebApp.SiteConfig;
// Update web app configuration
WebsitesClient.UpdateWebAppConfiguration(ResourceGroupName, location, Name, Slot, siteConfig, WebApp.SiteConfig == null ? null : WebApp.SiteConfig.AppSettings.ToDictionary(nvp => nvp.Name, nvp => nvp.Value, StringComparer.OrdinalIgnoreCase), WebApp.SiteConfig == null ? null : WebApp.SiteConfig.ConnectionStrings.ToDictionary(nvp => nvp.Name, nvp => new ConnStringValueTypePair { Type = nvp.Type, Value = nvp.ConnectionString }, StringComparer.OrdinalIgnoreCase));
CmdletHelpers.TryParseAppServicePlanMetadataFromResourceId(WebApp.ServerFarmId, out rg, out servicePlanName);
WebsitesClient.UpdateWebApp(ResourceGroupName, location, Name, Slot, servicePlanName);
break;
}
WriteObject(WebsitesClient.GetWebApp(ResourceGroupName, Name, Slot));
}
示例9: createSiteConfigWithFilter
private SiteConfig createSiteConfigWithFilter(string expression, string mapTo, bool isRegularExpression)
{
SiteConfig siteConfig = new SiteConfig();
siteConfig.ContentFilters.Add(createContentFilter(expression, mapTo, isRegularExpression));
return siteConfig;
}
示例10: UpdateEntry
public static EntrySaveState UpdateEntry(Entry entry, string trackbackUrl, CrosspostInfoCollection crosspostList, SiteConfig siteConfig, ILoggingDataService logService, IBlogDataService dataService)
{
return SiteUtilities.UpdateEntry(entry,trackbackUrl,crosspostList,siteConfig,logService,dataService);
}
示例11: UpdateSiteConfig
public static void UpdateSiteConfig(this IWebsitesServiceManagement proxy, string subscriptionName, string webspaceName, string name, SiteConfig siteConfig)
{
proxy.EndUpdateSiteConfig(proxy.BeginUpdateSiteConfig(subscriptionName, webspaceName, name, siteConfig, null, null));
}
示例12: UpdateSiteConfig
public void UpdateSiteConfig(SiteConfig siteConfig)
{
SiteConfig currentSiteConfig = SiteConfig.GetSiteConfig();
if ( !currentSiteConfig.EnableConfigEditService )
{
throw new ServiceDisabledException();
}
if (authenticationHeader == null ||
SiteSecurity.Login(authenticationHeader.userName, authenticationHeader.password).Role != "admin")
{
throw new Exception("Invalid Password");
}
XmlSerializer ser = new XmlSerializer(typeof(SiteConfig));
using (StreamWriter writer = new StreamWriter(SiteConfig.GetConfigFilePathFromCurrentContext()))
{
ser.Serialize(writer, siteConfig);
}
}
示例13: ToSiteConfig
internal static SiteConfig ToSiteConfig(this WebSiteGetConfigurationResponse getConfigResponse)
{
var config = new SiteConfig
{
NumberOfWorkers = getConfigResponse.NumberOfWorkers,
DefaultDocuments = getConfigResponse.DefaultDocuments.ToArray(),
NetFrameworkVersion = getConfigResponse.NetFrameworkVersion,
PhpVersion = getConfigResponse.PhpVersion,
RequestTracingEnabled = getConfigResponse.RequestTracingEnabled,
HttpLoggingEnabled = getConfigResponse.HttpLoggingEnabled,
DetailedErrorLoggingEnabled = getConfigResponse.DetailedErrorLoggingEnabled,
PublishingUsername = getConfigResponse.PublishingUserName,
PublishingPassword = getConfigResponse.PublishingPassword,
AppSettings = getConfigResponse.AppSettings.Select(ToNameValuePair).ToList(),
Metadata = getConfigResponse.Metadata.Select(ToNameValuePair).ToList(),
ConnectionStrings = new ConnStringPropertyBag(
getConfigResponse.ConnectionStrings.Select(cs => new ConnStringInfo
{
ConnectionString = cs.ConnectionString,
Name = cs.Name,
Type = (DatabaseType)Enum.Parse(typeof(DatabaseType), cs.Type)
}).ToList()),
HandlerMappings = getConfigResponse.HandlerMappings.Select(hm => new HandlerMapping
{
Arguments = hm.Arguments,
Extension = hm.Extension,
ScriptProcessor = hm.ScriptProcessor
}).ToArray(),
ManagedPipelineMode = getConfigResponse.ManagedPipelineMode,
WebSocketsEnabled = getConfigResponse.WebSocketsEnabled,
RemoteDebuggingEnabled = getConfigResponse.RemoteDebuggingEnabled,
RemoteDebuggingVersion = getConfigResponse.RemoteDebuggingVersion.GetValueOrDefault()
};
return config;
}
示例14: SyndicationServiceExperimentalImplementation
public SyndicationServiceExperimentalImplementation(SiteConfig siteConfig, IBlogDataService dataService, ILoggingDataService loggingService):
base( siteConfig, dataService, loggingService )
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
示例15: SendEmailReport
public void SendEmailReport(DateTime reportDate, SiteConfig siteConfig, IBlogDataService dataService, ILoggingDataService loggingService)
{
MailMessage emailMessage = new MailMessage();
if ( siteConfig.NotificationEMailAddress != null && siteConfig.NotificationEMailAddress.Length > 0 )
{
emailMessage.To.Add(siteConfig.NotificationEMailAddress);
}
else
{
emailMessage.To.Add(siteConfig.Contact);
}
emailMessage.Subject = String.Format("Weblog Daily Activity Report for '{0}'", reportDate.ToLongDateString());
emailMessage.Body = GenerateReportEmailBody(reportDate);
emailMessage.IsBodyHtml = true;
emailMessage.BodyEncoding = System.Text.Encoding.UTF8;
emailMessage.From = new MailAddress(siteConfig.Contact);
SendMailInfo sendMailInfo = new SendMailInfo(emailMessage, siteConfig.SmtpServer,
siteConfig.EnableSmtpAuthentication, siteConfig.UseSSLForSMTP, siteConfig.SmtpUserName, siteConfig.SmtpPassword, siteConfig.SmtpPort);
dataService.AddTracking(null, sendMailInfo ); // use this with null tracking object, just to get the email sent
loggingService.AddEvent( new EventDataItem( EventCodes.ReportMailerReportSent,"",""));
}