Skip to content

Instantly share code, notes, and snippets.

View mariusz's full-sized avatar
🤖
[ computing ]

Mariusz Cieśla mariusz

🤖
[ computing ]
View GitHub Profile
public double this[int index]
{
get
{
switch (index)
{
case 0:
return x;
case 1:
return y;
public double this[int index]
{
get
{
switch (index)
{
case 0:
return x;
case 1:
return y;
public override bool Equals(object obj)
{
CustomPoint point = (CustomPoint)obj;
if(point == null)
{
return false;
}
if(this.x == point.x && this.y == point.y)
{
[XmlRoot()]
public class InputData
{
...
}
public void GenerateGrid(int quantityX, int quantityY)
{
this.divX = quantityX + 1;
this.divY = quantityY + 1;
int nodesQuantity = this.divX * this.divY;
float maxWidth = GetStringWidth(nodesQuantity.ToString()) * 1.7f;
this.offsetY = maxWidth;
public static int AddProject(string name, string data)
{
ProjectsTableAdapters.ProjectsTableAdapter adapter = new Preprocessor.ProjectsTableAdapters.ProjectsTableAdapter();
ProjectsDataTable table = adapter.GetData();
ProjectsRow row = table.NewProjectsRow();
row.Name = name;
row.Data = data;
table.Rows.Add((DataRow)row);
private void goButton_Click(object sender, EventArgs e)
{
if (!CheckErrors())
{
return;
}
string data = GetProjectData();
System.IO.StreamWriter writer = new System.IO.StreamWriter("input.xml", false, Encoding.UTF8);
private Dictionary<Side, double> GetValuesForSecondBoundry()
{
Dictionary<Side, double> dict = new Dictionary<Side, double>();
List<Side> sides = EnumToList<Side>();
for (int i = 0; i < this.SideAreaSecondConditionsList.Items.Count; i++)
{
int id = int.Parse(this.SideAreaSecondConditionsList.Items[i].SubItems[2].Text);
dict.Add(sides[id], getValueAsDouble(this.SideAreaSecondConditionsList.Items[i].SubItems[1].Text));
}
public static List<T> EnumToList<T>()
{
Type enumType = typeof(T);
if (enumType.BaseType != typeof(Enum))
throw new ArgumentException("T must be of type System.Enum");
Array enumValArray = Enum.GetValues(enumType);
List<T> enumValList = new List<T>(enumValArray.Length);
public double[][] MatrixH
{
get
{
if (matrixH != null)
{
return (double[][])matrixH;
}
double[][] he = new double[3][];