Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ private void ScreenRefresh_Click(object? sender, RoutedEventArgs e)
ScreenWorkArea.Text = screen?.WorkingArea.ToString();
ScreenScaling.Text = screen?.Scaling.ToString(CultureInfo.InvariantCulture);
ScreenOrientation.Text = screen?.CurrentOrientation.ToString();
ScreenSameReference.Text = ReferenceEquals(lastScreen, screen).ToString();
ScreenSameReference.Text = (lastScreen == screen).ToString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public CustomSkiaPage()
_noSkia = new GlyphRun(Typeface.Default.GlyphTypeface, 12, text.AsMemory(), glyphs);
}

class CustomDrawOp : ICustomDrawOperation
class CustomDrawOp : ICustomDrawOperation, IEquatable<CustomDrawOp>
{
private readonly IImmutableGlyphRunReference _noSkia;

Expand All @@ -42,7 +42,10 @@ public void Dispose()

public Rect Bounds { get; }
public bool HitTest(Point p) => false;
public bool Equals(ICustomDrawOperation other) => false;
public bool Equals(ICustomDrawOperation? other) => other is CustomDrawOp;
public bool Equals(CustomDrawOp? other) => other is not null;
public override bool Equals(object? obj) => obj is CustomDrawOp other && Equals(other);
public override int GetHashCode() => Bounds.GetHashCode();
static Stopwatch St = Stopwatch.StartNew();
public void Render(ImmediateDrawingContext context)
{
Expand All @@ -62,8 +65,8 @@ public void Render(ImmediateDrawingContext context)
new SKColor(0, 255, 255)
};

var sx = Animate(100, 2, 10);
var sy = Animate(1000, 5, 15);
_ = Animate(100, 2, 10);
_ = Animate(1000, 5, 15);
var lightPosition = new SKPoint(
(float)(Bounds.Width / 2 + Math.Cos(St.Elapsed.TotalSeconds) * Bounds.Width / 4),
(float)(Bounds.Height / 2 + Math.Sin(St.Elapsed.TotalSeconds) * Bounds.Height / 4));
Expand Down
8 changes: 4 additions & 4 deletions CSharpBible/ConsoleApps/Display_Test/Models/DisplayTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public void DisplayTest3(IRandom random)

for (int j = 0; j < display2.ScreenBuffer.Length; j++)
{
int r = (int)Math.Round(1.25 + 0.25 * random.NextDouble() + Math.Sin((j % 10 - i * 0.4) * -0.6) * 1.5);
int g = (int)Math.Round(1.25 + 0.25 * random.NextDouble() + Math.Sin((j / 10 + (j % 10) / 2 + i * 0.4) * 0.6) * 1.5);
int b = (int)Math.Round(1.25 + 0.25 * random.NextDouble() + Math.Sin((j / 10 - (j % 10) / 2 - i * 0.4) * 0.6) * 1.5);
display2.PutPixel((j / 10), (j % 10), (byte)(r * 64), (byte)(g * 64), (byte)(b * 64));
byte r = (byte)Math.Clamp(Math.Round(1.25 + 0.25 * random.NextDouble() + Math.Sin((j % 10 - i * 0.4) * -0.6) * 1.5) * 64, 0, 255);
byte g = (byte)Math.Clamp(Math.Round(1.25 + 0.25 * random.NextDouble() + Math.Sin((j / 10 + (j % 10) / 2 + i * 0.4) * 0.6) * 1.5) * 64, 0, 255);
byte b = (byte)Math.Clamp(Math.Round(1.25 + 0.25 * random.NextDouble() + Math.Sin((j / 10 - (j % 10) / 2 - i * 0.4) * 0.6) * 1.5) * 64, 0, 255);
display2.PutPixel((j / 10), (j % 10), r, g, b);
}

display3.ScreenBuffer[i / 2 + (((i + 1) / 2) % 2) * 50] = ConsoleColor.Green;
Expand Down
8 changes: 4 additions & 4 deletions CSharpBible/ConsoleApps/TestConsole/View/TestConsoleForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@ private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Font f =new Font("Consolas",14);
var fh=f.GetHeight(e.Graphics)-1;
var fw = fh/2-1;
var fh = f.GetHeight(e.Graphics) - 1;
var fw = fh / 2 - 1;
for (int i = 0; i < ScreenBuffer.Length; i++)
{
e.Graphics.FillRectangle(new SolidBrush(ccolors[(int)ScreenBuffer[i].bgr]), (i % ConsoleSize.Width) * fw+2, (i / ConsoleSize.Width) * fh, fw, fh);
e.Graphics.FillRectangle(new SolidBrush(ccolors[(int)ScreenBuffer[i].bgr]), (i % ConsoleSize.Width) * fw + 2, (i / ConsoleSize.Width) * fh, fw, fh);
Brush brush = new SolidBrush(ccolors[(int)ScreenBuffer[i].fgr]);
e.Graphics.DrawString($"{ScreenBuffer[i].ch}", f, brush, (i % ConsoleSize.Width) * fw-2, (i / ConsoleSize.Width) * fh);
e.Graphics.DrawString($"{ScreenBuffer[i].ch}", f, brush, (i % ConsoleSize.Width) * fw - 2, (i / ConsoleSize.Width) * fh);
}
lastUpdate = DateTime.Now;
}
Expand Down
8 changes: 4 additions & 4 deletions CSharpBible/ConsoleApps/WaveFuncCol/Models/WFCModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ public void DisplayTest3(IRandom rnd)

