本文整理汇总了C#中System.Collections.Specialized.StringDictionary类的典型用法代码示例。如果您正苦于以下问题:C# StringDictionary类的具体用法?C# StringDictionary怎么用?C# StringDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringDictionary类属于System.Collections.Specialized命名空间,在下文中一共展示了StringDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendByMail
/// <summary>
/// Sends an error message by opening the user's mail client.
/// </summary>
/// <param name="recipient"></param>
/// <param name="subject"></param>
/// <param name="ex"></param>
/// <param name="assembly">The assembly where the error originated. This will
/// be used to extract version information.</param>
public static void SendByMail(string recipient, string subject, Exception ex,
Assembly assembly, StringDictionary additionalInfo)
{
string attributes = GetAttributes(additionalInfo);
StringBuilder msg = new StringBuilder();
msg.AppendLine("[ Please send this as plain text to allow automatic pre-processing ]");
msg.AppendLine();
msg.AppendLine(GetMessage(ex));
msg.AppendLine();
msg.AppendLine(GetAttributes(additionalInfo));
msg.AppendLine();
msg.AppendLine("[ Please send this as plain text to allow automatic pre-processing ]");
msg.AppendLine();
string command = string.Format("mailto:{0}?subject={1}&body={2}",
recipient,
Uri.EscapeDataString(subject),
Uri.EscapeDataString(msg.ToString()));
Debug.WriteLine(command);
Process p = new Process();
p.StartInfo.FileName = command;
p.StartInfo.UseShellExecute = true;
p.Start();
}
示例2: access_token
public static async Task<string> access_token(TwitterContext twitterContext, string oauth_verifier)
{
StringDictionary query = new StringDictionary();
query["oauth_verifier"] = oauth_verifier;
return await new TwitterRequest(twitterContext, API.Methods.POST, new Uri(API.Urls.Oauth_AccessToken), query).Request();
}
示例3: Execute
/// <summary>
/// Runs the specified command.
/// </summary>
/// <param name="command">The command.</param>
/// <param name="keyValues">The key values.</param>
/// <param name="output">The output.</param>
/// <returns></returns>
public override int Execute(string command, StringDictionary keyValues, out string output)
{
output = string.Empty;
string url = Params["url"].Value.TrimEnd('/');
using (SPSite site = new SPSite(url))
{
using (SPWeb web = site.AllWebs[Utilities.GetServerRelUrlFromFullUrl(url)])
{
foreach (SPLanguage lang in web.RegionalSettings.InstalledLanguages)
{
foreach (SPWebTemplate template in site.GetWebTemplates((uint)lang.LCID))
{
output += template.Name + " = " + template.Title + " (" + lang.LCID + ")\r\n";
}
foreach (SPWebTemplate template in site.GetCustomWebTemplates((uint)lang.LCID))
{
output += template.Name + " = " + template.Title + " (Custom)(" + lang.LCID + ")\r\n";
}
}
}
}
return (int)ErrorCodes.NoError;
}
示例4: OnDownload
public void OnDownload(Series series, EpisodeFile episodeFile, string sourcePath, CustomScriptSettings settings)
{
var environmentVariables = new StringDictionary();
environmentVariables.Add("Sonarr_EventType", "Download");
environmentVariables.Add("Sonarr_Series_Id", series.Id.ToString());
environmentVariables.Add("Sonarr_Series_Title", series.Title);
environmentVariables.Add("Sonarr_Series_Path", series.Path);
environmentVariables.Add("Sonarr_Series_TvdbId", series.TvdbId.ToString());
environmentVariables.Add("Sonarr_EpisodeFile_Id", episodeFile.Id.ToString());
environmentVariables.Add("Sonarr_EpisodeFile_RelativePath", episodeFile.RelativePath);
environmentVariables.Add("Sonarr_EpisodeFile_Path", Path.Combine(series.Path, episodeFile.RelativePath));
environmentVariables.Add("Sonarr_EpisodeFile_SeasonNumber", episodeFile.SeasonNumber.ToString());
environmentVariables.Add("Sonarr_EpisodeFile_EpisodeNumbers", string.Join(",", episodeFile.Episodes.Value.Select(e => e.EpisodeNumber)));
environmentVariables.Add("Sonarr_EpisodeFile_EpisodeAirDates", string.Join(",", episodeFile.Episodes.Value.Select(e => e.AirDate)));
environmentVariables.Add("Sonarr_EpisodeFile_EpisodeAirDatesUtc", string.Join(",", episodeFile.Episodes.Value.Select(e => e.AirDateUtc)));
environmentVariables.Add("Sonarr_EpisodeFile_Quality", episodeFile.Quality.Quality.Name);
environmentVariables.Add("Sonarr_EpisodeFile_QualityVersion", episodeFile.Quality.Revision.Version.ToString());
environmentVariables.Add("Sonarr_EpisodeFile_ReleaseGroup", episodeFile.ReleaseGroup ?? string.Empty);
environmentVariables.Add("Sonarr_EpisodeFile_SceneName", episodeFile.SceneName ?? string.Empty);
environmentVariables.Add("Sonarr_EpisodeFile_SourcePath", sourcePath);
environmentVariables.Add("Sonarr_EpisodeFile_SourceFolder", Path.GetDirectoryName(sourcePath));
ExecuteScript(environmentVariables, settings);
}
示例5: Args
public Args(string[] args)
{
argDict = new StringDictionary();
Regex regEx = new Regex(@"^-", RegexOptions.IgnoreCase | RegexOptions.Compiled);
Regex regTrim = new Regex(@"^['""]?(.*?)['""]?$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
string arg = "";
string[] chunks;
foreach (string s in args)
{
chunks = regEx.Split(s, 3);
if (regEx.IsMatch(s))
{
arg = chunks[1];
argDict.Add(arg, "true");
}
else
{
if (argDict.ContainsKey(arg))
{
chunks[0] = regTrim.Replace(chunks[0], "$1");
argDict.Remove(arg);
argDict.Add(arg, chunks[0]);
arg = "";
}
}
}
}
示例6: SandcastleToolBase
/// <summary>
/// Initializes a new instance of the <see cref="SandcastleToolBase"/> class.
/// </summary>
public SandcastleToolBase()
{
EnviromentVariables = new StringDictionary();
SandcastleEnviroment = new SandcastleEnviroment();
EnviromentVariables["DXROOT"] = SandcastleEnviroment.SandcastleRoot;
}
示例7: SimpleElement
public SimpleElement(String tagName)
{
this.tagName = tagName;
attrib = new StringDictionary();
childElems = new SimpleElements();
this.text = "";
}
示例8: ParseParameters
/// <summary>
/// Parses the parameters.
/// </summary>
/// <param name="uri">The URI.</param>
/// <returns></returns>
private static StringDictionary ParseParameters(
Uri uri )
{
StringDictionary result = new StringDictionary();
if ( !string.IsNullOrEmpty( uri.Query ) )
{
string query = uri.Query.Trim( '&', '?' );
string[] pairs = query.Split( '&' );
foreach ( string pair in pairs )
{
if ( pair.Contains( @"=" ) )
{
string[] ab = pair.Split( '=' );
result[ab[0]] = ab[1];
}
else
{
result[pair] = pair;
}
}
}
return result;
}
示例9: BindSettings
public void BindSettings(StringDictionary settings)
{
// bind servers
try
{
ddlServers.DataSource = ES.Services.StatisticsServers.GetServers(PanelRequest.ServiceId);
ddlServers.DataBind();
}
catch
{ /* skip */ }
txtSmarterUrl.Text = settings["SmarterUrl"];
txtUsername.Text = settings["Username"];
ViewState["PWD"] = settings["Password"];
Utils.SelectListItem(ddlServers, settings["ServerID"]);
Utils.SelectListItem(ddlLogFormat, settings["LogFormat"]);
txtLogWilcard.Text = settings["LogWildcard"];
txtLogDeleteDays.Text = settings["LogDeleteDays"];
txtSmarterLogs.Text = settings["SmarterLogsPath"];
txtSmarterLogDeleteMonths.Text = settings["SmarterLogDeleteMonths"];
chkBuildUncLogsPath.Checked = Utils.ParseBool(settings["BuildUncLogsPath"], false);
if (settings["TimeZoneId"] != null)
timeZone.TimeZoneId = Utils.ParseInt(settings["TimeZoneId"], 1);
txtStatsUrl.Text = settings["StatisticsURL"];
}
示例10: GetSettings
/// <summary>
/// Retreaves StringDictionary object from database or file system
/// </summary>
/// <param name="extensionType">
/// Extension Type
/// </param>
/// <param name="extensionId">
/// Extension Id
/// </param>
/// <returns>
/// StringDictionary object as Stream
/// </returns>
public object GetSettings(ExtensionType extensionType, string extensionId)
{
SerializableStringDictionary ssd;
var sd = new StringDictionary();
var serializer = new XmlSerializer(typeof(SerializableStringDictionary));
if (Section.DefaultProvider == "XmlBlogProvider")
{
var stm = (Stream)BlogService.LoadFromDataStore(extensionType, extensionId);
if (stm != null)
{
ssd = (SerializableStringDictionary)serializer.Deserialize(stm);
stm.Close();
sd = ssd;
}
}
else
{
var o = BlogService.LoadFromDataStore(extensionType, extensionId);
if (!string.IsNullOrEmpty((string)o))
{
using (var reader = new StringReader((string)o))
{
ssd = (SerializableStringDictionary)serializer.Deserialize(reader);
}
sd = ssd;
}
}
return sd;
}
示例11: InstallCertificate
private static void InstallCertificate(StringDictionary parametrs)
{
try
{
string[] param = parametrs["assemblypath"].Split('\\');
string certPath = String.Empty;
for (int i = 0; i < param.Length - 1; i++)
{
certPath += param[i] + '\\';
}
certPath += "certificate.pfx";
var cert = new X509Certificate2(certPath, "",
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet);
var store = new X509Store(StoreName.AuthRoot, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadWrite);
store.Add(cert);
store.Close();
}
catch (Exception ex)
{
throw new Exception("Certificate appeared to load successfully but also seems to be null.", ex);
}
}
示例12: StartWorkflowButton1_Executed
void StartWorkflowButton1_Executed(object sender, EventArgs e)
{
List<string> mailList = new List<string>();
List<SPUser> users = WorkFlowUtil.GetSPUsersInGroup("wf_EquApp");
List<SPUser> usersReception = WorkFlowUtil.GetSPUsersInGroup("wf_Reception");
foreach (SPUser user in users)
{
mailList.Add(user.Email);
}
foreach (SPUser user in usersReception)
{
string sMai=user.Email;
if (!mailList.Contains(sMai))
{
mailList.Add(sMai);
}
}
string EmployeeName=((TextBox)DataForm1.FindControl("txtEmployeeName")).Text;
StringDictionary dict = new StringDictionary();
dict.Add("to", string.Join(";", mailList.ToArray()));
dict.Add("subject",EmployeeName+"'s new employee equipment request" );
string mcontent = EmployeeName + "'s new employee equipment request has been submitted. Workflow number is "
+ SPContext.Current.ListItem["WorkflowNumber"] + ".<br/><br/>" + @" Please view the detail by clicking <a href='"
+ SPContext.Current.Web.Url
+ "/_layouts/CA/WorkFlows/Equipment2/DisplayForm.aspx?List="
+ SPContext.Current.ListId.ToString()
+ "&ID="
+ SPContext.Current.ListItem.ID
+ "'>here</a>.";
SPUtility.SendEmail(SPContext.Current.Web, dict, mcontent);
}
示例13: GetProfile
/// <summary>
/// Calls the remote Viddler API method: viddler.users.getProfile
/// </summary>
public Data.User GetProfile(string userName)
{
StringDictionary parameters = new StringDictionary();
parameters.Add("user", userName);
return this.Service.ExecuteHttpRequest<Users.GetProfile, Data.User>(parameters);
}
示例14: LinkMessage
public LinkMessage(StringDictionary attributes, NodeInfo local, NodeInfo remote, string token)
{
_attributes = attributes;
_local_ni = local;
_remote_ni = remote;
_token = token;
}
示例15: BuildElsticSearchConnection
public static ElasticsearchConnection BuildElsticSearchConnection(string connectionString)
{
try
{
var builder = new System.Data.Common.DbConnectionStringBuilder();
builder.ConnectionString = connectionString.Replace("{", "\"").Replace("}", "\"");
var lookup = new StringDictionary();
foreach (string key in builder.Keys)
{
lookup[key] = Convert.ToString(builder[key]);
}
var index = lookup["Index"];
// If the user asked for rolling logs, setup the index by day
if (!string.IsNullOrEmpty(lookup["rolling"]))
if (lookup["rolling"] == "true")
index = string.Format("{0}-{1}", index, DateTime.Now.ToString("yyyy.MM.dd"));
return
new ElasticsearchConnection
{
Server = lookup["Server"],
Port = lookup["Port"],
Index = index
};
}
catch
{
throw new InvalidOperationException("Not a valid connection string");
}
}