/// <summary> /// Returns true if InputJoinStrings instances are equal /// </summary> /// <param name="other">Instance of InputJoinStrings to be compared</param> /// <returns>Boolean</returns> public bool Equals(InputJoinStrings other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Input == other.Input || Input != null && other.Input != null && Input.SequenceEqual(other.Input) ) && ( Separator == other.Separator || Separator != null && Separator.Equals(other.Separator) ) && ( Lower == other.Lower || Lower.Equals(other.Lower) ) && ( Trim == other.Trim || Trim.Equals(other.Trim) )); }
protected override void Modify() { switch (Method) { case "trimstartappend": if (Separator.Equals(Common.DefaultValue)) { Separator = " "; } break; } }
protected override void PreValidate() { switch (Method) { case "trimstartappend": if (Separator.Equals(Constants.DefaultSetting)) { Separator = " "; } break; } }
/// <summary> /// Returns true if WidgetDTO instances are equal /// </summary> /// <param name="input">Instance of WidgetDTO to be compared</param> /// <returns>Boolean</returns> public bool Equals(WidgetDTO input) { if (input == null) { return(false); } return (( WidgetId == input.WidgetId || (WidgetId != null && WidgetId.Equals(input.WidgetId)) ) && ( Type == input.Type || (Type != null && Type.Equals(input.Type)) ) && ( Name == input.Name || (Name != null && Name.Equals(input.Name)) ) && ( Visibility == input.Visibility || (Visibility != null && Visibility.Equals(input.Visibility)) ) && ( Label == input.Label || (Label != null && Label.Equals(input.Label)) ) && ( Icon == input.Icon || (Icon != null && Icon.Equals(input.Icon)) ) && ( Labelcolor == input.Labelcolor || (Labelcolor != null && Labelcolor.Equals(input.Labelcolor)) ) && ( Valuecolor == input.Valuecolor || (Valuecolor != null && Valuecolor.Equals(input.Valuecolor)) ) && ( Mappings == input.Mappings || Mappings != null && Mappings.SequenceEqual(input.Mappings) ) && ( SwitchSupport == input.SwitchSupport || (SwitchSupport != null && SwitchSupport.Equals(input.SwitchSupport)) ) && ( SendFrequency == input.SendFrequency || (SendFrequency != null && SendFrequency.Equals(input.SendFrequency)) ) && ( Separator == input.Separator || (Separator != null && Separator.Equals(input.Separator)) ) && ( Refresh == input.Refresh || (Refresh != null && Refresh.Equals(input.Refresh)) ) && ( Height == input.Height || (Height != null && Height.Equals(input.Height)) ) && ( MinValue == input.MinValue || (MinValue != null && MinValue.Equals(input.MinValue)) ) && ( MaxValue == input.MaxValue || (MaxValue != null && MaxValue.Equals(input.MaxValue)) ) && ( Step == input.Step || (Step != null && Step.Equals(input.Step)) ) && ( Url == input.Url || (Url != null && Url.Equals(input.Url)) ) && ( Encoding == input.Encoding || (Encoding != null && Encoding.Equals(input.Encoding)) ) && ( Service == input.Service || (Service != null && Service.Equals(input.Service)) ) && ( Period == input.Period || (Period != null && Period.Equals(input.Period)) ) && ( Legend == input.Legend || (Legend != null && Legend.Equals(input.Legend)) ) && ( State == input.State || (State != null && State.Equals(input.State)) ) && ( Item == input.Item || (Item != null && Item.Equals(input.Item)) ) && ( LinkedPage == input.LinkedPage || (LinkedPage != null && LinkedPage.Equals(input.LinkedPage)) ) && ( Widgets == input.Widgets || Widgets != null && Widgets.SequenceEqual(input.Widgets) )); }
private void btnAddServer_Click(object sender, RoutedEventArgs e) { ServerControl servCtrl = new ServerControl(); Separator sep = new Separator(); if (m_Servers.OneServer) { sep.Visibility = System.Windows.Visibility.Collapsed; } sep.Width = servCtrl.Width; sep.Height = 10; sep.BorderThickness = new Thickness(10, 10, 10, 10); sep.BorderBrush = Brushes.Black; this.stackServers.Children.Add(sep); ServerSchema newServerSchema = new ServerSchema(); m_Servers.ServerSchema.Add(newServerSchema); servCtrl.DataContext = newServerSchema; servCtrl.Visibility = Visibility.Visible; this.stackServers.Children.Add(servCtrl); newServerSchema.Visible = true; newServerSchema.PropertyChanged += m_Application.Model_PropertyChanged; cmbChooseServer.SelectedItem = newServerSchema; if (m_Servers.OneServer) { for (int i = 0; i < this.stackServers.Children.Count; i++) { if (this.stackServers.Children[i] is ServerControl) { ServerControl serverControl = (ServerControl)this.stackServers.Children[i]; if (!serverControl.Equals(servCtrl)) { this.stackServers.Children[i].Visibility = System.Windows.Visibility.Collapsed; } ServerSchema serverSchema = (ServerSchema)serverControl.DataContext; if (!serverSchema.Equals(newServerSchema)) { serverSchema.Visible = false; } } else if (this.stackServers.Children[i] is Separator) { Separator tempSeparator = (Separator)this.stackServers.Children[i]; if (!tempSeparator.Equals(sep)) { tempSeparator.Visibility = System.Windows.Visibility.Collapsed; } } } } else { ShowServerChooser(false); m_Servers.OneServer = false; for (int i = 0; i < this.stackServers.Children.Count; i++) { if (this.stackServers.Children[i] is ServerControl) { ServerControl tempServerControl = (ServerControl)this.stackServers.Children[i]; if (tempServerControl.Visibility == System.Windows.Visibility.Collapsed) { tempServerControl.Visibility = System.Windows.Visibility.Visible; } } else if (this.stackServers.Children[i] is Separator) { Separator tempSeparator = (Separator)this.stackServers.Children[i]; if (tempSeparator.Visibility == System.Windows.Visibility.Collapsed) { tempSeparator.Visibility = System.Windows.Visibility.Visible; } } /* * if (this.stackServers.Children[i] is ServerControl) * { * ServerControl serverControl = (ServerControl)this.stackServers.Children[i]; * ServerSchema serverSchema = (ServerSchema)serverControl.DataContext; * serverSchema.Visible = false; * } */ } } /* * ServerSchema servSchema = (ServerSchema) this.DataContext; * Console.Out.WriteLine(servSchema.MailFrom); * Console.Out.WriteLine("Width " + stackServers.DesiredSize.Width); * ServerControl stackPanel = (ServerControl)stackServers.Children[0]; * StackPanel sp = (StackPanel)stackPanel.FindName("outerStackPanel"); * Console.Out.WriteLine("Width OuterStackpanel: " + sp.DesiredSize.Width.ToString()); * if (m_Servers != null) * { * m_Servers.SaveToFile("Servers2.xml"); * } * * ListBox mailsListBox = (ListBox)stackPanel.FindName("lstMails"); * //mailsListBox.It * * Window1 wnd1 = new Window1(); * wnd1.InitializeComponent(); * wnd1.ShowDialog(); */ }
// formats the rules of the ruleset into a specific string format (which will later be written to file) internal List <string> FormatRules(Dictionary <string, int> ruleset, out int ruleCounter, ExtractMode extractmode, Separator separator) { ruleCounter = 0; // counts the number of times a unique rule occurs List <string> res = new List <string>(); List <string> rhslist = new List <string>(); // list that holds unique "right hand side" keys, used when formatting the lexicon string sep = ""; if (separator.Equals(Separator.WHITESPACE)) { sep = " "; } else if (separator.Equals(Separator.TAB)) { sep = "\t"; } else { throw new ArgumentException("Illegal Separator enumerator was passed"); } switch (extractmode) { case ExtractMode.GRAMMAR: foreach (KeyValuePair <string, int> entry in ruleset) { string rule = entry.Key; rule = rule.Replace(' ', '\t'); string count = entry.Value.ToString(); res.Add(count + sep + rule); ruleCounter++; } return(res); case ExtractMode.LEXICON: foreach (KeyValuePair <string, int> entry in ruleset) { string[] rule = entry.Key.Split(' '); string lhs = rule[0]; string rhs = rule[1]; string count = entry.Value.ToString(); // if the right hand side rule has not been added to res if (!rhslist.Contains(rhs)) { res.Add(rhs + sep + lhs + sep + count); rhslist.Add(rhs); ruleCounter++; } // if the right hand side rule has previously been added to res else { string searchStr = rhs + sep; string resStr = res.FirstOrDefault(elem => elem.StartsWith(searchStr)); int index = res.IndexOf(resStr); res[index] = res[index] + sep + lhs + sep + count; ruleCounter++; } } return(res); default: throw new ArgumentException("Illegal ExtractMode enumerator was passed"); } }
/// <summary> /// Determines whether an element is in the <see cref="BlockStack{T}"/> /// </summary> /// <param name="item"> /// The object to locate in the System.Collections.Generic.Stack`1. The value can /// be null for reference types. /// </param> /// <returns></returns> public bool Contains(T item) => Header.Contains(item) ? true : Elements.Contains(item) ? true : Footer.Contains(item) ? true & UseSeparator : Separator.Equals(item) ? true : false;
public override string[] Split(string line) { // 0: starting col // 1: open col // 2: not open col // 3: closed col var state = 0; var list = new List <string>(); var text = ""; if (Separator.Equals("|") && line.Contains("\"")) { line = line.Replace("\"", string.Empty); } for (var i = 0; i < line.Length; i++) { var c = line[i].ToString(); if (c == Separator) { if (state == 1) { text += c; } else { list.Add(text); text = ""; state = 0; } } else if (c == Qualifier) { if (state == 0) { state = 1; } else if (state == 1) { state = 3; } else if (state == 2) { text += c; } } else { if (state == 0) { state = 2; } text += c; } } if (state != 0) { list.Add(text); } return(list.ToArray()); }