Conversation
Homework3/LZW/LZW/Bor.cs
Outdated
| /// <summary> | ||
| /// A class representing the bor data structure | ||
| /// </summary> | ||
| public class Bor |
Homework3/LZW/LZW/Bor.cs
Outdated
| public int GetCode() | ||
| { | ||
| return currentNode.Code; | ||
| } |
There was a problem hiding this comment.
| public int GetCode() | |
| { | |
| return currentNode.Code; | |
| } | |
| public int GetCode() | |
| => currentNode.Code; |
Homework3/LZW/LZW/Bor.cs
Outdated
| /// <summary> | ||
| /// Function to add a byte | ||
| /// </summary> | ||
| /// <param name="byteToAdd"> byte to add </param> |
There was a problem hiding this comment.
| /// <param name="byteToAdd"> byte to add </param> | |
| /// <param name="byteToAdd"> Byte to add </param> |
Homework3/LZW/LZW/LZW.cs
Outdated
| { | ||
|
|
||
| string fileName = Path.GetFileNameWithoutExtension(pathToFileToCompress); |
There was a problem hiding this comment.
| { | |
| string fileName = Path.GetFileNameWithoutExtension(pathToFileToCompress); | |
| { | |
| string fileName = Path.GetFileNameWithoutExtension(pathToFileToCompress); |
После открывающей фигурной скобки пустая строка не ставится
| using FileStream fs = new(fileName, FileMode.Create); | ||
|
|
||
| // Reading all bytes from a file | ||
| var stringToConvert = File.ReadAllBytes(pathToFileToCompress); |
There was a problem hiding this comment.
Вообще, может быть плохой идеей читать файл в память целиком. Файлы бывают большие. Тем более что LZW может работать побайтово. Но это можно не править, для учебных целей вполне ок.
Homework3/LZW/LZW/Solution.cs
Outdated
| { | ||
| if (args.Length != 2) | ||
| { | ||
| throw new FileNotFoundException(); |
There was a problem hiding this comment.
Не, а кто его поймает, если исключение бросается прямо из Main- а? Тут надо вежливо поругаться и рассказать, какие параметры программа ожидает.
Homework3/LZW/LZW/Solution.cs
Outdated
| if (args[1] == "-u") | ||
| { | ||
| LZW.DecompressFile(pathToFile); | ||
| } |
There was a problem hiding this comment.
А если не -c и не -u, то надо что-то сказать пользователю
Homework3/LZW/LZWTest/BorTest.cs
Outdated
|
|
||
| public class BorTest | ||
| { | ||
| Bor bor = new(); |
There was a problem hiding this comment.
| Bor bor = new(); | |
| private Bor bor = new(); |
Homework3/LZW/LZWTest/LZWTest.cs
Outdated
| var firstString = File.ReadAllBytes(filename); | ||
| var secondString = File.ReadAllBytes("..//..//..//Test"); | ||
| Assert.AreEqual(firstString, secondString); | ||
| } |
There was a problem hiding this comment.
На одном файле работает. А на пустом, на текстовом/бинарном?
Homework3/LZW/LZW/LZW.cs
Outdated
| { | ||
|
|
||
| string fileName = Path.GetFileNameWithoutExtension(pathToFileToCompress); | ||
| fileName = $"{pathToFileToCompress}..//..//{fileName}.zipped"; |
There was a problem hiding this comment.
Так мы теряем расширение файла в процессе запаковки/распаковки, что не очень.
Added comments Fixed a problem with file extension loss
No description provided.