mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 17:25:32 +00:00
Ported libs fo net V6
This commit is contained in:
15
HaDocumentV6/Comparers/CommentComparer.cs
Normal file
15
HaDocumentV6/Comparers/CommentComparer.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using HaDocument.Models;
|
||||
|
||||
namespace HaDocument.Comparers {
|
||||
public class CommentComparer : IComparer<Comment> {
|
||||
public int Compare(Comment first, Comment second) {
|
||||
if (first.Order != second.Order)
|
||||
return first.Order.CompareTo(second.Order);
|
||||
else
|
||||
return first.Index.CompareTo(second.Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
HaDocumentV6/Comparers/DefaultComparer.cs
Normal file
22
HaDocumentV6/Comparers/DefaultComparer.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HaDocument.Models;
|
||||
|
||||
namespace HaDocument.Comparers
|
||||
{
|
||||
public class DefaultComparer : IComparer<Meta>
|
||||
{
|
||||
public int Compare(Meta first, Meta second)
|
||||
{
|
||||
if (first.Sort != second.Sort)
|
||||
return System.DateTime.Compare(first.Sort, second.Sort);
|
||||
else if (first.Order != second.Order)
|
||||
return first.Order.CompareTo(second.Order);
|
||||
else
|
||||
return String.Compare(first.Index, second.Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
HaDocumentV6/Comparers/PersonComparer.cs
Normal file
13
HaDocumentV6/Comparers/PersonComparer.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using HaDocument.Models;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HaDocument.Comparers {
|
||||
public class PersonComparer : IComparer<Person> {
|
||||
public int Compare(Person first, Person second) {
|
||||
var cmp = String.Compare(first.Surname, second.Surname);
|
||||
if (cmp == 0) cmp = String.Compare(first.Name, second.Name);
|
||||
return cmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
41
HaDocumentV6/Comparers/ZHComparer.cs
Normal file
41
HaDocumentV6/Comparers/ZHComparer.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HaDocument.Models;
|
||||
|
||||
namespace HaDocument.Comparers
|
||||
{
|
||||
public class ZHComparer : IComparer<Meta>
|
||||
{
|
||||
public int Compare(Meta first, Meta second)
|
||||
{
|
||||
var firstNumber = 0;
|
||||
var secondNumber = 0;
|
||||
Int32.TryParse(first.Index, out firstNumber);
|
||||
Int32.TryParse(second.Index, out secondNumber);
|
||||
return firstNumber.CompareTo(secondNumber);
|
||||
|
||||
//var firstIndex = from c in first.Meta.Autopsic
|
||||
// where char.IsDigit(c)
|
||||
// select c;
|
||||
//var secondIndex = from c in second.Meta.Autopsic
|
||||
// where char.IsDigit(c)
|
||||
// select c;
|
||||
//int firstNumber = 0;
|
||||
//int secondNumber = 0;
|
||||
//Int32.TryParse(String.Join("", firstIndex), out firstNumber);
|
||||
//Int32.TryParse(String.Join("", secondIndex), out secondNumber);
|
||||
//if (firstNumber.CompareTo(secondNumber) != 0)
|
||||
// return firstNumber.CompareTo(secondNumber);
|
||||
//var firstChar = from c in first.Meta.Autopsic
|
||||
// where char.IsMeta(c)
|
||||
// select c;
|
||||
//var secondChar = from c in first.Meta.Autopsic
|
||||
// where char.IsMeta(c)
|
||||
// select c;
|
||||
//return String.Compare(String.Join("", firstChar), String.Join("", secondChar));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user