Compare commits
No commits in common. "7fc6a50c1b404b44a9988c256568a3e244e74d62" and "507118762322d6568cadd14529075ecac9de956e" have entirely different histories.
7fc6a50c1b
...
5071187623
@ -30,17 +30,13 @@ public abstract class AbstractCompany
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Перегрузка оператора сложения для класса
|
// Перегрузка оператора сложения для класса
|
||||||
|
// [ ! ] insted of bool:
|
||||||
public static int operator +(AbstractCompany company,
|
public static int operator +(AbstractCompany company,
|
||||||
DrawningBase transport) => company._collection.Insert(transport, new DrawiningShipEqutables());
|
DrawningBase trasport) => company._collection.Insert(trasport);
|
||||||
|
|
||||||
// Перегрузка оператора удаления для класса
|
// Перегрузка оператора удаления для класса
|
||||||
public static DrawningBase operator -(AbstractCompany company,
|
public static DrawningBase operator -(AbstractCompany company,
|
||||||
int pos) => company._collection?.Remove(pos);
|
int pos) => company._collection.Remove(pos);
|
||||||
|
|
||||||
// Сортировка ----------------------------------------------------------- [!]
|
|
||||||
public void Sort(IComparer<DrawningBase?> comparer) =>
|
|
||||||
_collection?.CollectionSort(comparer);
|
|
||||||
|
|
||||||
|
|
||||||
// Получение случайного объекта из коллекции
|
// Получение случайного объекта из коллекции
|
||||||
public DrawningBase? GetRandomObject()
|
public DrawningBase? GetRandomObject()
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ProjectCruiser.DrawningSamples;
|
using ProjectCruiser.Exceptions;
|
||||||
using ProjectCruiser.Exceptions;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.CollectionGenericObj;
|
namespace ProjectCruiser.CollectionGenericObj;
|
||||||
|
|
||||||
@ -47,19 +46,16 @@ public class ArrayGenObj<T> : ICollectionGenObj<T>
|
|||||||
throw new ObjectNotFoundException(index);
|
throw new ObjectNotFoundException(index);
|
||||||
|
|
||||||
return _collection[index];
|
return _collection[index];
|
||||||
|
|
||||||
|
// CollectionOverflowException
|
||||||
|
// PositionOutOfCollectionException
|
||||||
|
// ObjectNotFoundException
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Insert(T? item, IEqualityComparer<DrawningBase?>? cmpr = null)
|
public int Insert(T? item)
|
||||||
{
|
{
|
||||||
if (item == null) throw
|
if (item == null) throw
|
||||||
new NullReferenceException("> Inserting item is null");
|
new NullReferenceException("> Inserting item is null");
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cmpr != null && item == cmpr)
|
|
||||||
{
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// выход за границы, курируется CollectionOverflowException
|
// выход за границы, курируется CollectionOverflowException
|
||||||
if (Count >= _maxCount) throw new CollectionOverflowException(Count);
|
if (Count >= _maxCount) throw new CollectionOverflowException(Count);
|
||||||
@ -74,23 +70,18 @@ public class ArrayGenObj<T> : ICollectionGenObj<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Count;
|
return Count;
|
||||||
|
|
||||||
|
// NullReferenceException
|
||||||
|
// CollectionOverflowException
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Insert(T? item, int index, IEqualityComparer<DrawningBase?>? cmpr = null)
|
public int Insert(T? item, int index)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (index < 0 || index >= _maxCount) throw new PositionOutOfCollectionException(index);
|
if (index < 0 || index >= _maxCount) throw new PositionOutOfCollectionException(index);
|
||||||
if (Count >= _maxCount) throw new CollectionOverflowException(Count);
|
if (Count >= _maxCount) throw new CollectionOverflowException(Count);
|
||||||
|
|
||||||
if (item == null) throw
|
if (item == null) throw
|
||||||
new NullReferenceException("> Inserting item (at position) is null");
|
new NullReferenceException("> Inserting item (at position) is null");
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cmpr != null && item == cmpr)
|
|
||||||
{
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_collection[index] == null)
|
if (_collection[index] == null)
|
||||||
{
|
{
|
||||||
@ -113,6 +104,10 @@ public class ArrayGenObj<T> : ICollectionGenObj<T>
|
|||||||
_collection[firstNullIndex] = item;
|
_collection[firstNullIndex] = item;
|
||||||
return firstNullIndex;
|
return firstNullIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PositionOutOfCollectionException
|
||||||
|
// CollectionOverflowException
|
||||||
|
// NullReferenceException
|
||||||
}
|
}
|
||||||
|
|
||||||
public T? Remove(int index)
|
public T? Remove(int index)
|
||||||
@ -129,6 +124,9 @@ public class ArrayGenObj<T> : ICollectionGenObj<T>
|
|||||||
if (item == null) throw new ObjectNotFoundException(index);
|
if (item == null) throw new ObjectNotFoundException(index);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
|
// PositionOutOfCollectionException
|
||||||
|
// ObjectNotFoundException
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<T?> GetItems()
|
public IEnumerable<T?> GetItems()
|
||||||
@ -138,10 +136,5 @@ public class ArrayGenObj<T> : ICollectionGenObj<T>
|
|||||||
yield return _collection[i];
|
yield return _collection[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ICollectionGenObj<T>.CollectionSort(IComparer<T?> comparer)
|
|
||||||
{
|
|
||||||
Array.Sort(_collection, comparer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
namespace ProjectCruiser.CollectionGenericObj;
|
|
||||||
|
|
||||||
// Класс, хранящиий информацию по коллекции
|
|
||||||
/// </summary>
|
|
||||||
public class CollectionInfo : IEquatable<CollectionInfo>
|
|
||||||
{
|
|
||||||
// Название коллекции
|
|
||||||
public string Name { get; private set; }
|
|
||||||
|
|
||||||
// Тип
|
|
||||||
public CollectionType CollectionType { get; private set; }
|
|
||||||
|
|
||||||
// Описание
|
|
||||||
public string Description { get; private set; }
|
|
||||||
|
|
||||||
// Разделитель для записи информации по объекту в файл
|
|
||||||
private static readonly string _separator = "-";
|
|
||||||
|
|
||||||
public CollectionInfo(string name, CollectionType collectionType, string
|
|
||||||
description)
|
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
CollectionType = collectionType;
|
|
||||||
Description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Создание объекта из строки
|
|
||||||
public static CollectionInfo? GetCollectionInfo(string data)
|
|
||||||
{
|
|
||||||
string[] strs = data.Split(_separator,
|
|
||||||
StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
if (strs.Length < 1 || strs.Length > 3)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new CollectionInfo(strs[0],
|
|
||||||
(CollectionType)Enum.Parse(typeof(CollectionType),
|
|
||||||
strs[1]), strs.Length > 2 ?
|
|
||||||
strs[2] : string.Empty);
|
|
||||||
}
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Name + _separator + CollectionType + _separator + Description;
|
|
||||||
}
|
|
||||||
public bool Equals(CollectionInfo? other)
|
|
||||||
{
|
|
||||||
// if (Name != other.Name) return false; >>>
|
|
||||||
// else if (CollectionType != other.CollectionType) return false;
|
|
||||||
// else if (Description != other.Description) return false;
|
|
||||||
|
|
||||||
return Name == other?.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Equals(object? obj)
|
|
||||||
{
|
|
||||||
return Equals(obj as CollectionInfo);
|
|
||||||
}
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return Name.GetHashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
|||||||
using ProjectCruiser.DrawningSamples;
|
namespace ProjectCruiser.CollectionGenericObj;
|
||||||
|
|
||||||
namespace ProjectCruiser.CollectionGenericObj;
|
|
||||||
|
|
||||||
public interface ICollectionGenObj<T> where T : class
|
public interface ICollectionGenObj<T> where T : class
|
||||||
{
|
{
|
||||||
@ -13,8 +11,8 @@ public interface ICollectionGenObj<T> where T : class
|
|||||||
/// Добавление объекта в коллекцию
|
/// Добавление объекта в коллекцию
|
||||||
/// <param name="obj">Добавляемый объект</param>
|
/// <param name="obj">Добавляемый объект</param>
|
||||||
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
||||||
int Insert(T obj, IEqualityComparer<DrawningBase?>? cmpr = null);
|
int Insert(T obj);
|
||||||
int Insert(T obj, int position, IEqualityComparer<DrawningBase?>? cmpr = null);
|
int Insert(T obj, int position);
|
||||||
|
|
||||||
/// Удаление объекта из коллекции с конкретной позиции
|
/// Удаление объекта из коллекции с конкретной позиции
|
||||||
/// <param name="position">Позиция</param>
|
/// <param name="position">Позиция</param>
|
||||||
@ -29,8 +27,4 @@ public interface ICollectionGenObj<T> where T : class
|
|||||||
|
|
||||||
// Получение объектов коллекции по одному
|
// Получение объектов коллекции по одному
|
||||||
IEnumerable<T?> GetItems();
|
IEnumerable<T?> GetItems();
|
||||||
|
|
||||||
// Сортировка коллекции
|
|
||||||
/// <param name="comparer">Сравнитель объектов</param>
|
|
||||||
void CollectionSort(IComparer<T?> comparer);
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ProjectCruiser.DrawningSamples;
|
using ProjectCruiser.Exceptions;
|
||||||
using ProjectCruiser.Exceptions;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.CollectionGenericObj;
|
namespace ProjectCruiser.CollectionGenericObj;
|
||||||
|
|
||||||
@ -49,17 +48,10 @@ public class ListGenObj<T> : ICollectionGenObj<T>
|
|||||||
return _collection[position];
|
return _collection[position];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Insert(T? obj, IEqualityComparer<DrawningBase?>? cmpr = null)
|
public int Insert(T? obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
throw new NullReferenceException("> Inserting object is null");
|
throw new NullReferenceException("> Inserting object is null");
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cmpr != null && obj == cmpr)
|
|
||||||
{
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// выход за границы, курируется CollectionOverflowException
|
// выход за границы, курируется CollectionOverflowException
|
||||||
if (Count >= _maxCount) throw new CollectionOverflowException(Count);
|
if (Count >= _maxCount) throw new CollectionOverflowException(Count);
|
||||||
@ -68,7 +60,7 @@ public class ListGenObj<T> : ICollectionGenObj<T>
|
|||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Insert(T? obj, int position, IEqualityComparer<DrawningBase?>? cmpr = null)
|
public int Insert(T? obj, int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= _maxCount)
|
if (position < 0 || position >= _maxCount)
|
||||||
throw new PositionOutOfCollectionException(position);
|
throw new PositionOutOfCollectionException(position);
|
||||||
@ -76,13 +68,6 @@ public class ListGenObj<T> : ICollectionGenObj<T>
|
|||||||
|
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
throw new NullReferenceException("> Inserting object (at position) is null");
|
throw new NullReferenceException("> Inserting object (at position) is null");
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cmpr != null && obj == cmpr)
|
|
||||||
{
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_collection.Insert(position, obj);
|
_collection.Insert(position, obj);
|
||||||
return position;
|
return position;
|
||||||
@ -111,9 +96,4 @@ public class ListGenObj<T> : ICollectionGenObj<T>
|
|||||||
yield return _collection[i];
|
yield return _collection[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ICollectionGenObj<T>.CollectionSort(IComparer<T?> comparer)
|
|
||||||
{
|
|
||||||
_collection.Sort(comparer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,58 +1,56 @@
|
|||||||
using System.CodeDom;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using ProjectCruiser.DrawningSamples;
|
using ProjectCruiser.DrawningSamples;
|
||||||
|
using ProjectCruiser.Exceptions;
|
||||||
|
|
||||||
namespace ProjectCruiser.CollectionGenericObj;
|
namespace ProjectCruiser.CollectionGenericObj;
|
||||||
|
|
||||||
public class StorageCollection<T>
|
public class StorageCollection<T>
|
||||||
where T : DrawningBase // class
|
where T : DrawningBase // class
|
||||||
{
|
{
|
||||||
|
// Разделитель для записи ключа и значения элемента словаря
|
||||||
private readonly string _separatorForKeyValue = "|";
|
private readonly string _separatorForKeyValue = "|";
|
||||||
|
// Разделитель для записей коллекции данных в файл
|
||||||
private readonly string _separatorItems = ";";
|
private readonly string _separatorItems = ";";
|
||||||
|
|
||||||
|
// Ключевое слово, с которого должен начинаться файл
|
||||||
private readonly string _collectionKey = "CollectionsStorage";
|
private readonly string _collectionKey = "CollectionsStorage";
|
||||||
|
|
||||||
// Словарь (хранилище) с коллекциями < CollectionInfo, type (class) >
|
// Словарь (хранилище) с коллекциями < name, type (class) >
|
||||||
readonly Dictionary<CollectionInfo, ICollectionGenObj<T>> _storages;
|
readonly Dictionary<string, ICollectionGenObj<T>> _storages;
|
||||||
|
|
||||||
// Возвращение списка коллекций
|
// Возвращение списка названий коллекций
|
||||||
public List<CollectionInfo> Keys => _storages.Keys.ToList();
|
public List<string> Keys => _storages.Keys.ToList();
|
||||||
|
|
||||||
public StorageCollection()
|
public StorageCollection()
|
||||||
{
|
{
|
||||||
_storages = new Dictionary<CollectionInfo, ICollectionGenObj<T>>();
|
_storages = new Dictionary<string, ICollectionGenObj<T>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Добавление коллекции в хранилище
|
// Добавление коллекции в хранилище
|
||||||
public void AddCollection(string name, CollectionType collType)
|
public void AddCollection(string name, CollectionType collType)
|
||||||
{
|
{
|
||||||
// descroption [ ? ] >>>
|
if (name == null || _storages.ContainsKey(name)
|
||||||
CollectionInfo coll = new CollectionInfo(name, collType, string.Empty);
|
|
||||||
|
|
||||||
if (name == null || _storages.ContainsKey(coll)
|
|
||||||
|| collType == CollectionType.None)
|
|| collType == CollectionType.None)
|
||||||
{
|
{
|
||||||
throw new NullReferenceException("> Not enough information to save");
|
throw new NullReferenceException("> Not enough information to save");
|
||||||
}
|
}
|
||||||
|
|
||||||
_storages.Add(coll, CreateCollection(collType));
|
ICollectionGenObj<T> collection = CreateCollection(collType);
|
||||||
|
_storages.Add(name, collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Удаление коллекции ( по ключу-строке - её имени )
|
// Удаление коллекции ( по ключу-строке - её имени )
|
||||||
public void DelCollection(string name)
|
public void DelCollection(string name)
|
||||||
{
|
{
|
||||||
// descroption [ ? ] >>>
|
if (_storages.ContainsKey(name)) _storages.Remove(name);
|
||||||
CollectionInfo coll = new CollectionInfo(name,
|
|
||||||
CollectionType.None, string.Empty);
|
|
||||||
|
|
||||||
if (_storages.ContainsKey(coll)) _storages.Remove(coll);
|
|
||||||
else throw new NullReferenceException("> No such key in the list");
|
else throw new NullReferenceException("> No such key in the list");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Доступ к коллекции , индексатор [!!!]
|
// Доступ к коллекции ( по ключу-строке - её имени ) - индексатор [!!!]
|
||||||
public ICollectionGenObj<T>? this[string name]
|
public ICollectionGenObj<T>? this[string name]
|
||||||
{
|
{
|
||||||
get => _storages.ContainsKey(new CollectionInfo(name, CollectionType.None, string.Empty))
|
get => _storages.ContainsKey(name) ? _storages[name] : null;
|
||||||
? _storages[new CollectionInfo(name, CollectionType.None, string.Empty)] : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Сохранение информации по автомобилям в хранилище в файл
|
/// Сохранение информации по автомобилям в хранилище в файл
|
||||||
@ -70,14 +68,15 @@ public class StorageCollection<T>
|
|||||||
|
|
||||||
sb.Append(_collectionKey); // const
|
sb.Append(_collectionKey); // const
|
||||||
|
|
||||||
foreach (KeyValuePair<CollectionInfo, ICollectionGenObj<T>> pair in _storages)
|
foreach (KeyValuePair<string, ICollectionGenObj<T>> pair in _storages)
|
||||||
{
|
{
|
||||||
sb.Append(Environment.NewLine); // не сохраняем пустые коллекции
|
sb.Append(Environment.NewLine); // не сохраняем пустые коллекции
|
||||||
if (pair.Value.Count == 0) { continue; }
|
if (pair.Value.Count == 0) { continue; }
|
||||||
|
|
||||||
sb.Append(pair.Key);
|
sb.Append(pair.Key);
|
||||||
sb.Append(_separatorForKeyValue);
|
sb.Append(_separatorForKeyValue);
|
||||||
// <...>
|
sb.Append(pair.Value.GetCollectionType);
|
||||||
|
sb.Append(_separatorForKeyValue);
|
||||||
sb.Append(pair.Value.MaxCount);
|
sb.Append(pair.Value.MaxCount);
|
||||||
sb.Append(_separatorForKeyValue);
|
sb.Append(_separatorForKeyValue);
|
||||||
|
|
||||||
@ -145,19 +144,18 @@ public class StorageCollection<T>
|
|||||||
foreach (string data in companies)
|
foreach (string data in companies)
|
||||||
{
|
{
|
||||||
string[] record = data.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
string[] record = data.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (record.Length != 3) // >
|
if (record.Length != 4) // >
|
||||||
// [key + collType] | maxcount | all next inf > 4
|
// key | collType | maxcount | all next inf > 4
|
||||||
{ continue; }
|
{ continue; }
|
||||||
|
|
||||||
CollectionInfo? collInfo = CollectionInfo.GetCollectionInfo(record[0]) ??
|
CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]);
|
||||||
throw new Exception("[!] Failed to decode information : " + record[0]);
|
ICollectionGenObj<T>? collection = StorageCollection<T>.CreateCollection(collectionType);
|
||||||
|
|
||||||
|
if (collection == null)
|
||||||
|
throw new NullReferenceException("[!] Failed to create collection");
|
||||||
|
|
||||||
ICollectionGenObj<T>? collection = StorageCollection<T>.CreateCollection(
|
collection.MaxCount = Convert.ToInt32(record[2]);
|
||||||
collInfo.CollectionType) ??
|
string[] set = record[3].Split(_separatorItems,
|
||||||
throw new Exception("[!] Failed to create a collection");
|
|
||||||
|
|
||||||
collection.MaxCount = Convert.ToInt32(record[1]);
|
|
||||||
string[] set = record[2].Split(_separatorItems,
|
|
||||||
StringSplitOptions.RemoveEmptyEntries);
|
StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
foreach (string elem in set)
|
foreach (string elem in set)
|
||||||
@ -167,6 +165,10 @@ public class StorageCollection<T>
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
collection.Insert(ship);
|
collection.Insert(ship);
|
||||||
|
|
||||||
|
// throw new IndexOutOfRangeException IF IT WAS Insert(item, pos)
|
||||||
|
// NullReferenceException >
|
||||||
|
// CollectionOverflowException >
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -174,7 +176,7 @@ public class StorageCollection<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_storages.Add(collInfo, collection);
|
_storages.Add(record[0], collection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
namespace ProjectCruiser.DrawningSamples;
|
|
||||||
|
|
||||||
// Сравнение по типу, скорости, весу
|
|
||||||
public class DrawningShipCompare : IComparer<DrawningBase?>
|
|
||||||
{
|
|
||||||
public int Compare(DrawningBase? x, DrawningBase? y)
|
|
||||||
{
|
|
||||||
if (x == null || x.EntityTransport == null)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (y == null || y.EntityTransport == null)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x.GetType().Name != y.GetType().Name)
|
|
||||||
{
|
|
||||||
return x.GetType().Name.CompareTo(y.GetType().Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
var speedCompare = x.EntityTransport.Speed.CompareTo(y.EntityTransport.Speed);
|
|
||||||
if (speedCompare != 0)
|
|
||||||
{
|
|
||||||
return speedCompare;
|
|
||||||
}
|
|
||||||
|
|
||||||
return x.EntityTransport.Weight.CompareTo(y.EntityTransport.Weight);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
namespace ProjectCruiser.DrawningSamples;
|
|
||||||
|
|
||||||
public class DrawningShipCompareByColor : IComparer<DrawningBase?>
|
|
||||||
{
|
|
||||||
public int Compare(DrawningBase? x, DrawningBase? y)
|
|
||||||
{
|
|
||||||
if (x == null || x.EntityTransport == null)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (y == null || y.EntityTransport == null)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var bodycolorCompare = x.EntityTransport.MainColor.Name.CompareTo(
|
|
||||||
y.EntityTransport.MainColor.Name);
|
|
||||||
|
|
||||||
if (bodycolorCompare != 0)
|
|
||||||
{
|
|
||||||
return bodycolorCompare;
|
|
||||||
}
|
|
||||||
|
|
||||||
var speedCompare = x.EntityTransport.Speed.CompareTo(y.EntityTransport.Speed);
|
|
||||||
|
|
||||||
if (speedCompare != 0)
|
|
||||||
{
|
|
||||||
return speedCompare;
|
|
||||||
}
|
|
||||||
|
|
||||||
return x.EntityTransport.Weight.CompareTo(y.EntityTransport.Weight);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using ProjectCruiser.Entities;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.DrawningSamples;
|
|
||||||
|
|
||||||
// Реализация сравнения двух объектов класса-прорисовки
|
|
||||||
public class DrawiningShipEqutables : IEqualityComparer<DrawningBase?>
|
|
||||||
{
|
|
||||||
public bool Equals(DrawningBase? x, DrawningBase? y)
|
|
||||||
{
|
|
||||||
if (x == null || x.EntityTransport == null) return false;
|
|
||||||
if (y == null || y.EntityTransport == null) return false;
|
|
||||||
if (x.GetType().Name != y.GetType().Name) return false;
|
|
||||||
|
|
||||||
if (x.EntityTransport.Speed != y.EntityTransport.Speed) return false;
|
|
||||||
if (x.EntityTransport.Weight != y.EntityTransport.Weight) return false;
|
|
||||||
if (x.EntityTransport.MainColor != y.EntityTransport.MainColor) return false;
|
|
||||||
|
|
||||||
if (x is DrawningCruiser && y is DrawningCruiser)
|
|
||||||
{
|
|
||||||
/* public Color AdditionalColor { get; private set; } // доп. цвет
|
|
||||||
// признаки (наличия)
|
|
||||||
public bool HelicopterPads { get; private set; } // вертолетная площадка
|
|
||||||
public bool Hangars { get; private set; } // ангар */
|
|
||||||
|
|
||||||
EntityCruiser EntityX = (EntityCruiser)x.EntityTransport;
|
|
||||||
EntityCruiser EntityY = (EntityCruiser)y.EntityTransport;
|
|
||||||
|
|
||||||
if (EntityX.AdditionalColor != EntityY.AdditionalColor)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (EntityX.Hangars != EntityY.Hangars)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (EntityX.HelicopterPads != EntityY.HelicopterPads)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public int GetHashCode([DisallowNull] DrawningBase obj)
|
|
||||||
{
|
|
||||||
return obj.GetHashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
78
ProjectCruiser/ServiceForm2.Designer.cs
generated
78
ProjectCruiser/ServiceForm2.Designer.cs
generated
@ -52,8 +52,6 @@
|
|||||||
loadToolStripMenuItem = new ToolStripMenuItem();
|
loadToolStripMenuItem = new ToolStripMenuItem();
|
||||||
saveFileDialog = new SaveFileDialog();
|
saveFileDialog = new SaveFileDialog();
|
||||||
openFileDialog = new OpenFileDialog();
|
openFileDialog = new OpenFileDialog();
|
||||||
btnSortType = new Button();
|
|
||||||
btnSortColor = new Button();
|
|
||||||
groupBox.SuspendLayout();
|
groupBox.SuspendLayout();
|
||||||
companyPanel.SuspendLayout();
|
companyPanel.SuspendLayout();
|
||||||
toolPanel.SuspendLayout();
|
toolPanel.SuspendLayout();
|
||||||
@ -66,7 +64,7 @@
|
|||||||
comboBoxArrList.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
comboBoxArrList.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
comboBoxArrList.FormattingEnabled = true;
|
comboBoxArrList.FormattingEnabled = true;
|
||||||
comboBoxArrList.Items.AddRange(new object[] { "Storage" });
|
comboBoxArrList.Items.AddRange(new object[] { "Storage" });
|
||||||
comboBoxArrList.Location = new Point(17, 38);
|
comboBoxArrList.Location = new Point(17, 51);
|
||||||
comboBoxArrList.Name = "comboBoxArrList";
|
comboBoxArrList.Name = "comboBoxArrList";
|
||||||
comboBoxArrList.Size = new Size(241, 40);
|
comboBoxArrList.Size = new Size(241, 40);
|
||||||
comboBoxArrList.TabIndex = 0;
|
comboBoxArrList.TabIndex = 0;
|
||||||
@ -79,9 +77,9 @@
|
|||||||
groupBox.Controls.Add(toolPanel);
|
groupBox.Controls.Add(toolPanel);
|
||||||
groupBox.Controls.Add(btnCreateCompany);
|
groupBox.Controls.Add(btnCreateCompany);
|
||||||
groupBox.Controls.Add(comboBoxArrList);
|
groupBox.Controls.Add(comboBoxArrList);
|
||||||
groupBox.Location = new Point(1421, 43);
|
groupBox.Location = new Point(1421, 47);
|
||||||
groupBox.Name = "groupBox";
|
groupBox.Name = "groupBox";
|
||||||
groupBox.Size = new Size(273, 964);
|
groupBox.Size = new Size(273, 934);
|
||||||
groupBox.TabIndex = 2;
|
groupBox.TabIndex = 2;
|
||||||
groupBox.TabStop = false;
|
groupBox.TabStop = false;
|
||||||
groupBox.Text = "Tool panel";
|
groupBox.Text = "Tool panel";
|
||||||
@ -95,17 +93,17 @@
|
|||||||
companyPanel.Controls.Add(rBtnArray);
|
companyPanel.Controls.Add(rBtnArray);
|
||||||
companyPanel.Controls.Add(maskedTxtBoxCName);
|
companyPanel.Controls.Add(maskedTxtBoxCName);
|
||||||
companyPanel.Controls.Add(label);
|
companyPanel.Controls.Add(label);
|
||||||
companyPanel.Location = new Point(17, 83);
|
companyPanel.Location = new Point(17, 98);
|
||||||
companyPanel.Name = "companyPanel";
|
companyPanel.Name = "companyPanel";
|
||||||
companyPanel.Size = new Size(243, 359);
|
companyPanel.Size = new Size(243, 391);
|
||||||
companyPanel.TabIndex = 7;
|
companyPanel.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// btnDeleteCollection
|
// btnDeleteCollection
|
||||||
//
|
//
|
||||||
btnDeleteCollection.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
btnDeleteCollection.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
btnDeleteCollection.Location = new Point(16, 276);
|
btnDeleteCollection.Location = new Point(15, 312);
|
||||||
btnDeleteCollection.Name = "btnDeleteCollection";
|
btnDeleteCollection.Name = "btnDeleteCollection";
|
||||||
btnDeleteCollection.Size = new Size(214, 76);
|
btnDeleteCollection.Size = new Size(214, 73);
|
||||||
btnDeleteCollection.TabIndex = 11;
|
btnDeleteCollection.TabIndex = 11;
|
||||||
btnDeleteCollection.Text = "Remove Collection";
|
btnDeleteCollection.Text = "Remove Collection";
|
||||||
btnDeleteCollection.UseVisualStyleBackColor = true;
|
btnDeleteCollection.UseVisualStyleBackColor = true;
|
||||||
@ -114,17 +112,17 @@
|
|||||||
// listBox
|
// listBox
|
||||||
//
|
//
|
||||||
listBox.FormattingEnabled = true;
|
listBox.FormattingEnabled = true;
|
||||||
listBox.Location = new Point(16, 171);
|
listBox.Location = new Point(16, 174);
|
||||||
listBox.Name = "listBox";
|
listBox.Name = "listBox";
|
||||||
listBox.Size = new Size(214, 100);
|
listBox.Size = new Size(214, 132);
|
||||||
listBox.TabIndex = 10;
|
listBox.TabIndex = 10;
|
||||||
//
|
//
|
||||||
// btnAddCollection
|
// btnAddCollection
|
||||||
//
|
//
|
||||||
btnAddCollection.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
btnAddCollection.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
btnAddCollection.Location = new Point(15, 118);
|
btnAddCollection.Location = new Point(15, 119);
|
||||||
btnAddCollection.Name = "btnAddCollection";
|
btnAddCollection.Name = "btnAddCollection";
|
||||||
btnAddCollection.Size = new Size(214, 49);
|
btnAddCollection.Size = new Size(214, 50);
|
||||||
btnAddCollection.TabIndex = 7;
|
btnAddCollection.TabIndex = 7;
|
||||||
btnAddCollection.Text = "Add Collection";
|
btnAddCollection.Text = "Add Collection";
|
||||||
btnAddCollection.UseVisualStyleBackColor = true;
|
btnAddCollection.UseVisualStyleBackColor = true;
|
||||||
@ -144,7 +142,7 @@
|
|||||||
// rBtnArray
|
// rBtnArray
|
||||||
//
|
//
|
||||||
rBtnArray.AutoSize = true;
|
rBtnArray.AutoSize = true;
|
||||||
rBtnArray.Location = new Point(16, 79);
|
rBtnArray.Location = new Point(16, 80);
|
||||||
rBtnArray.Name = "rBtnArray";
|
rBtnArray.Name = "rBtnArray";
|
||||||
rBtnArray.Size = new Size(100, 36);
|
rBtnArray.Size = new Size(100, 36);
|
||||||
rBtnArray.TabIndex = 8;
|
rBtnArray.TabIndex = 8;
|
||||||
@ -171,25 +169,23 @@
|
|||||||
//
|
//
|
||||||
// toolPanel
|
// toolPanel
|
||||||
//
|
//
|
||||||
toolPanel.Controls.Add(btnSortColor);
|
|
||||||
toolPanel.Controls.Add(btnSortType);
|
|
||||||
toolPanel.Controls.Add(btnUpdate);
|
toolPanel.Controls.Add(btnUpdate);
|
||||||
toolPanel.Controls.Add(btnTest);
|
toolPanel.Controls.Add(btnTest);
|
||||||
toolPanel.Controls.Add(maskedTextBoxPosition);
|
toolPanel.Controls.Add(maskedTextBoxPosition);
|
||||||
toolPanel.Controls.Add(btnDelete);
|
toolPanel.Controls.Add(btnDelete);
|
||||||
toolPanel.Controls.Add(btnAddCruiser);
|
toolPanel.Controls.Add(btnAddCruiser);
|
||||||
toolPanel.Enabled = false;
|
toolPanel.Enabled = false;
|
||||||
toolPanel.Location = new Point(26, 537);
|
toolPanel.Location = new Point(26, 608);
|
||||||
toolPanel.Name = "toolPanel";
|
toolPanel.Name = "toolPanel";
|
||||||
toolPanel.Size = new Size(226, 415);
|
toolPanel.Size = new Size(226, 317);
|
||||||
toolPanel.TabIndex = 13;
|
toolPanel.TabIndex = 13;
|
||||||
//
|
//
|
||||||
// btnUpdate
|
// btnUpdate
|
||||||
//
|
//
|
||||||
btnUpdate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
btnUpdate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
btnUpdate.Location = new Point(16, 350);
|
btnUpdate.Location = new Point(16, 257);
|
||||||
btnUpdate.Name = "btnUpdate";
|
btnUpdate.Name = "btnUpdate";
|
||||||
btnUpdate.Size = new Size(193, 57);
|
btnUpdate.Size = new Size(192, 41);
|
||||||
btnUpdate.TabIndex = 6;
|
btnUpdate.TabIndex = 6;
|
||||||
btnUpdate.Text = "Update";
|
btnUpdate.Text = "Update";
|
||||||
btnUpdate.UseVisualStyleBackColor = true;
|
btnUpdate.UseVisualStyleBackColor = true;
|
||||||
@ -198,9 +194,9 @@
|
|||||||
// btnTest
|
// btnTest
|
||||||
//
|
//
|
||||||
btnTest.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
btnTest.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
btnTest.Location = new Point(17, 142);
|
btnTest.Location = new Point(17, 162);
|
||||||
btnTest.Name = "btnTest";
|
btnTest.Name = "btnTest";
|
||||||
btnTest.Size = new Size(192, 80);
|
btnTest.Size = new Size(192, 89);
|
||||||
btnTest.TabIndex = 5;
|
btnTest.TabIndex = 5;
|
||||||
btnTest.Text = "Choose\r\nfor testing";
|
btnTest.Text = "Choose\r\nfor testing";
|
||||||
btnTest.UseVisualStyleBackColor = true;
|
btnTest.UseVisualStyleBackColor = true;
|
||||||
@ -209,7 +205,7 @@
|
|||||||
// maskedTextBoxPosition
|
// maskedTextBoxPosition
|
||||||
//
|
//
|
||||||
maskedTextBoxPosition.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
maskedTextBoxPosition.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
maskedTextBoxPosition.Location = new Point(17, 55);
|
maskedTextBoxPosition.Location = new Point(17, 68);
|
||||||
maskedTextBoxPosition.Mask = "00";
|
maskedTextBoxPosition.Mask = "00";
|
||||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||||
maskedTextBoxPosition.Size = new Size(192, 39);
|
maskedTextBoxPosition.Size = new Size(192, 39);
|
||||||
@ -219,9 +215,9 @@
|
|||||||
// btnDelete
|
// btnDelete
|
||||||
//
|
//
|
||||||
btnDelete.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
btnDelete.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
btnDelete.Location = new Point(17, 99);
|
btnDelete.Location = new Point(16, 113);
|
||||||
btnDelete.Name = "btnDelete";
|
btnDelete.Name = "btnDelete";
|
||||||
btnDelete.Size = new Size(192, 41);
|
btnDelete.Size = new Size(192, 43);
|
||||||
btnDelete.TabIndex = 4;
|
btnDelete.TabIndex = 4;
|
||||||
btnDelete.Text = "Delete";
|
btnDelete.Text = "Delete";
|
||||||
btnDelete.UseVisualStyleBackColor = true;
|
btnDelete.UseVisualStyleBackColor = true;
|
||||||
@ -230,9 +226,9 @@
|
|||||||
// btnAddCruiser
|
// btnAddCruiser
|
||||||
//
|
//
|
||||||
btnAddCruiser.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
btnAddCruiser.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
btnAddCruiser.Location = new Point(16, 4);
|
btnAddCruiser.Location = new Point(17, 13);
|
||||||
btnAddCruiser.Name = "btnAddCruiser";
|
btnAddCruiser.Name = "btnAddCruiser";
|
||||||
btnAddCruiser.Size = new Size(192, 48);
|
btnAddCruiser.Size = new Size(192, 49);
|
||||||
btnAddCruiser.TabIndex = 2;
|
btnAddCruiser.TabIndex = 2;
|
||||||
btnAddCruiser.Text = "Add cruiser";
|
btnAddCruiser.Text = "Add cruiser";
|
||||||
btnAddCruiser.UseVisualStyleBackColor = true;
|
btnAddCruiser.UseVisualStyleBackColor = true;
|
||||||
@ -241,9 +237,9 @@
|
|||||||
// btnCreateCompany
|
// btnCreateCompany
|
||||||
//
|
//
|
||||||
btnCreateCompany.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
btnCreateCompany.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
btnCreateCompany.Location = new Point(17, 447);
|
btnCreateCompany.Location = new Point(16, 510);
|
||||||
btnCreateCompany.Name = "btnCreateCompany";
|
btnCreateCompany.Name = "btnCreateCompany";
|
||||||
btnCreateCompany.Size = new Size(245, 85);
|
btnCreateCompany.Size = new Size(245, 79);
|
||||||
btnCreateCompany.TabIndex = 12;
|
btnCreateCompany.TabIndex = 12;
|
||||||
btnCreateCompany.Text = "Create or switch to Company";
|
btnCreateCompany.Text = "Create or switch to Company";
|
||||||
btnCreateCompany.UseVisualStyleBackColor = true;
|
btnCreateCompany.UseVisualStyleBackColor = true;
|
||||||
@ -299,28 +295,6 @@
|
|||||||
//
|
//
|
||||||
openFileDialog.Filter = "txt file|*.txt";
|
openFileDialog.Filter = "txt file|*.txt";
|
||||||
//
|
//
|
||||||
// btnSortType
|
|
||||||
//
|
|
||||||
btnSortType.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
btnSortType.Location = new Point(16, 232);
|
|
||||||
btnSortType.Name = "btnSortType";
|
|
||||||
btnSortType.Size = new Size(192, 52);
|
|
||||||
btnSortType.TabIndex = 7;
|
|
||||||
btnSortType.Text = "Sort by type";
|
|
||||||
btnSortType.UseVisualStyleBackColor = true;
|
|
||||||
btnSortType.Click += btnSortType_Click;
|
|
||||||
//
|
|
||||||
// btnSortColor
|
|
||||||
//
|
|
||||||
btnSortColor.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
btnSortColor.Location = new Point(16, 285);
|
|
||||||
btnSortColor.Name = "btnSortColor";
|
|
||||||
btnSortColor.Size = new Size(192, 52);
|
|
||||||
btnSortColor.TabIndex = 8;
|
|
||||||
btnSortColor.Text = "Sort by color";
|
|
||||||
btnSortColor.UseVisualStyleBackColor = true;
|
|
||||||
btnSortColor.Click += btnSortColor_Click;
|
|
||||||
//
|
|
||||||
// ServiceForm2
|
// ServiceForm2
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
@ -370,7 +344,5 @@
|
|||||||
private ToolStripMenuItem loadToolStripMenuItem;
|
private ToolStripMenuItem loadToolStripMenuItem;
|
||||||
private SaveFileDialog saveFileDialog;
|
private SaveFileDialog saveFileDialog;
|
||||||
private OpenFileDialog openFileDialog;
|
private OpenFileDialog openFileDialog;
|
||||||
private Button btnSortColor;
|
|
||||||
private Button btnSortType;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -177,8 +177,7 @@ public partial class ServiceForm2 : Form
|
|||||||
{
|
{
|
||||||
MessageBox.Show("Collection was not choosed");
|
MessageBox.Show("Collection was not choosed");
|
||||||
return;
|
return;
|
||||||
}
|
} if (MessageBox.Show("Are you sure?", "Removing",
|
||||||
if (MessageBox.Show("Are you sure?", "Removing",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Question)
|
MessageBoxButtons.OK, MessageBoxIcon.Question)
|
||||||
!= DialogResult.OK) return;
|
!= DialogResult.OK) return;
|
||||||
|
|
||||||
@ -200,8 +199,7 @@ public partial class ServiceForm2 : Form
|
|||||||
listBox.Items.Clear();
|
listBox.Items.Clear();
|
||||||
for (int i = 0; i < _storageCollection.Keys?.Count; ++i)
|
for (int i = 0; i < _storageCollection.Keys?.Count; ++i)
|
||||||
{
|
{
|
||||||
string? collName = _storageCollection.Keys?[i].Name;
|
string? collName = _storageCollection.Keys?[i];
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(collName))
|
if (!string.IsNullOrEmpty(collName))
|
||||||
{
|
{
|
||||||
listBox.Items.Add(collName);
|
listBox.Items.Add(collName);
|
||||||
@ -266,6 +264,12 @@ public partial class ServiceForm2 : Form
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_storageCollection.LoadData(openFileDialog.FileName);
|
_storageCollection.LoadData(openFileDialog.FileName);
|
||||||
|
// LoadData() : Exceptions
|
||||||
|
// FileNotFoundException
|
||||||
|
// NullReferenceException
|
||||||
|
// InvalidDataException
|
||||||
|
// IndexOutOfRangeException
|
||||||
|
// CollectionOverflowException
|
||||||
|
|
||||||
MessageBox.Show(" < Loaded succesfully >",
|
MessageBox.Show(" < Loaded succesfully >",
|
||||||
"Result :", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
"Result :", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
@ -281,25 +285,4 @@ public partial class ServiceForm2 : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Сортировка по сравнителю
|
|
||||||
private void CompareShips(IComparer<DrawningBase?> comparer)
|
|
||||||
{
|
|
||||||
if (_company == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_company.Sort(comparer);
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnSortType_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CompareShips(new DrawningShipCompare());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnSortColor_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CompareShips(new DrawningShipCompareByColor());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user