/// <summary> /// Generates XAML for the markdown element. /// </summary> /// <param name="Output">XAML will be output here.</param> /// <param name="TextAlignment">Alignment of text in element.</param> public override void GenerateXAML(XmlWriter Output, TextAlignment TextAlignment) { if (this.Document.TryGetFootnoteNumber(this.key, out int Nr)) { XamlSettings Settings = this.Document.Settings.XamlSettings; string s; Output.WriteStartElement("TextBlock"); Output.WriteAttributeString("Text", Nr.ToString()); Output.WriteStartElement("TextBlock.LayoutTransform"); Output.WriteStartElement("TransformGroup"); Output.WriteStartElement("ScaleTransform"); Output.WriteAttributeString("ScaleX", s = CommonTypes.Encode(Settings.SuperscriptScale)); Output.WriteAttributeString("ScaleY", s); Output.WriteEndElement(); Output.WriteStartElement("TranslateTransform"); Output.WriteAttributeString("Y", Settings.SuperscriptOffset.ToString()); Output.WriteEndElement(); Output.WriteEndElement(); Output.WriteEndElement(); Output.WriteEndElement(); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Opens the port. Throws an exception on failure /// /// </summary> protected override void OpenPort() { string deviceFileName; // set up now deviceFileName = Definitions.A2DIIO_FILENAME; if (Nr > -1 && Nr < 7) { deviceFileName = deviceFileName.Replace("%port%", Nr.ToString()); } else { throw new Exception("Unknown A2D Port:" + Nr.ToString()); } // we open the file. a2dStream = File.Open(deviceFileName, FileMode.Open); if (a2dStream == null) { throw new Exception("Could not open a2d device file:" + deviceFileName); } // we open the reader a2dReader = new StreamReader(a2dStream); PortIsOpen = true; // Console.WriteLine("A2DPort Port Device Enabled: "+ deviceFileName); }
/// <summary> /// Generates plain text for the markdown element. /// </summary> /// <param name="Output">Plain text will be output here.</param> public override void GeneratePlainText(StringBuilder Output) { if (this.Document.TryGetFootnoteNumber(this.key, out int Nr)) { Output.Append(" ["); Output.Append(Nr.ToString()); Output.Append("]"); } }
public override int GetHashCode() { var hashCode = -2033167572; hashCode = hashCode * -1521134295 + Vlanid.GetHashCode(); hashCode = hashCode * -1521134295 + Nr.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <IPAddress> .Default.GetHashCode(IpBegin); hashCode = hashCode * -1521134295 + MaskLength.GetHashCode(); return(hashCode); }
private void IncLocked(string Key, Dictionary <string, Statistic> PerKey) { if (PerKey.TryGetValue(Key, out Statistic Nr)) { Nr.Inc(); } else { PerKey[Key] = new Statistic(1); } }
void DrawNumber(Graphics g) { int x = 0; int add = 0; if (Nr.Contains(",")) { add = 89; } for (int i = 0; i < NumberOfDisplays; i++) { int dif = NumberOfDisplays - Nr.Length; if (i >= dif) { Number = Nr[i - dif]; if (Number.Equals(',')) { ColDot = ColOn; x = 1; } else { ColDot = ColOff; } SetSegmentsColors(Number); DrawSegHor(ColA, g, 17 + (i - x) * 89 + add, 14); DrawSegVer(ColC, g, 79 + (i - x) * 89 + add, 75); DrawSegVer(ColB, g, 79 + (i - x) * 89 + add, 15); DrawSegHor(ColD, g, 17 + (i - x) * 89 + add, 135); DrawSegVer(ColE, g, 15 + (i - x) * 89 + add, 75); DrawSegVer(ColF, g, 15 + (i - x) * 89 + add, 15); DrawSegHor(ColG, g, 17 + (i - x) * 89 + add, 75); DrawDot(ColDot, g, 86 + (i - x) * 89 + add, 130); } else { DrawSegHor(ColOff, g, 17 + i * 89 + add, 14); DrawSegVer(ColOff, g, 79 + i * 89 + add, 75); DrawSegVer(ColOff, g, 79 + i * 89 + add, 15); DrawSegHor(ColOff, g, 17 + i * 89 + add, 135); DrawSegVer(ColOff, g, 15 + i * 89 + add, 75); DrawSegVer(ColOff, g, 15 + i * 89 + add, 15); DrawSegHor(ColOff, g, 17 + i * 89 + add, 75); DrawDot(ColOff, g, 86 + i * 89 + add, 130); } } }
private void RandomRoomCreation() { int nr = Nr.Next(0, 100); if (nr < Pr) { DiggRoom(sizeW.Next(3, 7), sizeH.Next(3, 7)); Pr = 0; } else { Pr += ROOMCHANCEINCREACE; } }
/// <summary> /// Exports the element to XML. /// </summary> /// <param name="Output">XML Output.</param> public override void Export(XmlWriter Output) { Output.WriteStartElement("FootnoteReference"); if (this.Document.TryGetFootnoteNumber(this.key, out int Nr)) { Output.WriteAttributeString("nr", Nr.ToString()); } else { Output.WriteAttributeString("key", this.key); } Output.WriteEndElement(); }
/// <summary> /// Generates HTML for the markdown element. /// </summary> /// <param name="Output">HTML will be output here.</param> public override void GenerateHTML(StringBuilder Output) { string s; if (this.Document.TryGetFootnoteNumber(this.key, out int Nr)) { s = Nr.ToString(); Output.Append("<sup id=\"fnref-"); Output.Append(s); Output.Append("\"><a href=\"#fn-"); Output.Append(s); Output.Append("\" class=\"footnote-ref\">"); Output.Append(s); Output.Append("</a></sup>"); } }
private void _7segment_Paint(object sender, PaintEventArgs e) { this.Size = new Size(NumberOfDisplays * 89 + 14, 150); Error = false; Graphics g = e.Graphics; ErrorCheck(); if (Error) { OnErrorDo(g); } else { DrawNumber(g); } if (Nr.Contains(",")) { DoIfContainsDot(g); } }
public int CompareTo(object obj) { int Result = 0; ClubMember Other = (ClubMember)obj; Result = Nr.CompareTo(Other.Nr); if (Result == 0) { Result = Fname.CompareTo(Other.Fname); } if (Result == 0) { Result = Lname.CompareTo(Other.Lname); } if (Result == 0) { Result = Age.CompareTo(Other.Age); } return(Result); }
public override int GetHashCode() { return(Nr.GetHashCode() + Fname.GetHashCode() + Lname.GetHashCode() + Age.GetHashCode()); }
public override string ToString() { return(Nr.ToString() + " " + Fname + " " + Lname + " " + Age.ToString()); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Closes the port. Throws an exception on failure, including if the port is /// already closed /// /// This is really just doing the equivalent of a shell command /// echo <gpioID> > /sys/class/gpio/unexport /// after which the /sys/class/gpio/gpio<gpioID> directory should not exist. public virtual void ClosePort() { if (openedInternally) { // do the close try { if (System.IO.Directory.Exists(Definitions.SYSFS_GPIODIR + Definitions.SYSFS_GPIODIRNAMEBASE + Nr)) { System.IO.File.WriteAllText(Definitions.SYSFS_GPIODIR + Definitions.SYSFS_GPIOUNEXPORT, Nr.ToString()); } } catch { } } }
protected virtual void OpenPort() { // do the open try { ValuePath = Definitions.SYSFS_GPIODIR + Definitions.SYSFS_GPIODIRNAMEBASE + Nr + "/" + Definitions.SYSFS_GPIOVALUE; if (!System.IO.Directory.Exists(Definitions.SYSFS_GPIODIR + Definitions.SYSFS_GPIODIRNAMEBASE + Nr)) { System.IO.File.WriteAllText(Definitions.SYSFS_GPIODIR + Definitions.SYSFS_GPIOEXPORT, Nr.ToString()); openedInternally = true; } } catch (Exception err) { Console.WriteLine("Failed to export GPIO " + Nr + " -> " + err.ToString()); } }
public override string ToString() => Nr.ToString();