本文整理汇总了C#中LinkType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# LinkType.ToString方法的具体用法?C# LinkType.ToString怎么用?C# LinkType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkType
的用法示例。
在下文中一共展示了LinkType.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Creates a symbolic link at the specified location to the specified destination
/// </summary>
/// <param name="linkPath">The path where the symbolic link will be created</param>
/// <param name="destination">The path where the symbolic link will link to</param>
/// <param name="overrideExisting">Whether an existing file/folder should be overridden</param>
/// <param name="type">The LinkType, a file or a directory</param>
/// <exception cref="TargetAlreadyExistsException">The given <paramref name="linkPath"/> already exists and <paramref name="overrideExisting"/> was false</exception>
public static void Create(string linkPath, string destination, bool overrideExisting, LinkType type)
{
if (type == LinkType.DirectoryLink && Directory.Exists(linkPath)) {
if (!overrideExisting) {
throw new TargetAlreadyExistsException("Directory already exists");
}
} else if (type == LinkType.FileLink && File.Exists(linkPath)) {
if (!overrideExisting) {
throw new TargetAlreadyExistsException("File already exists");
}
}
// Start process with privileges
var process = new Process();
process.StartInfo.FileName = Assembly.GetExecutingAssembly().CodeBase;
process.StartInfo.Verb = "runas"; // Adminrights
process.StartInfo.CreateNoWindow = true;
process.StartInfo.Arguments = string.Join(" ", CommandLineArgs.ArgsFromDictionary(new Dictionary<string, string> {
{ ActionArgumentTitle, ActionArgumentCreate },
//{ DebugArgumentTitle, "=True" },
{ CreateLinkPathArgumentTitle, linkPath },
{ CreateDestinationArgumentTitle, destination },
{ CreateLinkTypeArgumentTitle, type.ToString() }}));
process.Start();
process.WaitForExit();
}
示例2: GetHrefContent
public static string GetHrefContent(this AtomLinkCollection links, LinkType feedType = LinkType.listfeed)
{
foreach (var link in links)
{
if (link.Rel.EndsLike(feedType.ToString()))
return link.HRef.Content;
}
return null;
}
示例3: Link
public string Link(LinkType linkType = LinkType.Hot, bool AddJsonExtension = true)
{
string returnString = @"http://www.reddit.com/r/";
returnString += name;
returnString += @"/";
returnString += linkType.ToString().ToLower();
if (!AddJsonExtension)
{
return returnString;
}
else
{
return returnString + @".json";
}
}
示例4: ShowMCSTable
private void ShowMCSTable(LinkType linkType)
{
MCSTableFormEditor editor = new MCSTableFormEditor(this.m_Model, this.m_Model.McsManagement.MCSList, linkType);
TableForm form = (TableForm) ProjectSingleton.FindProjectForm(linkType.ToString() + "MCS");
if (form == null)
{
form = new TableForm(linkType.ToString() + "MCS", editor, null);
}
else
{
form.TableEditor.ClearModuleEvent();
form.TableEditor = null;
form.TableEditor = editor;
}
form.TabText = ProjectSingleton.CurrentProject.Name + ":" + linkType.ToString() + " " + TrafficModelResource.TRAFFICMODEL_LTEMCSTABLE;
form.DgvBase.OnOpenTable(null);
form.HideOnClose = true;
form.LoadData();
form.Show(ProjectSingleton.CurrentProject.DockPanel, DockState.Document);
}
示例5: GetConnection
public FdfsConnection GetConnection(LinkType link,IPEndPoint remoteEP)
{
Dictionary<IPEndPoint, ConnectionGroup> groups = GetGroup(link);
FdfsConnection conn = null;
lock (_syncRoot)
{
ConnectionGroup group = null;
if (groups.TryGetValue(remoteEP, out group))
{
conn = group.GetOne();
}
else
{
group = new ConnectionGroup(this, remoteEP,link);
conn = group.GetOne();
groups.Add(remoteEP, group);
}
}
LogUtil.Info(string.Format("FdfsConnection GetConnection(LinkType {0},IPEndPoint {1}) port:{2} connect {3}",link.ToString(), remoteEP.Address, remoteEP.Port, conn.IsConnected.ToString()));
return conn;
}
示例6: RenderEditLink
private static string RenderEditLink(Guid id, LinkType type, string cssClass, string before, string after,
string linkText)
{
//Generate the url
var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
string url = urlHelper.Action("edit", type.ToString().ToLower(), new {area = "Manager", id});
//check to see if the css class was included otherwise don't render the class=""
string css = string.Empty;
if (!String.IsNullOrEmpty(cssClass))
{
css = String.Format("class=\"{0}\"", cssClass);
}
//Return the html
return String.Format("{0}<a {1} href=\"{2}\">{3}</a>{4}", before, css, url, linkText, after);
}