Formats UO Content (#201)

This commit is contained in:
Kamron Batman 2020-08-27 18:30:38 -07:00 • committed by GitHub
parent 86b7b3aed1
commit ad3775c4d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3249 changed files with 431083 additions and 440981 deletions

View file

@ -1,49 +1,49 @@
namespace Server.Items
{
public class BookContent
{
public BookContent(string title, string author, params BookPageInfo[] pages)
{
Title = title;
Author = author;
Pages = pages;
}
public string Title { get; }
public string Author { get; }
public BookPageInfo[] Pages { get; }
public BookPageInfo[] Copy()
{
BookPageInfo[] copy = new BookPageInfo[Pages.Length];
for (int i = 0; i < copy.Length; ++i)
copy[i] = new BookPageInfo(Pages[i].Lines);
return copy;
}
public bool IsMatch(BookPageInfo[] cmp)
{
if (cmp.Length != Pages.Length)
return false;
for (int i = 0; i < cmp.Length; ++i)
{
string[] a = Pages[i].Lines;
string[] b = cmp[i].Lines;
if (a.Length != b.Length) return false;
if (a != b)
for (int j = 0; j < a.Length; ++j)
if (a[j] != b[j])
return false;
}
return true;
}
}
}
namespace Server.Items
{
public class BookContent
{
public BookContent(string title, string author, params BookPageInfo[] pages)
{
Title = title;
Author = author;
Pages = pages;
}
public string Title { get; }
public string Author { get; }
public BookPageInfo[] Pages { get; }
public BookPageInfo[] Copy()
{
var copy = new BookPageInfo[Pages.Length];
for (var i = 0; i < copy.Length; ++i)
copy[i] = new BookPageInfo(Pages[i].Lines);
return copy;
}
public bool IsMatch(BookPageInfo[] cmp)
{
if (cmp.Length != Pages.Length)
return false;
for (var i = 0; i < cmp.Length; ++i)
{
var a = Pages[i].Lines;
var b = cmp[i].Lines;
if (a.Length != b.Length) return false;
if (a != b)
for (var j = 0; j < a.Length; ++j)
if (a[j] != b[j])
return false;
}
return true;
}
}
}