for (int j = 0; j < D2SBuffer().Length; j++)
{
int r = (int)Math.Round(1.25 + 0.5 * rnd.NextDouble() + Math.Sin((j % D2Width - i * 0.4) * -0.6) * 1.5);
int g = (int)Math.Round(1.25 + 0.5 * rnd.NextDouble() + Math.Sin((j / D2Width + j % D2Width / 2 + i * 0.4) * 0.6) * 1.5);
int b = (int)Math.Round(1.25 + 0.5 * rnd.NextDouble() + Math.Sin((j / D2Width - j % D2Width / 2 - i * 0.4) * 0.6) * 1.5);
D2PutPixelC(j / D2Width, j % D2Width, (byte)(r * 64), (byte)(g * 64), (byte)(b * 64));
byte r = (byte)Math.Clamp(Math.Round(1.25 + 0.5 * rnd.NextDouble() + Math.Sin((j % D2Width - i * 0.4) * -0.6) * 1.5) * 64, 0, 255);
byte g = (byte)Math.Clamp(Math.Round(1.25 + 0.5 * rnd.NextDouble() + Math.Sin((j / D2Width + j % D2Width / 2 + i * 0.4) * 0.6) * 1.5) * 64, 0, 255);
byte b = (byte)Math.Clamp(Math.Round(1.25 + 0.5 * rnd.NextDouble() + Math.Sin((j / D2Width - j % D2Width / 2 - i * 0.4) * 0.6) * 1.5) * 64, 0, 255);
D2PutPixelC(j / D2Width, j % D2Width, r, g, b);
}

D3SBuffer()[i / 2 + (i + 1) / 2 % 2 * 50] = ConsoleColor.Green;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ public void Collision_ShipWithAsteroid_ResetsWorld()
// move ship away from center
gw.Ship.Position = new(104, 98);
// place an asteroid at ship
var (asteroids, _) = GetSimLists(gw);
var (asteroids, bullets) = GetSimLists(gw);
asteroids.Clear();
asteroids.Add(new Asteroid { Position = gw.Ship.Position, Velocity = Vector2.Zero, Radius = 20 });
_ = bullets;

