public void ReadFile() { int[] arraytmp = new int[arrayLength]; BinaryReader BiRead = null; try { BiRead = new BinaryReader(File.Open(PathFile, FileMode.Open)); SortName tmpSortName = (SortName)BiRead.ReadByte(); ConsoleManager.SpecifiedColorSendToConsole(tmpSortName.ToString(), ConsoleColor.Yellow); for (int i = 0; i < arrayLength; i++) { arraytmp[i] = BiRead.ReadInt32(); } if (TestSort(arraytmp)) { ConsoleManager.GreenSendToConSole("Массив отсортирован правильно"); } else { ConsoleManager.RedSendToConsole("Массив отсортирован не правильно"); } } catch (Exception e) { ConsoleManager.RedSendToConsole(e.Message); } finally { BiRead.Close(); } }
public void ManagerSort(int len, int max, int min, SortName sort) { Sort Lab = new Sort(len); Lab.SetRandMax(max); Lab.SetRandMin(min); Console.WriteLine("Зарандомил"); Lab.Fill(FillType.RANDOM); Console.WriteLine("Сортонул"); Lab.ChoiceSort(sort); Lab.WriteInConsoleInfo(); Console.WriteLine("Инкрементнул"); Lab.Fill(FillType.INCREMENT); Lab.ChoiceSort(sort); Lab.WriteInConsoleInfo(); Console.WriteLine("Декрементнул"); Lab.Fill(FillType.DECREMENT); Lab.ChoiceSort(sort); Lab.WriteInConsoleInfo(); Lab.WriteFile((byte)sort); Lab.ReadFile(); }
public void ReadBinaryFile() { BinaryReader BiRead = null; if (File.Exists(pathFile)) { try { BiRead = new BinaryReader(File.Open(pathFile, FileMode.Open)); long tmpLength = ((BiRead.BaseStream.Length - 1) / 4); int[] tmpArray = new int[tmpLength]; SortName tmpSortName = (SortName)BiRead.ReadByte(); consoleManager.SpecifiedColorSendToConsole(tmpSortName.ToString(), ConsoleColor.Yellow); for (int i = 0; i < tmpLength; i++) { tmpArray[i] = BiRead.ReadInt32(); } InitializationArray(tmpArray); } catch (Exception e) { consoleManager.RedSendToConsole(e.Message); } finally { BiRead.Close(); } } else { consoleManager.RedSendToConsole("Файла по пути " + pathFile + " нет"); } }
int IComparable <EpisodeData> .CompareTo(EpisodeData other) { if (other == null) { return(1); } var compare = SortName.CompareTo(other.SortName); if (compare == 0) { compare = SeasonNumber.PadLeft(2, '0').CompareTo(other.SeasonNumber.PadLeft(2, '0')); } if (compare == 0) { compare = EpisodeNumber.CompareTo(other.EpisodeNumber); } if (compare == 0) { compare = AddInfo.CompareTo(other.AddInfo); } return(compare); }
public void addDragScript() { foreach (GameObject nameBlock in allNameBlocks) { sortName = nameBlock.AddComponent <SortName>(); nameBlock.GetComponent <Button>().interactable = true; } }
public void WriteToFileTests() { SortName.WriteToFile(names); string[] testsortednames = File.ReadAllLines(@"sorted-names-list.txt"); Assert.IsNotNull(testsortednames); }
public int CompareTo(AnimeGroupVM obj) { switch (SortMethod) { case AnimeGroupSortMethod.SortName: return(SortName.CompareTo(obj.SortName)); case AnimeGroupSortMethod.IsFave: return(IsFave.CompareTo(obj.IsFave)); default: return(SortName.CompareTo(obj.SortName)); } }
static public void Sort(ref int[] array, SortName sortName = SortName.MergeSort) { switch (sortName) { case SortName.MergeSort: MergeSort(ref array); break; case SortName.QuickSort: QuickSort(ref array); break; default: Array.Sort(array); break; } }
static void Main(string[] args) { StandardMessage.Welcome(); StandardMessage.AddLine(1); string data = SortName.InputFile(); IList <string> names = SortName.ReadData(data); List <NameModel> people = new List <NameModel>(); StandardMessage.Enter(); StandardMessage.Clear(); SortName.Sort(names, people); StandardMessage.AddLine(1); ExportSortedNames.Export(people); }
static void Main(string[] args) { try { if (args == null || args.Length <= 0) { ILog log = new FileLog(); log.Log("The agrument is null"); } else { string fileName = string.Empty; IGetFileName getFileName = new FileName(); fileName = getFileName.GetFileName(args[0]); List <Name> nameList = new List <Name>(); IReadLine readline = new Readline(); nameList = readline.ReadLine(fileName); List <Name> sortedNameList = new List <Name>(); ISortName sortName = new SortName(); sortedNameList = sortName.Sort(nameList); IPrintName printName = new PrintName(); printName.PrintNameToScreen(sortedNameList); IWriteNameToFile writeNameToFile = new WriteNameToFile(); writeNameToFile.WriteName(sortedNameList); Console.ReadLine(); } } catch (Exception ex) { Console.WriteLine("The file could not be read:"); Console.WriteLine(ex.Message); ILog log = new FileLog(); log.Log("The file could not be read:" + ex); } }
public int CompareTo(AnimeSeriesVM obj) { switch (SortType) { case SortMethod.SortName: return(SortName.CompareTo(obj.SortName)); case SortMethod.AirDate: if (AniDB_Anime.AirDate.HasValue && obj.AniDB_Anime.AirDate.HasValue) { return(AniDB_Anime.AirDate.Value.CompareTo(obj.AniDB_Anime.AirDate.Value)); } else { return(0); } default: return(SortName.CompareTo(obj.SortName)); } }
public dynamic GetSearchListByPage(string searchKey, int pageSize = 10, int pageIndex = 1, SortName sortName = SortName.CreateTime) { List <VideoView> videolist = new List <VideoView>(); int _totalcount = 0; if (string.IsNullOrEmpty(searchKey)) { return(new { msg = LanguageUtil.Translate("api_Controller_Video_GetSearchListByPage_msg") }); } try { videolist = _videoBusiness.SearchVideoByPage(searchKey, out _totalcount, pageSize, pageIndex, sortName); int _totalPage = (int)Math.Ceiling(_totalcount / (pageSize * 1.0)); return(new { msg = "success", page = new { totalNum = _totalcount, totalPage = _totalPage }, listdata = videolist }); } catch (Exception ex) { return(new { msg = ex.Message }); } }
void EditLabel(int check) { if (check == 0) { label1.Hide(); label2.Hide(); label3.Hide(); label4.Hide(); label5.Hide(); textBox2.Hide(); textBox3.Hide(); textBox4.Hide(); textBox5.Hide(); textBox6.Hide(); button6.Hide(); DeleteBtn.Hide(); SearchBtn.Hide(); SortName.Hide(); SortGroup.Hide(); SortPoint.Hide(); } if (check == 1) { label1.Show(); label2.Show(); label3.Show(); label4.Show(); label5.Show(); textBox2.Show(); textBox3.Show(); textBox4.Show(); textBox5.Show(); textBox6.Show(); button6.Show(); DeleteBtn.Hide(); SortName.Hide(); SortGroup.Hide(); SortPoint.Hide(); } if (check == 2) { DeleteBtn.Show(); label1.Show(); label2.Hide(); label3.Hide(); label4.Hide(); label5.Hide(); textBox2.Show(); textBox3.Hide(); textBox4.Hide(); textBox5.Hide(); textBox6.Hide(); button6.Hide(); SearchBtn.Hide(); SortName.Hide(); SortGroup.Hide(); SortPoint.Hide(); } if (check == 3) { SearchBtn.Show(); label1.Show(); label2.Hide(); label3.Hide(); label4.Hide(); label5.Hide(); textBox2.Show(); textBox3.Hide(); textBox4.Hide(); textBox5.Hide(); textBox6.Hide(); button6.Hide(); DeleteBtn.Hide(); SortName.Hide(); SortGroup.Hide(); SortPoint.Hide(); } if (check == 4) { SearchBtn.Hide(); label1.Hide(); label2.Hide(); label3.Hide(); label4.Hide(); label5.Hide(); textBox2.Hide(); textBox3.Hide(); textBox4.Hide(); textBox5.Hide(); textBox6.Hide(); button6.Hide(); DeleteBtn.Hide(); SortName.Show(); SortGroup.Show(); SortPoint.Show(); } }
public int CompareTo(Contract_AnimeGroup obj) { return(SortName.CompareTo(obj.SortName)); }
new BoxManipSort(SortName, list => list.OrderBySpeciesName(GameInfo.Strings.Species)),
public int CompareTo(AnimeGroupVM obj) { return(SortName.CompareTo(obj.SortName)); }
public void ChoiceSort(SortName sort) { switch (sort) { case SortName.SELECTIONSORT: ConsoleManager.GreenSendToConSole("Сортировка Выбором"); SetNullForCompareAndTransposition(); SetStart(); SelectionSort(0, arrayLength - 1); SetEnd(); SetInterval(); break; case SortName.INSERTIONSORT: ConsoleManager.GreenSendToConSole("Сортировка Вставками"); SetNullForCompareAndTransposition(); SetStart(); InsertionSort(0, arrayLength - 1); SetEnd(); SetInterval(); break; case SortName.BUBBLESORT: ConsoleManager.GreenSendToConSole("Сортировка Пузырьком"); SetNullForCompareAndTransposition(); SetStart(); BubbleSort(0, arrayLength - 1); SetEnd(); SetInterval(); break; case SortName.SHAKERSORT: ConsoleManager.GreenSendToConSole("Сортировка Шейкерная"); SetNullForCompareAndTransposition(); SetStart(); ShakerSort(0, arrayLength - 1); SetEnd(); SetInterval(); break; case SortName.SHELLSORT: ConsoleManager.GreenSendToConSole("Сортировка Шелла"); SetNullForCompareAndTransposition(); SetStart(); ShellSort(0, arrayLength - 1); SetEnd(); SetInterval(); break; case SortName.MERGESORT: MySorts = new MergeSort(array); ConsoleManager.GreenSendToConSole("Сортировка Слиянием"); SetNullForCompareAndTransposition(); SetStart(); MySorts.Sort(0, arrayLength - 1); SetEnd(); SetInterval(); array = MySorts.a; break; case SortName.QUICKSORT: MySorts = new QuickSort(array); ConsoleManager.GreenSendToConSole("Быстрая сортировка"); SetNullForCompareAndTransposition(); SetStart(); MySorts.Sort(0, arrayLength - 1); SetEnd(); SetInterval(); array = MySorts.a; break; case SortName.HEAPSORT: MySorts = new HeapSorter(array); ConsoleManager.GreenSendToConSole("Сортировка Кучей"); SetNullForCompareAndTransposition(); SetStart(); MySorts.Sort(0, arrayLength - 1); SetEnd(); SetInterval(); array = MySorts.a; break; default: break; } }
public void GetListofFullNamesTests() { List <FullName> TestNameList = SortName.GetListofFullNames(names); Assert.IsNotNull(TestNameList); }