/// <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(); }
/// <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(); }
public void UpdateToolTip_WPF() { if (string.IsNullOrEmpty(ClassType)) { ToolTip_TypeAndName = $"{LinkType.ToString()}"; } else { switch (LinkType) { case enLinkType.Enumerable: { var ct = EngineNS.Rtti.RttiHelper.GetTypeFromTypeFullName(ClassType); if (ct != null) { ToolTip_TypeAndName = $"{LinkType.ToString()} ({EngineNS.Rtti.RttiHelper.GetAppTypeString(ct)})"; } else { ToolTip_TypeAndName = $"{LinkType.ToString()} ({ClassType})"; } } break; default: ToolTip_TypeAndName = $"{LinkType.ToString()} ({ClassType})"; break; } } BackBrush = GetPinBrush(); }
public override PListDictionary Serialize() { var dic = base.Serialize(); dic.Add(LINK_TYPE_KEY, Link.ToString()); return(dic); }
static void test4() { LinkType type = LinkType.Trade | LinkType.Security; switch (type) { case LinkType.Trade: Console.WriteLine("Trade"); break; case LinkType.Security: Console.WriteLine("Security"); break; default: Console.WriteLine("default"); break; } object obj = null; string a = ""; LinkType typeaa; if (Enum.TryParse <LinkType>(a, out typeaa)) { string s = ""; } typeaa = LinkType.Undefined; string sss = GetDescription(typeaa); Console.WriteLine(type.ToString()); }
public Link(LinkType type, string rel, string href, HttpMethodType method) { this.type = type.ToString(); this.rel = rel.ToString(); this.href = href; this.method = method.ToString(); }
public override int GetHashCode() { if (ValueType == null) { return((base.GetHashCodeString() + LinkType.ToString() + IsCommon + Value).GetHashCode()); } return((base.GetHashCodeString() + LinkType.ToString() + ValueType.FullName + IsCommon + Value).GetHashCode()); }
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; }
public static async Task <bool> SendRetryLinkMessageAsync(LinkType linkType, int repostCount, Exception ex = null) { if (Ditto.Running && await Ditto.IsClientConnectedAsync().ConfigureAwait(false)) { Log.Debug($"Attempting to repost link ({linkType.ToString()})... {repostCount}{(ex == null ? string.Empty : $" | {ex}")}"); await Task.Delay(1000).ConfigureAwait(false); return(true); }
public static string GetLinkType(LinkType lt) { return(lt switch { LinkType.Normal => "intra-rack", LinkType.InterRack => "inter-rack", LinkType.InterLocal => "inter-local", LinkType.InterSite => "inter-site", _ => lt.ToString(), });
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); }
/// <inheritdoc /> public bool AddLink(LinkType type, string name, string constraint, bool sortPackages = false) { // todo: sort the packages var link = Str.LowerDashes(type.ToString()); return(Manipulate((config) => { if (!config.TryGetValue(link, out JToken collection)) { config[link] = collection = new JObject(); } collection[name] = constraint; })); }
private void btnLinkTypeFilter_Click(object sender, EventArgs e) { ExecResult <LinkType[]> selectLinkTypeResult = FSelectComponentLevel.Execute((LinkType[])lblLinkTypeFilter.Tag); if (selectLinkTypeResult.code == 0) { lblLinkTypeFilter.Tag = selectLinkTypeResult.value; lblLinkTypeFilter.Text = ""; for (int i = 0; i < selectLinkTypeResult.value.Length; i++) { LinkType linkType = selectLinkTypeResult.value[i]; if (lblLinkTypeFilter.Text == "") { lblLinkTypeFilter.Text += linkType.ToString(); } else { lblLinkTypeFilter.Text += "," + linkType.ToString(); } if (i == 5) { break; } } if (lblLinkTypeFilter.Text != "") { lblLinkTypeFilter.Text += "..."; } SetFilterLabel(tpLinkTypeFilter, selectLinkTypeResult.value.Length > 0); LoadConnectorList(); } }
/// <inheritdoc /> public bool RemoveLink(LinkType type, string name) { var link = Str.LowerDashes(type.ToString()); return(Manipulate((config) => { if (!config.TryGetValue(link, out JToken token)) { return; } var collection = (JObject)token; collection.Remove(name); if (collection.Count <= 0) { config.Remove(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"; } }
public string GenerateLink(LinkType type, int clientId, string redirectUri, DisplayOptions display, UserPermissions scope, string state) { var sb = new StringBuilder($"https://oauth.vk.com/authorize?client_id={clientId}"); var uri = string.IsNullOrWhiteSpace(redirectUri) ? "https://oauth.vk.com/blank.html" : redirectUri; sb.Append($"&scope={scope:D}"); sb.Append($"&response_type={type.ToString().ToLower()}"); sb.Append($"&v={RequestSettings.ApiVersion}"); sb.Append($"&redirect_uri={uri}"); if (display != DisplayOptions.Default) { sb.Append($"&display={display.ToString().ToLower()}"); } if (!string.IsNullOrWhiteSpace(state)) { sb.Append($"&state={state}"); } return(sb.ToString()); }
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); }
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); }
public override string ToString() { return(String.Format("BidirectionalEdge(A: {0}, B: {1}, Type {2})", A, B, Type.ToString())); }
public string GetLinkTypeDisplayName(LinkType linkType) { return(linkTypeDisplayNames[linkType.ToString()]); }
public override string ToString() { string endianness; if (BitConverter.IsLittleEndian) { if (byteSwap) { endianness = "Big"; } else { endianness = "Little"; } } else { if (byteSwap) { endianness = "Little"; } else { endianness = "Big"; } } return(String.Format("{0}-endian {1} capture, pcap version {2}", endianness, linktype.ToString(), version.ToString())); }
public override string ToString() { return($"{ linkType.ToString() } link:\n" + $"\t- Source: { sourcePath }\n" + $"\t- Target: { targetPath }"); }
private static string getTitle(LinkType type) { return type.ToString().Replace('_', ' '); }
override public string ToString() { return(type.ToString() + " | Actor: " + players[0].Playername + "- Reciever: " + players[1].Playername); }
private IConfigurationLinkItem GetRequirementConfigurationLinkItemForLinkType(LinkType linkType) { return(_testServerConfiguration.Configuration.GetWorkItemConfiguration("Requirement").Links.First(x => x.LinkValueType == linkType.ToString())); }
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; }
private void Item_Click(object sender, EventArgs e) { Button s = (Button)sender; s.Enabled = false; Brick brick = new Brick(); if (s.Name.StartsWith("USB")) { USB usb = new USB(); Protocol.BrickInfo info = new Protocol.BrickInfo(); info.address = new byte[] { 0, 0, 0, 0, 0, 0 }; info.name = s.Text.Trim(); brick = new Brick(usb, info); myLinkType = LinkType.USB; } if (s.Name.StartsWith("BLU")) { Bluetooth blue = new Bluetooth(); Protocol.BrickInfo info = new Protocol.BrickInfo(); info.address = Utils.AddressString2Byte(s.Name.Substring(3), true); info.name = s.Text.Trim(); brick = new Brick(blue, info); myLinkType = LinkType.Bluetooth; } /*try * { * brick.Connect(); * brick.Disconnect(); * } * catch (Exception ex) * { * WriteMessage("Error while connecting to brick:"); * WriteMessage(ex.Message); * Disconnect_Click(null, null); * return; * }*/ myBrick = brick; Disconnect.Enabled = true; s.Enabled = true; List.Controls.Clear(); List.Visible = false; SearchVia.Enabled = false; Search.Enabled = true; Time.Enabled = false; Search.Image = global::NXTLibTesterGUI.Properties.Resources.StatusAnnotations_Complete_and_ok_32xLG_color; NXTPanel.Visible = true; NXT.Text = " Connected to " + myBrick.brickinfo.name; NXTConn.Text = "Connection Type: " + myLinkType.ToString(); if (myLinkType != LinkType.USB) { NXTAdd.Text = "Address: " + Utils.AddressByte2String(myBrick.brickinfo.address, true); } else { NXTAdd.Text = ""; } CheckUpdateStatus(); Search.Text = " Update Version Info"; WriteMessage("Connection successful!"); }