gw.Update(_input, _time, _sound);
_sound.Received().PlayBang();
Expand Down
8 changes: 6 additions & 2 deletions CSharpBible/Games/Game_BaseTests/Model/FieldTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,18 @@ namespace Game.Model.Tests;
[TestClass()]
public class FieldTests
{
public override bool Equals(object? obj) => ReferenceEquals(this, obj);

public override int GetHashCode() => base.GetHashCode();

#region Properties
/// <summary>
/// The test field
/// </summary>
/// <autogeneratedoc />
#pragma warning disable CS8618 // Ein Non-Nullable-Feld muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Erwägen Sie die Deklaration als Nullable.
#pragma warning disable CS8618 // Ein Non-Nullable-Feld muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Erw�gen Sie die Deklaration als Nullable.
private Field<TestItem> testField;
#pragma warning restore CS8618 // Ein Non-Nullable-Feld muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Erwägen Sie die Deklaration als Nullable.
#pragma warning restore CS8618 // Ein Non-Nullable-Feld muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Erw�gen Sie die Deklaration als Nullable.
/// <summary>
/// The result data
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions CSharpBible/Games/Game_BaseTests/Model/Playfield2DTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ namespace Game.Model.Tests;
[TestClass]
public class Playfield2DTests
{
public override bool Equals(object? obj) => ReferenceEquals(this, obj);

public override int GetHashCode() => base.GetHashCode();

#pragma warning disable CS8618
private Playfield2D<TestItem2D> _pf;
#pragma warning restore CS8618
Expand Down
2 changes: 1 addition & 1 deletion CSharpBible/Games/Snake_Base/Models/Snake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public class Snake : NotificationObjectAdv
/// The sn body
/// </summary>
/// <autogeneratedoc />
private List<SnakeBodyPart> _snBody = new List<SnakeBodyPart>();
private readonly List<SnakeBodyPart> _snBody = new List<SnakeBodyPart>();
/// <summary>
/// The sn tail
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions CSharpBible/SomeThing/Statistic4/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ void Run(int[] prog)
if (arg < 0 || arg >= templates.Length)
throw new IndexOutOfRangeException($"Template index {arg} out of range.");
string tmpl = templates[arg];
Console.Write(string.Format(CultureInfo.InvariantCulture, tmpl, lastObj));
System.Diagnostics.Debug.Write(string.Format(CultureInfo.InvariantCulture, tmpl, lastObj));
Console.WriteLine(string.Format(CultureInfo.InvariantCulture, tmpl, lastObj));
System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, tmpl, lastObj));
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions GenFreeWin/Druck/Druck/ATo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,7 @@ public void ATperles()
}
Text1 = Pername + "\t";
Text1 = Text1 + VNam + "\t";
if ((Gebdat.Trim() != "") | (Gebdat2.Trim() != ""))
if ((Gebdat.Trim() != "") || (Gebdat2.Trim() != ""))
{
Text1 += "* \t";
}
Expand All @@ -1910,7 +1910,7 @@ public void ATperles()
Text1 += " \t";
}
Text1 = Text1 + Gebdat + "\t" + Gebdat2 + "\t";
if ((Sterdat.Trim() != "") | (sterdat2.Trim() != ""))
if ((Sterdat.Trim() != "") || (sterdat2.Trim() != ""))
{
Text1 += "+ \t";
}
Expand Down
10 changes: 5 additions & 5 deletions GenFreeWin/Druck/Druck/Module2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ public static void Bildaus(string BiKe, string Form)
num = 2;
text = "";
text2 = "";
if ((Modul1.DAus[115] == "1") | (Modul1.DAus[116] == "1"))
if ((Modul1.DAus[115] == "1") || (Modul1.DAus[116] == "1"))
{
DataModul.DB_PictureTable.Index = "Perkenn";
if (BiKe == "P")
Expand All @@ -729,9 +729,9 @@ public static void Bildaus(string BiKe, string Form)
goto IL_0aa3;
IL_0231: // <========== 3
num = 27;
if ((Modul1.DAus[116] == "1") | (Modul1.DAus[115] == "1"))
if ((Modul1.DAus[116] == "1") || (Modul1.DAus[115] == "1"))
{
if (((DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].Value == "Personenbild") | (DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].Value == "Familienbild")).AsBool())
if (((DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].Value == "Personenbild") || (DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].Value == "Familienbild")).AsBool())
{
text3 = text3.Replace("#", "");
fileStream2 = new FileStream(text3, FileMode.Open);
Expand Down Expand Up @@ -817,7 +817,7 @@ public static void Bildaus(string BiKe, string Form)
}
if (left2 == "Ahnen")
{
if ((text.Trim() != "") | (text2.Trim() != ""))
if ((text.Trim() != "") || (text2.Trim() != ""))
{
MyProject.Forms.Ahnen.Anz[0].SelectedText = "\n";
MyProject.Forms.Ahnen.Anz[0].Paste();
Expand Down Expand Up @@ -906,7 +906,7 @@ public static void Bildaus(string BiKe, string Form)
text3 = text3.Replace("#", "");
if (!Information.IsDBNull(DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].Value))
{
if (!((DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].Value == "Personenbild") | (DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].Value == "Familienbild")).AsBool())
if (!((DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].Value == "Personenbild") || (DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].Value == "Familienbild")).AsBool())
{
if (!(DataModul.DB_PictureTable.Fields[PictureFields.Beschreibung].AsString() == "Personenbild"))
{
Expand Down
29 changes: 16 additions & 13 deletions GenFreeWin/Druck/Druck/Views/Anzeige.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private void Befehl_Click(object eventSender, EventArgs eventArgs)
{
RichTextBox1[4].SelectedText = ("Nr.: " + DataModul.DB_QuTable.Fields[QuFields._12].AsString());
}
if ((Operators.CompareString(DataModul.DB_QuTable.Fields[QuFields._11].AsString().Trim(), "", TextCompare: false) != 0) | (Operators.CompareString(DataModul.DB_QuTable.Fields[QuFields._12].AsString().Trim(), "", TextCompare: false) != 0))
if ((Operators.CompareString(DataModul.DB_QuTable.Fields[QuFields._11].AsString().Trim(), "", TextCompare: false) != 0) || (Operators.CompareString(DataModul.DB_QuTable.Fields[QuFields._12].AsString().Trim(), "", TextCompare: false) != 0))
{
RichTextBox1[4].SelectedText = "\n";
}
Expand Down Expand Up @@ -450,7 +450,7 @@ private void Befehl_7_Click()
RichTextBox1[(short)i].Visible = false;
}
RichTextBox1[0].Visible = true;
if ((Listnam == 130) | (Listnam == 119))
if ((Listnam == 130) || (Listnam == 119))
{
Befehl[0].Visible = false;
Befehl[6].Visible = false;
Expand Down Expand Up @@ -1107,7 +1107,7 @@ private void Button1_Click(object sender, EventArgs e)
Aufhoer = " Jahr: " + Strings.Mid((num10 - 10000).AsString(), 2, 4);
}
Bezeichnung8.Text = "Einträge sortieren";
if (iListArt < 400 | iListArt > 1000)
if (iListArt < 400 || iListArt > 1000)
{
Listnam = (short)iListArt;
Bezeichnung1.Text = "Sortierte Personenliste nach" + text4;
Expand Down Expand Up @@ -2082,7 +2082,10 @@ static void GetListArtTexts(int iListArt, out string text3, out string text4)
{
text4 = " kirchl. Heiratsregister";
}
else text4 = text4;
else
{
// Preserve the current value explicitly; this branch is part of the learning exercise.
}
}
void Handle_ListArt_101f(int iListArt, byte b2, int num9, int num10)
{
Expand Down Expand Up @@ -2352,7 +2355,7 @@ private void WriteFamilyList(ref int num, int iListArt, ref string text, ref int
Datmit = 1;
}
_Modul1.Instance.Famles();
if ((_Modul1.Instance.Family.Mann > 0) | (_Modul1.Instance.Family.Frau > 0))
if ((_Modul1.Instance.Family.Mann > 0) || (_Modul1.Instance.Family.Frau > 0))
{
_Modul1.Instance.Famdatles(_Modul1.Instance.FamInArb, out var asFamDates3);
if (asFamDates3[iListArt - 500] == "")
Expand Down Expand Up @@ -2481,7 +2484,7 @@ private void WriteFamilyList(ref int num, int iListArt, ref string text, ref int
DataModul.Link.GetPersonFam(persInArb, ELinkKennz.lkChild, out _Modul1.Instance.FamInArb);
Datmit = 2;
_Modul1.Instance.Famles();
if ((_Modul1.Instance.Family.Mann > 0) | (_Modul1.Instance.Family.Frau > 0)
if ((_Modul1.Instance.Family.Mann > 0) || (_Modul1.Instance.Family.Frau > 0)
&& _Modul1.Instance.Aus[51] == "Y")
{
if (b6 == 1)
Expand Down Expand Up @@ -2625,7 +2628,7 @@ private void WriteList401(RichTextBox richTextBox1_0, Ausw ausw, ref int famInAr
Datmit = 1;
}
_Modul1.Instance.Famles();
if ((_Modul1.Instance.Family.Mann > 0) | (_Modul1.Instance.Family.Frau > 0))
if ((_Modul1.Instance.Family.Mann > 0) || (_Modul1.Instance.Family.Frau > 0))
{
persInArb = _Modul1.Instance.Family.Mann;
if (_Modul1.Instance.Family.Mann > 0)
Expand Down Expand Up @@ -2756,7 +2759,7 @@ private void WriteList401(RichTextBox richTextBox1_0, Ausw ausw, ref int famInAr
}
DataModul.Link.GetPersonFam(persInArb, ELinkKennz.lkChild, out _Modul1.Instance.FamInArb);
_Modul1.Instance.Famles();
if ((_Modul1.Instance.Family.Mann > 0) | (_Modul1.Instance.Family.Frau > 0))
if ((_Modul1.Instance.Family.Mann > 0) || (_Modul1.Instance.Family.Frau > 0))
{
if (ausw_opt3_0)
{
Expand Down Expand Up @@ -2887,7 +2890,7 @@ private void WritePersonList(int iListArt, RichTextBox richTextBox1_0, int persI
DataModul.DSB_SortTable.Index = "Sort";
DataModul.DSB_SortTable.Seek(">=", " ");
IZahl = 0;
if ((Listnam == 130) | (Listnam == 119))
if ((Listnam == 130) || (Listnam == 119))
{
Befehl[0].Visible = false;
Befehl[6].Visible = false;
Expand Down Expand Up @@ -3425,7 +3428,7 @@ private void WritePersonList(int iListArt, RichTextBox richTextBox1_0, int persI
this.PerPos = 2;
if (_Modul1.Instance.Aus[51] == "Y")
{
if ((_Modul1.Instance.Family.Mann > 0) | (_Modul1.Instance.Family.Frau > 0))
if ((_Modul1.Instance.Family.Mann > 0) || (_Modul1.Instance.Family.Frau > 0))
{
if (ausw_opt3_0)
{
Expand Down Expand Up @@ -3743,7 +3746,7 @@ private void WritePersonList(int iListArt, RichTextBox richTextBox1_0, int persI
if (_Modul1.Instance.Aus[51] == "Y")
{
_Modul1.Instance.Famles();
if ((_Modul1.Instance.Family.Mann > 0) | (_Modul1.Instance.Family.Frau > 0))
if ((_Modul1.Instance.Family.Mann > 0) || (_Modul1.Instance.Family.Frau > 0))
{
if (Strings.Mid(richTextBox1_0.Text, richTextBox1_0.SelectionStart, 1) != ".")
{
Expand Down Expand Up @@ -4710,7 +4713,7 @@ private void Write_Kopf(RichTextBox richTextBox1_0)
}
richTextBox1_0.SelectedText = sBez + "\n";
richTextBox1_0.SelectionFont = fntRegular;
if ((Anfang != "") | (Aufhoer != ""))
if ((Anfang != "") || (Aufhoer != ""))
{
if (Anfang != "")
{
Expand Down Expand Up @@ -4837,7 +4840,7 @@ public void Personles()
{
richTextBox1_0.SelectedText = ", Sippe " + _Modul1.Instance.Kont[5];
}
if (ausw.Kontroll[10].Checked | ausw.Kontroll[11].Checked)
if (ausw.Kontroll[10].Checked || ausw.Kontroll[11].Checked)
{
WriteNachnr(richTextBox1_0);
}
Expand Down
4 changes: 2 additions & 2 deletions GenFreeWin/GenFreeBaseTests/Data/IndexDefTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ public class IndexDefTests
{
private ITableDef td;
private IndexDef testClass;
private List<IIndexDef> _ix;
private readonly List<IIndexDef> _ix = new();

[TestInitialize]
public void Init()
{
td = Substitute.For<ITableDef>();
td.Indexes.Returns(_ix = new List<IIndexDef>());
td.Indexes.Returns(_ix);
testClass = new IndexDef(td, "Name", "sField", true, false);
}

Expand Down
Loading
Loading