Compare commits
10 Commits
44025963ed
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12135deea1 | ||
|
|
04072d831e | ||
|
|
3d69c8b93d | ||
|
|
1086760c4a | ||
|
|
37013ec1fc | ||
|
|
6f32a80836 | ||
|
|
de4fd98cc7 | ||
|
|
0a53cd8bd4 | ||
|
|
bf8924f664 | ||
|
|
122e5f8208 |
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -1,7 +1,10 @@
|
|||||||
{
|
{
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"decode.h": "c",
|
"decode.h": "c",
|
||||||
"unity_test_module.h": "c"
|
"unity_test_module.h": "c",
|
||||||
|
"cstdint": "c",
|
||||||
|
"cstdlib": "c",
|
||||||
|
"stdio.h": "c"
|
||||||
},
|
},
|
||||||
"cmake.sourceDirectory": "/home/rens/files/T2/HC/holyc-lang/src"
|
"cmake.sourceDirectory": "/home/rens/files/T2/HC/holyc-lang/src"
|
||||||
}
|
}
|
||||||
Binary file not shown.
BIN
C/C2 AnimalShelter/build/main_test
Normal file → Executable file
BIN
C/C2 AnimalShelter/build/main_test
Normal file → Executable file
Binary file not shown.
@@ -7,53 +7,45 @@
|
|||||||
#include "animal.h"
|
#include "animal.h"
|
||||||
|
|
||||||
int addAnimal(const Animal* animalPtr, Animal* animalArray, size_t animalArrayLength, size_t numberOfAnimalsPresent, size_t* newNumberOfAnimalsPresent){
|
int addAnimal(const Animal* animalPtr, Animal* animalArray, size_t animalArrayLength, size_t numberOfAnimalsPresent, size_t* newNumberOfAnimalsPresent){
|
||||||
int fault = 0;
|
if (animalArray == NULL || animalPtr == NULL || newNumberOfAnimalsPresent == NULL || numberOfAnimalsPresent >= animalArrayLength) {
|
||||||
if (animalArray == NULL || animalPtr == NULL || numberOfAnimalsPresent >= animalArrayLength) {
|
return -1; // Invalid
|
||||||
fault = -1; // Invalid
|
|
||||||
} else {
|
|
||||||
animalArray[numberOfAnimalsPresent] = *animalPtr;
|
|
||||||
++numberOfAnimalsPresent;
|
|
||||||
}
|
}
|
||||||
*newNumberOfAnimalsPresent = numberOfAnimalsPresent;
|
animalArray[numberOfAnimalsPresent] = *animalPtr;
|
||||||
return fault;
|
*newNumberOfAnimalsPresent = numberOfAnimalsPresent + 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int removeAnimal(int animalId, Animal* animalArray, size_t numberOfAnimalsPresent, size_t* newNumberOfAnimalsPresent){
|
int removeAnimal(int animalId, Animal* animalArray, size_t numberOfAnimalsPresent, size_t* newNumberOfAnimalsPresent){
|
||||||
int fault = -1;
|
size_t removedCount = 0;
|
||||||
|
|
||||||
if (animalArray == NULL || numberOfAnimalsPresent == 0) {
|
if (animalArray == NULL || numberOfAnimalsPresent == 0) {
|
||||||
fault = -1; // Invalid
|
return -1; // Invalid
|
||||||
} else {
|
} else {
|
||||||
for (size_t i = 0; i < numberOfAnimalsPresent; ++i) {
|
size_t writeIndex = 0;
|
||||||
if (animalArray[i].Id == animalId) {
|
// Copy only animals that don't match the ID
|
||||||
// move the array elements to the left to remove the animal
|
for (size_t readIndex = 0; readIndex < numberOfAnimalsPresent; ++readIndex) {
|
||||||
for (size_t j = i; j < numberOfAnimalsPresent - 1; ++j) {
|
if (animalArray[readIndex].Id != animalId) {
|
||||||
animalArray[j] = animalArray[j + 1];
|
if (writeIndex != readIndex) {
|
||||||
|
animalArray[writeIndex] = animalArray[readIndex];
|
||||||
}
|
}
|
||||||
--numberOfAnimalsPresent;
|
writeIndex++;
|
||||||
fault = 0;
|
} else {
|
||||||
break;
|
removedCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*newNumberOfAnimalsPresent = numberOfAnimalsPresent;
|
*newNumberOfAnimalsPresent = (numberOfAnimalsPresent - removedCount);
|
||||||
return fault;
|
return removedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int findAnimalById(int animalId, const Animal* animalArray, size_t numberOfAnimalsPresent, Animal* foundAnimal) {
|
int findAnimalById(int animalId, const Animal* animalArray, size_t numberOfAnimalsPresent, Animal* foundAnimal) {
|
||||||
int fault = -1;
|
if (animalArray == NULL || foundAnimal == NULL) return -1; // Invalid input
|
||||||
if (animalArray == NULL || numberOfAnimalsPresent == 0 || foundAnimal == NULL) {
|
|
||||||
fault = -1;
|
|
||||||
} else {
|
|
||||||
for (size_t i = 0; i < numberOfAnimalsPresent; i++) {
|
for (size_t i = 0; i < numberOfAnimalsPresent; i++) {
|
||||||
if (animalArray[i].Id == animalId) {
|
if (animalArray[i].Id == animalId) {
|
||||||
*foundAnimal = animalArray[i];
|
*foundAnimal = animalArray[i];
|
||||||
fault = 0;
|
return 0;
|
||||||
break; // Exit loop after finding the animal
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fault == -1) { // Only zero out if animal wasn't found
|
return 0;
|
||||||
memset(foundAnimal, 0, sizeof(Animal));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fault;
|
|
||||||
}
|
}
|
||||||
@@ -17,11 +17,15 @@ const Animal originalArray[5] = {
|
|||||||
// Arrays for testing
|
// Arrays for testing
|
||||||
Animal animalArray[5];
|
Animal animalArray[5];
|
||||||
Animal searchArray[5];
|
Animal searchArray[5];
|
||||||
|
Animal idTestArray[5];
|
||||||
|
Animal removeMultipleTestArray[5];
|
||||||
|
|
||||||
void administration_setUp(void) {
|
void administration_setUp(void) {
|
||||||
// Reset both arrays before each test
|
// Reset both arrays before each test
|
||||||
memcpy(animalArray, originalArray, sizeof(originalArray));
|
memcpy(animalArray, originalArray, sizeof(originalArray));
|
||||||
memcpy(searchArray, originalArray, sizeof(originalArray));
|
memcpy(searchArray, originalArray, sizeof(originalArray));
|
||||||
|
memcpy(idTestArray, originalArray, sizeof(originalArray));
|
||||||
|
memcpy(removeMultipleTestArray, originalArray, sizeof(originalArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
void administration_tearDown(void){}
|
void administration_tearDown(void){}
|
||||||
@@ -29,17 +33,25 @@ void administration_tearDown(void){}
|
|||||||
void test_administration_remove_valid(void){
|
void test_administration_remove_valid(void){
|
||||||
size_t newNumberOfAnimalsPresent = 0;
|
size_t newNumberOfAnimalsPresent = 0;
|
||||||
int errorCode = removeAnimal(2, animalArray, 3, &newNumberOfAnimalsPresent);
|
int errorCode = removeAnimal(2, animalArray, 3, &newNumberOfAnimalsPresent);
|
||||||
TEST_ASSERT_EQUAL(0, errorCode);
|
TEST_ASSERT_EQUAL(1, errorCode);
|
||||||
TEST_ASSERT_EQUAL(2, newNumberOfAnimalsPresent);
|
TEST_ASSERT_EQUAL(2, newNumberOfAnimalsPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_administration_remove_invalid(void){
|
void test_administration_remove_invalid(void){
|
||||||
size_t newNumberOfAnimalsPresent = 0;
|
size_t newNumberOfAnimalsPresent = 0;
|
||||||
int errorCode = removeAnimal(12, animalArray, 3, &newNumberOfAnimalsPresent);
|
int errorCode = removeAnimal(12, animalArray, 3, &newNumberOfAnimalsPresent);
|
||||||
TEST_ASSERT_EQUAL(-1, errorCode);
|
TEST_ASSERT_EQUAL(0, errorCode);
|
||||||
TEST_ASSERT_EQUAL(3, newNumberOfAnimalsPresent);
|
TEST_ASSERT_EQUAL(3, newNumberOfAnimalsPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_administration_remove_multiple_of_same_id(void){
|
||||||
|
Animal newAnimal = {.Id = 3, .Species = Dog, .Age = 3, .Sex = Male, .DateFound = {1, 1, 2023}};
|
||||||
|
idTestArray[3] = newAnimal;
|
||||||
|
size_t newNumberOfAnimalsPresent = 0;
|
||||||
|
TEST_ASSERT_EQUAL(2, removeAnimal(3, idTestArray, 4, &newNumberOfAnimalsPresent));
|
||||||
|
TEST_ASSERT_EQUAL(2, newNumberOfAnimalsPresent);
|
||||||
|
}
|
||||||
|
|
||||||
void test_administration_add_valid(void){
|
void test_administration_add_valid(void){
|
||||||
Animal newAnimal = {.Id = 4, .Species = Dog, .Age = 3, .Sex = Male, .DateFound = {1, 1, 2023}};
|
Animal newAnimal = {.Id = 4, .Species = Dog, .Age = 3, .Sex = Male, .DateFound = {1, 1, 2023}};
|
||||||
size_t newNumberOfAnimalsPresent = 0;
|
size_t newNumberOfAnimalsPresent = 0;
|
||||||
@@ -53,7 +65,7 @@ void test_administration_add_invalid(void){
|
|||||||
size_t newNumberOfAnimalsPresent = 0;
|
size_t newNumberOfAnimalsPresent = 0;
|
||||||
int errorCode = addAnimal(&newAnimal, animalArray, 3, 3, &newNumberOfAnimalsPresent);
|
int errorCode = addAnimal(&newAnimal, animalArray, 3, 3, &newNumberOfAnimalsPresent);
|
||||||
TEST_ASSERT_EQUAL(-1, errorCode);
|
TEST_ASSERT_EQUAL(-1, errorCode);
|
||||||
TEST_ASSERT_EQUAL(3, newNumberOfAnimalsPresent);
|
TEST_ASSERT_NOT_EQUAL(4, newNumberOfAnimalsPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_administration_find_valid(void){
|
void test_administration_find_valid(void){
|
||||||
@@ -64,6 +76,26 @@ void test_administration_find_valid(void){
|
|||||||
TEST_ASSERT_EQUAL(Dog, foundAnimalV.Species);
|
TEST_ASSERT_EQUAL(Dog, foundAnimalV.Species);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void test_administration_find_xyz(void){
|
||||||
|
size_t newNumberOfAnimalsPresent = 0;
|
||||||
|
Animal animals[10] = {0};
|
||||||
|
animals[0].Id = 1;
|
||||||
|
animals[1].Id = 1;
|
||||||
|
animals[2].Id = 2;
|
||||||
|
animals[3].Id = 1;
|
||||||
|
animals[4].Id = 1;
|
||||||
|
animals[5].Id = 3;
|
||||||
|
animals[6].Id = 3;
|
||||||
|
animals[7].Id = 1;
|
||||||
|
animals[8].Id = 1;
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL(6, removeAnimal(1, animals, 9, &newNumberOfAnimalsPresent));
|
||||||
|
TEST_ASSERT_EQUAL(3, newNumberOfAnimalsPresent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void test_administration_find_invalid(void){
|
void test_administration_find_invalid(void){
|
||||||
Animal foundAnimalinV;
|
Animal foundAnimalinV;
|
||||||
int errorCode = findAnimalById(12, searchArray, 3, &foundAnimalinV);
|
int errorCode = findAnimalById(12, searchArray, 3, &foundAnimalinV);
|
||||||
@@ -81,6 +113,8 @@ void run_administration_tests()
|
|||||||
MY_RUN_TEST(test_administration_add_invalid);
|
MY_RUN_TEST(test_administration_add_invalid);
|
||||||
MY_RUN_TEST(test_administration_find_valid);
|
MY_RUN_TEST(test_administration_find_valid);
|
||||||
MY_RUN_TEST(test_administration_find_invalid);
|
MY_RUN_TEST(test_administration_find_invalid);
|
||||||
|
MY_RUN_TEST(test_administration_remove_multiple_of_same_id);
|
||||||
|
MY_RUN_TEST(test_administration_find_xyz);
|
||||||
|
|
||||||
UnityUnregisterSetupTearDown();
|
UnityUnregisterSetupTearDown();
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
C/C3 Watch.zip
Normal file
BIN
C/C3 Watch.zip
Normal file
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
,rens,hp-arch,05.06.2025 15:24,file:///home/rens/.config/libreoffice/4;
|
|
||||||
BIN
C/C3 Watch/build/main
Normal file → Executable file
BIN
C/C3 Watch/build/main
Normal file → Executable file
Binary file not shown.
BIN
C/C3 Watch/build/main_test
Normal file → Executable file
BIN
C/C3 Watch/build/main_test
Normal file → Executable file
Binary file not shown.
@@ -3,64 +3,49 @@
|
|||||||
// leave resource_detector.h as last include!
|
// leave resource_detector.h as last include!
|
||||||
#include "resource_detector.h"
|
#include "resource_detector.h"
|
||||||
|
|
||||||
void watch_registers_toggle_config_is_paused(uint8_t* config)
|
void watch_registers_toggle_config_is_paused(uint8_t* config){
|
||||||
{
|
*config ^= 0x08; // Toggle the 4th bit 0x08 = 0b00001000
|
||||||
|
}
|
||||||
|
void watch_registers_set_config_time_format(uint8_t* config, time_format format){
|
||||||
|
*config = (*config & 0x0E) | format;
|
||||||
|
}
|
||||||
|
void watch_registers_set_config_time_update_interval(uint8_t* config, time_update_interval interval){
|
||||||
|
*config = (*config & 0xF9) | (interval << 1); // Clear bits 2 and 3 and set them to the new value: 0x06 = 0b00000110
|
||||||
|
}
|
||||||
|
void watch_registers_get_config_settings(uint8_t config, bool* is_paused, time_format* format, time_update_interval* interval){
|
||||||
|
*is_paused = (config & 0x08);
|
||||||
|
*format = (config & 0x01);
|
||||||
|
*interval = ((config >> 1) & 0x03);
|
||||||
}
|
}
|
||||||
|
|
||||||
void watch_registers_set_config_time_format(uint8_t* config, time_format format)
|
void watch_registers_set_time_hours(uint8_t* time_bits_low, uint8_t* time_bits_high, uint8_t hours){
|
||||||
{
|
*time_bits_high = (*time_bits_high & 0x0F) | ((hours & 0x0F) << 4); // Set the upper nibble
|
||||||
|
}
|
||||||
|
void watch_registers_set_time_minutes(uint8_t* time_bits_low, uint8_t* time_bits_high, uint8_t minutes){
|
||||||
|
*time_bits_high = (*time_bits_high & 0xF0) | ((minutes >> 2) & 0x0F); // Set the lower nibble of MSB
|
||||||
|
*time_bits_low = (*time_bits_low & 0x3F) | ((minutes & 0x03) << 6); // Set the upper two bits of LSB
|
||||||
|
}
|
||||||
|
void watch_registers_set_time_seconds(uint8_t* time_bits_low, uint8_t* time_bits_high, uint8_t seconds){
|
||||||
|
*time_bits_low = (*time_bits_low & 0xC0) | (seconds & 0x3F); // Set the lower 6 bits of LSB
|
||||||
|
}
|
||||||
|
void watch_registers_get_time(uint8_t time_bits_low, uint8_t time_bits_high, uint8_t* hours, uint8_t* minutes, uint8_t* seconds){
|
||||||
|
*hours = (time_bits_high >> 4) & 0x0F;
|
||||||
|
*minutes = ((time_bits_high & 0x0F) << 2) | ((time_bits_low >> 6) & 0x03);
|
||||||
|
*seconds = time_bits_low & 0x3F;
|
||||||
}
|
}
|
||||||
|
|
||||||
void watch_registers_set_config_time_update_interval(
|
void watch_registers_set_date_year(uint8_t* date_bits_low, uint8_t* date_bits_high, uint8_t year){
|
||||||
uint8_t* config, time_update_interval interval)
|
*date_bits_low = (*date_bits_low & 0x80) | (year & 0x7F); // Set the lower 2 bits of LSB
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
void watch_registers_set_date_month(uint8_t* date_bits_low, uint8_t* date_bits_high, uint8_t month){
|
||||||
void watch_registers_get_config_settings(
|
*date_bits_high = (*date_bits_high & 0xF8) | ((month >> 1) & 0x07);
|
||||||
uint8_t config, bool* is_paused, time_format* format,
|
*date_bits_low = (*date_bits_low & 0x7F) | ((month & 0x01) << 7);
|
||||||
time_update_interval* interval)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
void watch_registers_set_date_day_of_month(uint8_t* date_bits_low, uint8_t* date_bits_high,uint8_t day_of_month){
|
||||||
void watch_registers_set_time_hours(
|
*date_bits_high = (*date_bits_high & 0x07) | ((day_of_month & 0x1F) << 3); // Set the upper 5 bits of MSB
|
||||||
uint8_t* time_bits_low, uint8_t* time_bits_high, uint8_t hours)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
void watch_registers_get_date(uint8_t date_bits_low, uint8_t date_bits_high, uint8_t* year, uint8_t* month, uint8_t* day_of_month){
|
||||||
void watch_registers_set_time_minutes(
|
*year = date_bits_low & 0x7F; // Get the lower 7 bits of LSB
|
||||||
uint8_t* time_bits_low, uint8_t* time_bits_high, uint8_t minutes)
|
*month = ((date_bits_high & 0x07) << 1) | ((date_bits_low >> 7) & 0x01); // Get the upper 3 bits of MSB and the lower bit of LSB
|
||||||
{
|
*day_of_month = (date_bits_high >> 3) & 0x1F; // Get the upper 5 bits of MSB
|
||||||
}
|
|
||||||
|
|
||||||
void watch_registers_set_time_seconds(
|
|
||||||
uint8_t* time_bits_low, uint8_t* time_bits_high, uint8_t seconds)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void watch_registers_get_time(
|
|
||||||
uint8_t time_bits_low, uint8_t time_bits_high, uint8_t* hours,
|
|
||||||
uint8_t* minutes, uint8_t* seconds)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void watch_registers_set_date_year(
|
|
||||||
uint8_t* date_bits_low, uint8_t* date_bits_high, uint8_t year)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void watch_registers_set_date_month(
|
|
||||||
uint8_t* date_bits_low, uint8_t* date_bits_high, uint8_t month)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void watch_registers_set_date_day_of_month(
|
|
||||||
uint8_t* date_bits_low, uint8_t* date_bits_high,
|
|
||||||
uint8_t day_of_month)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void watch_registers_get_date(
|
|
||||||
uint8_t date_bits_low, uint8_t date_bits_high, uint8_t* year,
|
|
||||||
uint8_t* month, uint8_t* day_of_month)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,65 +1,251 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "unity_test_module.h"
|
#include "unity_test_module.h"
|
||||||
#include "watch_registers.h"
|
#include "watch_registers.h"
|
||||||
|
|
||||||
// leave resource_detector.h as last include!
|
|
||||||
#include "resource_detector.h"
|
#include "resource_detector.h"
|
||||||
|
|
||||||
// I rather dislike keeping line numbers updated, so I made my own macro to
|
// I rather dislike keeping line numbers updated, so I made my own macro to ditch the line number
|
||||||
// ditch the line number
|
|
||||||
#define MY_RUN_TEST(func) RUN_TEST(func, 0)
|
#define MY_RUN_TEST(func) RUN_TEST(func, 0)
|
||||||
|
|
||||||
void watch_setUp(void)
|
void watch_setUp(void){}
|
||||||
{
|
void watch_tearDown(void){}
|
||||||
|
//config
|
||||||
|
void test_settings_toggle_config_is_paused(void){
|
||||||
|
uint8_t config = 0x00;
|
||||||
|
watch_registers_toggle_config_is_paused(&config);
|
||||||
|
TEST_ASSERT_EQUAL(0x08, config); // 0b1000
|
||||||
|
watch_registers_toggle_config_is_paused(&config);
|
||||||
|
TEST_ASSERT_EQUAL(0x00, config); // 0b0000
|
||||||
|
}
|
||||||
|
void test_setting_set_config_time_format(void){
|
||||||
|
uint8_t config = 0x00;
|
||||||
|
watch_registers_set_config_time_format(&config, TIME_HOUR_MINUTE);
|
||||||
|
TEST_ASSERT_EQUAL(0x00, config); // 0b0000
|
||||||
|
watch_registers_set_config_time_format(&config, TIME_HOUR_MINUTE_SECOND);
|
||||||
|
TEST_ASSERT_EQUAL(0x01, config); // 0b0001
|
||||||
|
}
|
||||||
|
void test_setting_set_config_time_update_interval(void){
|
||||||
|
uint8_t config = 0xAA;
|
||||||
|
watch_registers_set_config_time_update_interval(&config, TIME_UPDATE_DISABLED);
|
||||||
|
TEST_ASSERT_EQUAL(0xA8, config); // 0b0000
|
||||||
|
watch_registers_set_config_time_update_interval(&config, TIME_EVERY_1_SECOND);
|
||||||
|
TEST_ASSERT_EQUAL(0xAA, config); // 0b0010
|
||||||
|
watch_registers_set_config_time_update_interval(&config, TIME_EVERY_30_SECONDS);
|
||||||
|
TEST_ASSERT_EQUAL(0xAC, config); // 0b0100
|
||||||
|
watch_registers_set_config_time_update_interval(&config, TIME_EVERY_MINUTE);
|
||||||
|
TEST_ASSERT_EQUAL(0xAE, config); // 0b0110
|
||||||
|
}
|
||||||
|
void test_setting_get_config_settings(void){
|
||||||
|
uint8_t config = 0x00; // 0b00000000 so time is updated, time format hour:minute, time refresh not updated
|
||||||
|
bool is_paused;
|
||||||
|
time_format format;
|
||||||
|
time_update_interval interval;
|
||||||
|
|
||||||
|
watch_registers_get_config_settings(config, &is_paused, &format, &interval);
|
||||||
|
TEST_ASSERT_EQUAL(false, is_paused);
|
||||||
|
TEST_ASSERT_EQUAL(TIME_HOUR_MINUTE, format);
|
||||||
|
TEST_ASSERT_EQUAL(TIME_UPDATE_DISABLED, interval);
|
||||||
|
|
||||||
|
watch_registers_toggle_config_is_paused(&config);
|
||||||
|
watch_registers_get_config_settings(config, &is_paused, &format, &interval);
|
||||||
|
TEST_ASSERT_EQUAL(true, is_paused);
|
||||||
|
|
||||||
|
watch_registers_set_config_time_format(&config, TIME_HOUR_MINUTE_SECOND);
|
||||||
|
watch_registers_get_config_settings(config, &is_paused, &format, &interval);
|
||||||
|
TEST_ASSERT_EQUAL(TIME_HOUR_MINUTE_SECOND, format);
|
||||||
|
|
||||||
|
watch_registers_set_config_time_update_interval(&config, TIME_EVERY_1_SECOND);
|
||||||
|
watch_registers_get_config_settings(config, &is_paused, &format, &interval);
|
||||||
|
TEST_ASSERT_EQUAL(TIME_EVERY_1_SECOND, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void watch_tearDown(void)
|
|
||||||
{
|
|
||||||
// This is run after EACH test
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_setting_time_hours(void)
|
void test_setting_get_config_settings2(void){
|
||||||
{
|
uint8_t config = 0xAA; // 0b00000000 so time is updated, time format hour:minute, time refresh not updated
|
||||||
const uint8_t hours = 0xA5;
|
bool is_paused;
|
||||||
uint8_t time_bits_high = 0xA5;
|
time_format format;
|
||||||
uint8_t time_bits_low = 0x5A;
|
time_update_interval interval;
|
||||||
|
|
||||||
|
watch_registers_get_config_settings(config, &is_paused, &format, &interval);
|
||||||
|
TEST_ASSERT_EQUAL(true, is_paused);
|
||||||
|
TEST_ASSERT_EQUAL(0, format);
|
||||||
|
TEST_ASSERT_EQUAL(0b01, interval);
|
||||||
|
|
||||||
|
config = 0x55;
|
||||||
|
watch_registers_get_config_settings(config, &is_paused, &format, &interval);
|
||||||
|
TEST_ASSERT_EQUAL(false, is_paused);
|
||||||
|
TEST_ASSERT_EQUAL(1, format);
|
||||||
|
TEST_ASSERT_EQUAL(0b10, interval);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
//time
|
||||||
|
void test_time_set_hours(void){
|
||||||
|
const uint8_t hours = 0x04; // 0b10100101, but we will set it to 0xA0 (0b10100000) to fit in the 4 bits
|
||||||
|
uint8_t time_bits_high = 0;
|
||||||
|
uint8_t time_bits_low = 0;
|
||||||
|
|
||||||
watch_registers_set_time_hours(&time_bits_low, &time_bits_high, hours);
|
watch_registers_set_time_hours(&time_bits_low, &time_bits_high, hours);
|
||||||
TEST_ASSERT_EQUAL_HEX8(0x55, time_bits_high);
|
TEST_ASSERT_EQUAL(0x40, time_bits_high); // 0b01000000
|
||||||
TEST_ASSERT_EQUAL_HEX8(0x5A, time_bits_low);
|
TEST_ASSERT_EQUAL(0x00, time_bits_low); // 0b00000000
|
||||||
}
|
}
|
||||||
|
void test_time_set_minutes(void){
|
||||||
void test_get_time()
|
const uint8_t minutes = 0x31; // 0b00 110001, but we will set it to 0x3F (0b00111111) to fit in the 6 bits
|
||||||
{
|
uint8_t time_bits_high = 0;
|
||||||
const uint8_t hours = 11;
|
uint8_t time_bits_low = 0;
|
||||||
const uint8_t minutes = 55;
|
|
||||||
const uint8_t seconds = 42;
|
watch_registers_set_time_minutes(&time_bits_low, &time_bits_high, minutes);
|
||||||
|
TEST_ASSERT_EQUAL(0x0C, time_bits_high); // 0b0000 1100
|
||||||
|
TEST_ASSERT_EQUAL(0x40, time_bits_low); // 0b01 000000
|
||||||
|
}
|
||||||
|
void test_time_set_seconds(void){
|
||||||
|
const uint8_t seconds = 0x35; // 0b00 110101
|
||||||
|
uint8_t time_bits_high = 0;
|
||||||
uint8_t time_bits_low = 0;
|
uint8_t time_bits_low = 0;
|
||||||
uint8_t time_bits_high = 0b00;
|
|
||||||
|
|
||||||
watch_registers_set_time_seconds(&time_bits_low, &time_bits_high, seconds);
|
watch_registers_set_time_seconds(&time_bits_low, &time_bits_high, seconds);
|
||||||
watch_registers_set_time_minutes(&time_bits_low, &time_bits_high, minutes);
|
TEST_ASSERT_EQUAL(0x00, time_bits_high);
|
||||||
|
TEST_ASSERT_EQUAL(0x35, time_bits_low); // 0b00 000000
|
||||||
|
}
|
||||||
|
void test_time_get_time(void){
|
||||||
|
const uint8_t hours = 0x04; // 0b0100
|
||||||
|
const uint8_t minutes = 0x30; // 0b00 110000
|
||||||
|
const uint8_t seconds = 0x35; // 0b00 110101
|
||||||
|
uint8_t time_bits_low = 0;
|
||||||
|
uint8_t time_bits_high = 0;
|
||||||
|
|
||||||
watch_registers_set_time_hours(&time_bits_low, &time_bits_high, hours);
|
watch_registers_set_time_hours(&time_bits_low, &time_bits_high, hours);
|
||||||
|
watch_registers_set_time_minutes(&time_bits_low, &time_bits_high, minutes);
|
||||||
|
watch_registers_set_time_seconds(&time_bits_low, &time_bits_high, seconds);
|
||||||
|
|
||||||
uint8_t h;
|
uint8_t h;
|
||||||
uint8_t m;
|
uint8_t m;
|
||||||
uint8_t s;
|
uint8_t s;
|
||||||
watch_registers_get_time(time_bits_low, time_bits_high, &h, &m, &s);
|
watch_registers_get_time(time_bits_low, time_bits_high, &h, &m, &s);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(hours, h);
|
TEST_ASSERT_EQUAL(hours, h);
|
||||||
TEST_ASSERT_EQUAL(minutes, m);
|
TEST_ASSERT_EQUAL(minutes, m);
|
||||||
TEST_ASSERT_EQUAL(seconds, s);
|
TEST_ASSERT_EQUAL(seconds, s);
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
//date
|
||||||
|
void test_date_set_year(void){
|
||||||
|
const uint8_t year = 0x20; // 0b00100000
|
||||||
|
uint8_t date_bits_high = 0;
|
||||||
|
uint8_t date_bits_low = 0;
|
||||||
|
|
||||||
|
watch_registers_set_date_year(&date_bits_low, &date_bits_high, year);
|
||||||
|
TEST_ASSERT_EQUAL(0x00, date_bits_high); // 0b00000000
|
||||||
|
TEST_ASSERT_EQUAL(0x20, date_bits_low); // 0b00100000
|
||||||
|
}
|
||||||
|
void test_date_set_month(void){
|
||||||
|
const uint8_t month = 0x05; // 0b0101
|
||||||
|
uint8_t date_bits_high = 0;
|
||||||
|
uint8_t date_bits_low = 0;
|
||||||
|
|
||||||
|
watch_registers_set_date_month(&date_bits_low, &date_bits_high, month);
|
||||||
|
TEST_ASSERT_EQUAL(0x02, date_bits_high); // 0b00000 010
|
||||||
|
TEST_ASSERT_EQUAL(0x80, date_bits_low); // 0b1 0000000
|
||||||
|
}
|
||||||
|
void test_date_set_day_of_month(void){
|
||||||
|
const uint8_t day_of_month = 0x15; // 0b10101
|
||||||
|
uint8_t date_bits_high = 0;
|
||||||
|
uint8_t date_bits_low = 0;
|
||||||
|
|
||||||
|
watch_registers_set_date_day_of_month(&date_bits_low, &date_bits_high, day_of_month);
|
||||||
|
TEST_ASSERT_EQUAL(0xA8, date_bits_high); // 0b10101 000
|
||||||
|
TEST_ASSERT_EQUAL(0x00, date_bits_low); // 0b0
|
||||||
|
}
|
||||||
|
void test_date_get_date(void){
|
||||||
|
const uint8_t year = 0x20; // 0b00100000
|
||||||
|
const uint8_t month = 0x05; // 0b0101
|
||||||
|
const uint8_t day_of_month = 0x16; // 0b10110
|
||||||
|
uint8_t date_bits_high = 0;
|
||||||
|
uint8_t date_bits_low = 0;
|
||||||
|
|
||||||
|
watch_registers_set_date_year(&date_bits_low, &date_bits_high, year);
|
||||||
|
watch_registers_set_date_month(&date_bits_low, &date_bits_high, month);
|
||||||
|
watch_registers_set_date_day_of_month(&date_bits_low, &date_bits_high, day_of_month);
|
||||||
|
|
||||||
|
uint8_t y;
|
||||||
|
uint8_t m;
|
||||||
|
uint8_t d;
|
||||||
|
watch_registers_get_date(date_bits_low, date_bits_high, &y, &m, &d);
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL(year, y);
|
||||||
|
TEST_ASSERT_EQUAL(month, m);
|
||||||
|
TEST_ASSERT_EQUAL(day_of_month, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
//full tests
|
||||||
|
void test_full_watch_configuration(void) {
|
||||||
|
uint8_t config = 0x00;
|
||||||
|
|
||||||
|
// Configure watch settings
|
||||||
|
watch_registers_set_config_time_format(&config, TIME_HOUR_MINUTE_SECOND);
|
||||||
|
watch_registers_set_config_time_update_interval(&config, TIME_EVERY_1_SECOND);
|
||||||
|
watch_registers_toggle_config_is_paused(&config);
|
||||||
|
|
||||||
|
// Verify all settings
|
||||||
|
bool is_paused;
|
||||||
|
time_format format;
|
||||||
|
time_update_interval interval;
|
||||||
|
watch_registers_get_config_settings(config, &is_paused, &format, &interval);
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL(true, is_paused);
|
||||||
|
TEST_ASSERT_EQUAL(TIME_HOUR_MINUTE_SECOND, format);
|
||||||
|
TEST_ASSERT_EQUAL(TIME_EVERY_1_SECOND, interval);
|
||||||
|
}
|
||||||
|
void test_full_datetime_overflow_setup(void) {
|
||||||
|
uint8_t time_bits_low = 0;
|
||||||
|
uint8_t time_bits_high = 0;
|
||||||
|
uint8_t date_bits_low = 0;
|
||||||
|
uint8_t date_bits_high = 0;
|
||||||
|
|
||||||
|
// Set time to 11:59:59
|
||||||
|
watch_registers_set_time_hours(&time_bits_low, &time_bits_high, 0x23);
|
||||||
|
watch_registers_set_time_minutes(&time_bits_low, &time_bits_high, 0x40);
|
||||||
|
watch_registers_set_time_seconds(&time_bits_low, &time_bits_high, 0x40);
|
||||||
|
|
||||||
|
// Set date to 31/12/2127
|
||||||
|
watch_registers_set_date_year(&date_bits_low, &date_bits_high, 0xC9);
|
||||||
|
watch_registers_set_date_month(&date_bits_low, &date_bits_high, 0x12);
|
||||||
|
watch_registers_set_date_day_of_month(&date_bits_low, &date_bits_high, 0x31);
|
||||||
|
|
||||||
|
// Verify time
|
||||||
|
uint8_t hours, minutes, seconds;
|
||||||
|
watch_registers_get_time(time_bits_low, time_bits_high, &hours, &minutes, &seconds);
|
||||||
|
TEST_ASSERT_EQUAL(0x0B, hours); // 11
|
||||||
|
TEST_ASSERT_EQUAL(0x3B, minutes); // 59
|
||||||
|
TEST_ASSERT_EQUAL(0x3B, seconds); // 59
|
||||||
|
|
||||||
|
// Verify date
|
||||||
|
uint8_t year, month, day;
|
||||||
|
watch_registers_get_date(date_bits_low, date_bits_high, &year, &month, &day);
|
||||||
|
TEST_ASSERT_EQUAL(0x7F, year); // 127
|
||||||
|
TEST_ASSERT_EQUAL(0x0C, month); // 12
|
||||||
|
TEST_ASSERT_EQUAL(0x1F, day); // 31
|
||||||
|
}
|
||||||
|
//
|
||||||
void run_watch_tests()
|
void run_watch_tests()
|
||||||
{
|
{
|
||||||
UnityRegisterSetupTearDown(watch_setUp, watch_tearDown);
|
UnityRegisterSetupTearDown(watch_setUp, watch_tearDown);
|
||||||
|
MY_RUN_TEST(test_settings_toggle_config_is_paused);
|
||||||
|
MY_RUN_TEST(test_setting_set_config_time_format);
|
||||||
|
MY_RUN_TEST(test_setting_set_config_time_update_interval);
|
||||||
|
MY_RUN_TEST(test_setting_get_config_settings);
|
||||||
|
MY_RUN_TEST(test_setting_get_config_settings2);
|
||||||
|
|
||||||
MY_RUN_TEST(test_setting_time_hours);
|
MY_RUN_TEST(test_time_set_hours);
|
||||||
MY_RUN_TEST(test_get_time);
|
MY_RUN_TEST(test_time_set_minutes);
|
||||||
|
MY_RUN_TEST(test_time_set_seconds);
|
||||||
|
MY_RUN_TEST(test_time_get_time);
|
||||||
|
|
||||||
|
MY_RUN_TEST(test_date_set_year);
|
||||||
|
MY_RUN_TEST(test_date_set_month);
|
||||||
|
MY_RUN_TEST(test_date_set_day_of_month);
|
||||||
|
MY_RUN_TEST(test_date_get_date);
|
||||||
|
|
||||||
|
MY_RUN_TEST(test_full_watch_configuration);
|
||||||
UnityUnregisterSetupTearDown();
|
UnityUnregisterSetupTearDown();
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
C/C5 and C6 Adidas/build/main
Executable file
BIN
C/C5 and C6 Adidas/build/main
Executable file
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,31 @@
|
|||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
// add here includes, if needed
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
int channel_main(int argc, char* argv[])
|
int channel_main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
//add your code here
|
FILE *input_file = fopen(argv[2], "rb");
|
||||||
|
if (!input_file) {
|
||||||
|
fprintf(stderr, "Error opening input file: %s\n", argv[2]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
FILE *output_file = fopen(argv[3], "wb");
|
||||||
|
if (!output_file) {
|
||||||
|
fprintf(stderr, "Error opening output file: %s\n", argv[3]);
|
||||||
|
fclose(input_file);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t buffer[1024], processed[1024];
|
||||||
|
size_t bytes_read;
|
||||||
|
while ((bytes_read = fread(buffer, 1, sizeof(buffer), input_file)) > 0) {
|
||||||
|
for (size_t i = 0; i < bytes_read; i++) {
|
||||||
|
processed[i] = channel_change_one_random_bit(buffer[i]);
|
||||||
|
}
|
||||||
|
fwrite(processed, 1, bytes_read, output_file);
|
||||||
|
}
|
||||||
|
fclose(input_file);
|
||||||
|
fclose(output_file);
|
||||||
|
printf("Channel completed successfully.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,45 @@
|
|||||||
#include "decode.h"
|
#include "decode.h"
|
||||||
// add here includes, if needed
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
int decode_main(int argc, char* argv[])
|
int decode_main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
//add your code here
|
FILE *input_file = fopen(argv[2], "rb");
|
||||||
|
if (!input_file) {
|
||||||
|
fprintf(stderr, "Error opening input file: %s\n", argv[2]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
FILE *output_file = fopen(argv[3], "wb");
|
||||||
|
if (!output_file) {
|
||||||
|
fprintf(stderr, "Error opening output file: %s\n", argv[3]);
|
||||||
|
fclose(input_file);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t buffer[2048], decoded[1024];
|
||||||
|
size_t bytes_read;
|
||||||
|
// // b_r
|
||||||
|
while ((bytes_read = fread(buffer, 1, sizeof(buffer), input_file)) > 0) {
|
||||||
|
if (bytes_read % 2 != 0) { //odd check
|
||||||
|
size_t extra = fread(buffer + bytes_read, 1, 1, input_file);
|
||||||
|
if (extra == 1) { // successfully read
|
||||||
|
bytes_read++;
|
||||||
|
} else { // error reading the extra byte
|
||||||
|
fclose(input_file);
|
||||||
|
fclose(output_file);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t decoded_size = bytes_read / 2;
|
||||||
|
for (size_t i = 0; i < decoded_size; i++) {
|
||||||
|
decoded[i] = decode_combine_nibbles(buffer[i], buffer[i + decoded_size]);
|
||||||
|
}
|
||||||
|
fwrite(decoded, 1, decoded_size, output_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(input_file);
|
||||||
|
fclose(output_file);
|
||||||
|
printf("Decoding completed successfully.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,33 @@
|
|||||||
#include "encode.h"
|
#include "encode.h"
|
||||||
// add here includes, if needed
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
int encode_main(int argc, char* argv[])
|
int encode_main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
//add your code here
|
FILE *input_file = fopen(argv[2], "rb");
|
||||||
|
if (!input_file) {
|
||||||
|
fprintf(stderr, "Error opening input file: %s\n", argv[2]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
FILE *output_file = fopen(argv[3], "wb");
|
||||||
|
if (!output_file) {
|
||||||
|
fprintf(stderr, "Error opening output file: %s\n", argv[3]);
|
||||||
|
fclose(input_file);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t buffer[1024], high[1024], low[1024];
|
||||||
|
size_t bytes_read;
|
||||||
|
while ((bytes_read = fread(buffer, 1, sizeof(buffer), input_file)) > 0) {
|
||||||
|
for (size_t i = 0; i < bytes_read; i++) {
|
||||||
|
encode_value(buffer[i], &high[i], &low[i]);
|
||||||
|
}
|
||||||
|
fwrite(high, 1, bytes_read, output_file);
|
||||||
|
fwrite(low, 1, bytes_read, output_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(input_file);
|
||||||
|
fclose(output_file);
|
||||||
|
printf("Encoding completed successfully.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ void decode_byte(uint8_t in, uint8_t* nibble){
|
|||||||
// Check parity bits
|
// Check parity bits
|
||||||
uint8_t error = 0;
|
uint8_t error = 0;
|
||||||
if ((p0 ^ d0 ^ d1 ^ d2) != 0) error |= 0x01; // Error in p0 group
|
if ((p0 ^ d0 ^ d1 ^ d2) != 0) error |= 0x01; // Error in p0 group
|
||||||
if ((p1 ^ d0 ^ d1 ^ d3) != 0) error |= 0x02; // Error in p1 group
|
if ((p1 ^ d0 ^ d1 ^ d3) != 0) error |= 0x02; // Error in p1 group // 0000111
|
||||||
if ((p2 ^ d0 ^ d2 ^ d3) != 0) error |= 0x04; // Error in p2 group
|
if ((p2 ^ d0 ^ d2 ^ d3) != 0) error |= 0x04; // Error in p2 group
|
||||||
|
|
||||||
if (MSB == 0 && error != 0) {
|
if (MSB == 0 && error != 0) {
|
||||||
|
|||||||
BIN
C/C6 Adidas.zip
BIN
C/C6 Adidas.zip
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||||
</startup>
|
</startup>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -18,102 +18,116 @@ using System.Threading.Tasks;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace PoloClubApp {
|
namespace PoloClubApp
|
||||||
class Club {
|
{
|
||||||
private string name; // the name of the club
|
/// <summary>
|
||||||
private List<Device> devices; // a list of devices
|
/// Represents a Polo Club that manages a collection of devices.
|
||||||
|
/// </summary>
|
||||||
|
class Club
|
||||||
|
{
|
||||||
|
private string name;
|
||||||
|
private List<Device> devices;
|
||||||
|
|
||||||
public Club(string name){
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the Club class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name of the club.</param>
|
||||||
|
public Club(string name)
|
||||||
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.devices = new List<Device>();
|
this.devices = new List<Device>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get { return this.name; } } // read only property for Name
|
/// <summary>
|
||||||
|
/// Gets the name of the club (read-only).
|
||||||
|
/// </summary>
|
||||||
|
public string Name => this.name;
|
||||||
|
|
||||||
|
// ----- Graded Methods -----
|
||||||
|
|
||||||
//-----Provide your answers here-----
|
/// <summary>
|
||||||
|
/// Retrieves all wearable devices (implementing IWearable interface).
|
||||||
public List<Device> GetAllWearables(){
|
/// </summary>
|
||||||
|
/// <returns>List of wearable devices.</returns>
|
||||||
|
public List<Device> GetAllWearables()
|
||||||
|
{
|
||||||
List<Device> wearables = new List<Device>();
|
List<Device> wearables = new List<Device>();
|
||||||
|
foreach (Device device in devices)
|
||||||
foreach (Device dev in this.devices){
|
{
|
||||||
if (dev is SmartWatch || dev is FitTracker){
|
if (device is IWearable)
|
||||||
wearables.Add(dev);
|
{
|
||||||
|
wearables.Add(device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wearables;
|
return wearables;
|
||||||
}
|
}
|
||||||
public void AssignDevice(int id, string playerName){
|
|
||||||
|
/// <summary>
|
||||||
|
/// Assigns a device to a player.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Device ID.</param>
|
||||||
|
/// <param name="playerName">Player's name.</param>
|
||||||
|
/// <exception cref="Exception">Thrown if device is not found.</exception>
|
||||||
|
public void AssignDevice(int id, string playerName)
|
||||||
|
{
|
||||||
|
Device device = GetDeviceById(id) ?? throw new Exception("Device not found");
|
||||||
|
int? waterResistance = (device as IWearable)?.GetWaterResistanceMeters();
|
||||||
|
device.AssignDevice(playerName, waterResistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a device from a player.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Device ID.</param>
|
||||||
|
/// <returns>True if successful, false if device not found.</returns>
|
||||||
|
public bool ReturnDevice(int id)
|
||||||
|
{
|
||||||
Device device = GetDeviceById(id);
|
Device device = GetDeviceById(id);
|
||||||
|
return device?.ReturnDevice() ?? false;
|
||||||
if(device == null){
|
|
||||||
throw new Exception("Device not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(device is IWearable)){
|
/// <summary>
|
||||||
device.AssignDevice(playerName, null);
|
/// Gets all devices assigned to a specific player.
|
||||||
} else {
|
/// </summary>
|
||||||
IWearable wearable = (IWearable)device;
|
/// <param name="playerName">Player's name.</param>
|
||||||
device.AssignDevice(playerName, wearable.GetWaterResistanceMeters());
|
/// <returns>List of assigned devices.</returns>
|
||||||
|
public List<Device> GetAllAssignedDevicesByPlayer(string playerName)
|
||||||
|
{
|
||||||
|
return devices.Where(d => d.PlayerName == playerName).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
public bool ReturnDevice(int id){
|
/// Generates a formatted device report for a player.
|
||||||
Device device = GetDeviceById(id);
|
/// </summary>
|
||||||
return device.ReturnDevice();
|
/// <param name="playerName">Player's name.</param>
|
||||||
}
|
/// <returns>Formatted report lines.</returns>
|
||||||
|
public List<string> GenerateReportPerPlayer(string playerName)
|
||||||
public List<Device> GetAllAssignedDevicesByPlayer(string playerName){
|
{
|
||||||
List<Device> assignedDevices = new List<Device>();
|
|
||||||
foreach (Device dev in this.devices){
|
|
||||||
if (dev.PlayerName == playerName){
|
|
||||||
assignedDevices.Add(dev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return assignedDevices;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> GenerateReportPerPlayer(string playerName){
|
|
||||||
string returnString = "List of devices assigned to " + playerName;
|
|
||||||
List<String> lines = new List<String>();
|
|
||||||
List<Device> assignedDevices = GetAllAssignedDevicesByPlayer(playerName);
|
List<Device> assignedDevices = GetAllAssignedDevicesByPlayer(playerName);
|
||||||
|
List<string> report = new List<string>
|
||||||
|
{
|
||||||
|
$"List of devices assigned to {playerName}",
|
||||||
|
"Phones",
|
||||||
|
"-"
|
||||||
|
};
|
||||||
|
|
||||||
lines.Add(returnString);
|
report.AddRange(assignedDevices
|
||||||
string currentDeviceType = "SmartPhone";
|
.OfType<SmartPhone>()
|
||||||
|
.Select(d => d.GetDetails()));
|
||||||
|
|
||||||
lines.Add("Phones");
|
report.AddRange(new[] { "Wearables", "-" });
|
||||||
lines.Add("-");
|
|
||||||
foreach (Device dev in assignedDevices){
|
|
||||||
if (dev is SmartPhone){
|
|
||||||
lines.Add(dev.GetDetails());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lines.Add("Wearables");
|
|
||||||
lines.Add("-");
|
|
||||||
foreach (Device dev in assignedDevices){
|
|
||||||
if (!(dev is SmartPhone)){
|
|
||||||
lines.Add(dev.GetDetails());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int phoneCount = 0;
|
report.AddRange(assignedDevices
|
||||||
int wearableCount = 0;
|
.Where(d => d is IWearable)
|
||||||
foreach (Device dev in assignedDevices){
|
.Select(d => d.GetDetails()));
|
||||||
if (dev is SmartPhone){
|
|
||||||
phoneCount++;
|
|
||||||
}
|
|
||||||
if (dev is IWearable){
|
|
||||||
wearableCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lines.Add("Total: " + assignedDevices.Count + " devices, " + phoneCount + " phones and " + wearableCount + " wearables");
|
report.Add($"Total: {assignedDevices.Count} devices, " +
|
||||||
|
$"{assignedDevices.Count(d => d is SmartPhone)} phones and " +
|
||||||
|
$"{assignedDevices.Count(d => d is IWearable)} wearables");
|
||||||
|
|
||||||
return lines;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -----The provided code below will not be graded, therefore should not be changed-----
|
// -----The provided code below will not be graded, therefore should not be changed-----
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -17,34 +17,74 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PoloClubApp {
|
namespace PoloClubApp {
|
||||||
internal abstract class Device {
|
/// <summary>
|
||||||
|
/// Abstract base class representing a device in the Polo Club system.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class Device {
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the unique identifier of the device.
|
||||||
|
/// </summary>
|
||||||
public int Id { get; }
|
public int Id { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name of the device.
|
||||||
|
/// </summary>
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the player the device is assigned to.
|
||||||
|
/// </summary>
|
||||||
public string PlayerName { get; set; }
|
public string PlayerName { get; set; }
|
||||||
public Device(int id, string name, string playerName = null){
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the Device class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique identifier for the device.</param>
|
||||||
|
/// <param name="name">The name of the device.</param>
|
||||||
|
/// <param name="playerName">The name of the player the device is assigned to (optional).</param>
|
||||||
|
protected Device(int id, string name, string playerName = null) {
|
||||||
Id = id;
|
Id = id;
|
||||||
Name = name;
|
Name = name;
|
||||||
PlayerName = playerName;
|
PlayerName = playerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets detailed information about the device.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Formatted string with device details.</returns>
|
||||||
public abstract string GetDetails();
|
public abstract string GetDetails();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if the device is currently assigned to a player.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if assigned, false otherwise.</returns>
|
||||||
public bool IsAssigned(){
|
public bool IsAssigned(){
|
||||||
return PlayerName != null;
|
return !string.IsNullOrEmpty(PlayerName);
|
||||||
}
|
|
||||||
public Exception AssignDevice(string playerName, int? waterResistanceMeters){
|
|
||||||
if (IsAssigned()){
|
|
||||||
throw new Exception("Device is already assigned");
|
|
||||||
} else if (this is IWearable && waterResistanceMeters < 3){
|
|
||||||
throw new Exception("Water resistance meters should be 3 or more");
|
|
||||||
} else if (this.Id == null){
|
|
||||||
throw new Exception("Device Id is null");
|
|
||||||
} else {
|
|
||||||
PlayerName = playerName;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Assigns the device to a player.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="playerName">Name of the player to assign to.</param>
|
||||||
|
/// <param name="waterResistanceMeters">Water resistance for wearables (nullable).</param>
|
||||||
|
/// <exception cref="Exception">Throws when assignment fails.</exception>
|
||||||
|
public void AssignDevice(string playerName, int? waterResistanceMeters){
|
||||||
|
if (IsAssigned()){
|
||||||
|
throw new Exception("Device is already assigned");
|
||||||
|
}
|
||||||
|
if (this is IWearable && waterResistanceMeters < 3){
|
||||||
|
throw new Exception("Water resistance must be 3 meters or more for wearables");
|
||||||
|
}
|
||||||
|
if (Id == 0){
|
||||||
|
throw new Exception("Invalid device ID");
|
||||||
|
}
|
||||||
|
PlayerName = playerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the device from a player.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if successful, false if device wasn't assigned.</returns>
|
||||||
public bool ReturnDevice(){
|
public bool ReturnDevice(){
|
||||||
if (!IsAssigned()){
|
if (!IsAssigned()){
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -17,26 +17,56 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PoloClubApp {
|
namespace PoloClubApp {
|
||||||
internal class FitTracker : Device, IWearable {
|
/// <summary>
|
||||||
public string DeviceType = "FitTracker";
|
/// Represents a fitness tracker device that implements IWearable interface.
|
||||||
public int Id { get; }
|
/// </summary>
|
||||||
public string Name { get; }
|
public class FitTracker : Device, IWearable {
|
||||||
public string PlayerName { get; set; }
|
/// <summary>
|
||||||
|
/// Gets the type of the device (always "FitTracker").
|
||||||
|
/// </summary>
|
||||||
|
public string DeviceType { get; } = "FitTracker";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the water resistance rating in meters.
|
||||||
|
/// </summary>
|
||||||
public int WaterResistanceMeters { get; }
|
public int WaterResistanceMeters { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the color of the fitness tracker.
|
||||||
|
/// </summary>
|
||||||
public string Color { get; }
|
public string Color { get; }
|
||||||
|
|
||||||
public FitTracker(int id, string name, int waterResistanceMeters, string color) : base(id, name, null){
|
/// <summary>
|
||||||
Id = id;
|
/// Initializes a new instance of the FitTracker class.
|
||||||
Name = name;
|
/// </summary>
|
||||||
|
/// <param name="id">The unique device identifier.</param>
|
||||||
|
/// <param name="name">The name of the fitness tracker.</param>
|
||||||
|
/// <param name="waterResistanceMeters">Water resistance rating in meters.</param>
|
||||||
|
/// <param name="color">The color of the device.</param>
|
||||||
|
public FitTracker(int id, string name, int waterResistanceMeters, string color)
|
||||||
|
: base(id, name)
|
||||||
|
{
|
||||||
WaterResistanceMeters = waterResistanceMeters;
|
WaterResistanceMeters = waterResistanceMeters;
|
||||||
Color = color;
|
Color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetDetails(){
|
/// <summary>
|
||||||
return DeviceType + "Id: " + Id + ", Name: " + Name + ", Type: " + ", WaterResistanceMeters: " + WaterResistanceMeters + ", Color: " + Color;
|
/// Gets detailed information about the fitness tracker.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Formatted string with device details.</returns>
|
||||||
|
public override string GetDetails()
|
||||||
|
{
|
||||||
|
return $"{DeviceType} - Id: {Id}, Name: {Name}, " +
|
||||||
|
$"Water Resistance: {WaterResistanceMeters}m, " +
|
||||||
|
$"Color: {Color}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetWaterResistanceMeters(){
|
/// <summary>
|
||||||
|
/// Gets the water resistance rating.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Water resistance in meters.</returns>
|
||||||
|
public int GetWaterResistanceMeters()
|
||||||
|
{
|
||||||
return WaterResistanceMeters;
|
return WaterResistanceMeters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,14 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PoloClubApp {
|
namespace PoloClubApp {
|
||||||
interface IWearable {
|
/// <summary>
|
||||||
///Returns the water resistance level of the wearable device in meters.
|
/// Interface for wearable devices that have water resistance capability.
|
||||||
|
/// </summary>
|
||||||
|
public interface IWearable{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the water resistance rating of the wearable device.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Water resistance in meters.</returns>
|
||||||
int GetWaterResistanceMeters();
|
int GetWaterResistanceMeters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>PoloClubApp</RootNamespace>
|
<RootNamespace>PoloClubApp</RootNamespace>
|
||||||
<AssemblyName>PoloClubApp</AssemblyName>
|
<AssemblyName>PoloClubApp</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
|
|||||||
@@ -202,7 +202,6 @@
|
|||||||
//
|
//
|
||||||
// saveFileDialog1
|
// saveFileDialog1
|
||||||
//
|
//
|
||||||
this.saveFileDialog1.FileOk += new System.ComponentModel.CancelEventHandler(this.saveFileDialog1_FileOk);
|
|
||||||
//
|
//
|
||||||
// PoloClubAppForm
|
// PoloClubAppForm
|
||||||
//
|
//
|
||||||
@@ -215,7 +214,6 @@
|
|||||||
this.Controls.Add(this.lbOverview);
|
this.Controls.Add(this.lbOverview);
|
||||||
this.Name = "PoloClubAppForm";
|
this.Name = "PoloClubAppForm";
|
||||||
this.Text = "Form1";
|
this.Text = "Form1";
|
||||||
this.Load += new System.EventHandler(this.PoloClubAppForm_Load);
|
|
||||||
this.groupBox1.ResumeLayout(false);
|
this.groupBox1.ResumeLayout(false);
|
||||||
this.groupBox2.ResumeLayout(false);
|
this.groupBox2.ResumeLayout(false);
|
||||||
this.groupBox2.PerformLayout();
|
this.groupBox2.PerformLayout();
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace PoloClubApp {
|
namespace PoloClubApp {
|
||||||
public partial class PoloClubAppForm : Form {
|
public partial class PoloClubAppForm : Form {
|
||||||
// Provide your answers here
|
// Provide your answers here
|
||||||
private void btnViewAllWearables_Click(object sender, EventArgs e){
|
private void btnViewAllWearables_Click(object sender, EventArgs e){
|
||||||
List<Device> wearables = myClub.GetAllWearables();
|
List<Device> wearables = myClub.GetAllWearables();
|
||||||
lbOverview.Items.Clear();
|
lbOverview.Items.Clear();
|
||||||
foreach (Device wearable in wearables)
|
foreach (Device wearable in wearables){
|
||||||
{
|
|
||||||
lbOverview.Items.Add(wearable.GetDetails());
|
lbOverview.Items.Add(wearable.GetDetails());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,16 +34,19 @@ namespace PoloClubApp {
|
|||||||
private void btnAssign_Click(object sender, EventArgs e){
|
private void btnAssign_Click(object sender, EventArgs e){
|
||||||
try {
|
try {
|
||||||
if (string.IsNullOrWhiteSpace(tbPlayerName.Text)){
|
if (string.IsNullOrWhiteSpace(tbPlayerName.Text)){
|
||||||
MessageBox.Show("Please enter a player name");
|
MessageBox.Show("Please enter a player name.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (cbDevice.SelectedItem == null){
|
||||||
int deviceId = int.Parse(cbDevice.SelectedItem.ToString());
|
MessageBox.Show("Please select a device.");
|
||||||
myClub.AssignDevice(deviceId, tbPlayerName.Text);
|
return;
|
||||||
MessageBox.Show("Device assigned successfully");
|
|
||||||
}
|
}
|
||||||
catch (FormatException){
|
if (!int.TryParse(cbDevice.SelectedItem.ToString(), out int deviceId)){
|
||||||
MessageBox.Show("Please select a valid device");
|
MessageBox.Show("Invalid device selection. Please select a valid device.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
myClub.AssignDevice(deviceId, tbPlayerName.Text);
|
||||||
|
MessageBox.Show("Device assigned successfully.");
|
||||||
}
|
}
|
||||||
catch (Exception ex){
|
catch (Exception ex){
|
||||||
MessageBox.Show($"Error assigning device: {ex.Message}");
|
MessageBox.Show($"Error assigning device: {ex.Message}");
|
||||||
@@ -62,17 +65,15 @@ namespace PoloClubApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnGeneratePlayerTextReport_Click(object sender, EventArgs e)
|
||||||
private void btnGeneratePlayerTextReport_Click(object sender, EventArgs e){
|
{
|
||||||
List<string> report = myClub.GenerateReportPerPlayer(tbPlayerName.Text);
|
List<string> report = myClub.GenerateReportPerPlayer(tbPlayerNameForFile.Text);
|
||||||
lbOverview.Items.Clear();
|
lbOverview.Items.Clear();
|
||||||
foreach (string line in report){
|
foreach (string line in report){
|
||||||
lbOverview.Items.Add(line);
|
lbOverview.Items.Add(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -----The provided code below will not be graded, therefore should not be changed-----
|
// -----The provided code below will not be graded, therefore should not be changed-----
|
||||||
|
|
||||||
private Club myClub;
|
private Club myClub;
|
||||||
@@ -103,12 +104,13 @@ namespace PoloClubApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnViewAllDevices_Click(object sender, EventArgs e){
|
private void btnViewAllDevices_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
this.lbOverview.Items.Clear();
|
this.lbOverview.Items.Clear();
|
||||||
foreach (Device dev in myClub.GetAllDevices()){
|
foreach (Device dev in myClub.GetAllDevices())
|
||||||
|
{
|
||||||
this.lbOverview.Items.Add(dev.GetDetails());
|
this.lbOverview.Items.Add(dev.GetDetails());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace PoloClubApp.Properties {
|
|||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|||||||
@@ -17,18 +17,30 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PoloClubApp {
|
namespace PoloClubApp {
|
||||||
internal class SmartPhone : Device {
|
/// <summary>
|
||||||
public string DeviceType = "SmartPhone";
|
/// Represents a smartphone device in the Polo Club system.
|
||||||
public int Id { get; }
|
/// </summary>
|
||||||
public string Name { get; }
|
public class SmartPhone : Device
|
||||||
public string PlayerName { get; set; }
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type of the device (always "SmartPhone").
|
||||||
|
/// </summary>
|
||||||
|
public string DeviceType { get; } = "SmartPhone";
|
||||||
|
|
||||||
public SmartPhone(int id, string name) : base(id, name, null){
|
/// <summary>
|
||||||
Id = id;
|
/// Initializes a new instance of the SmartPhone class.
|
||||||
Name = name;
|
/// </summary>
|
||||||
}
|
/// <param name="id">The unique identifier for the smartphone.</param>
|
||||||
public override string GetDetails(){
|
/// <param name="name">The name of the smartphone.</param>
|
||||||
return DeviceType + "Id: " + Id + ", Name: " + Name;
|
public SmartPhone(int id, string name) : base(id, name) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a formatted string with details about the smartphone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A string containing device details.</returns>
|
||||||
|
public override string GetDetails()
|
||||||
|
{
|
||||||
|
return $"{DeviceType} - Id: {Id}, Name: {Name}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,24 +18,56 @@ using System.Threading.Tasks;
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace PoloClubApp {
|
namespace PoloClubApp {
|
||||||
internal class SmartWatch : Device, IWearable {
|
/// <summary>
|
||||||
public string DeviceType = "Watch";
|
/// Represents a smartwatch device that implements IWearable interface.
|
||||||
|
/// </summary>
|
||||||
|
public class SmartWatch : Device, IWearable {
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type of the device (always "SmartWatch").
|
||||||
|
/// </summary>
|
||||||
|
public string DeviceType { get; } = "SmartWatch";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the water resistance rating in meters.
|
||||||
|
/// </summary>
|
||||||
public int WaterResistanceMeters { get; }
|
public int WaterResistanceMeters { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the screen size in millimeters.
|
||||||
|
/// </summary>
|
||||||
public int ScreenSize { get; }
|
public int ScreenSize { get; }
|
||||||
|
|
||||||
/// Initializes a new SmartWatch with specified ID, name, player name, water resistance, and screen size.
|
/// <summary>
|
||||||
public SmartWatch(int id, string name, int waterResistanceMeters, int screenSize) : base(id, name, null){
|
/// Initializes a new instance of the SmartWatch class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The unique device identifier.</param>
|
||||||
|
/// <param name="name">The name of the smartwatch.</param>
|
||||||
|
/// <param name="waterResistanceMeters">Water resistance rating in meters.</param>
|
||||||
|
/// <param name="screenSize">Screen size in millimeters.</param>
|
||||||
|
public SmartWatch(int id, string name, int waterResistanceMeters, int screenSize)
|
||||||
|
: base(id, name)
|
||||||
|
{
|
||||||
WaterResistanceMeters = waterResistanceMeters;
|
WaterResistanceMeters = waterResistanceMeters;
|
||||||
ScreenSize = screenSize;
|
ScreenSize = screenSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a string representation of the SmartWatch details.
|
/// <summary>
|
||||||
public override string GetDetails(){
|
/// Gets detailed information about the smartwatch.
|
||||||
return DeviceType + "Id: " + Id + ", Name: " + Name + ", WaterResistanceMeters: " + WaterResistanceMeters + ", ScreenSize: " + ScreenSize;
|
/// </summary>
|
||||||
|
/// <returns>Formatted string with device details.</returns>
|
||||||
|
public override string GetDetails()
|
||||||
|
{
|
||||||
|
return $"{DeviceType} - Id: {Id}, Name: {Name}, " +
|
||||||
|
$"Water Resistance: {WaterResistanceMeters}m, " +
|
||||||
|
$"Screen Size: {ScreenSize}mm";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the water resistance of the SmartWatch in meters.
|
/// <summary>
|
||||||
public int GetWaterResistanceMeters(){
|
/// Gets the water resistance rating.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Water resistance in meters.</returns>
|
||||||
|
public int GetWaterResistanceMeters()
|
||||||
|
{
|
||||||
return WaterResistanceMeters;
|
return WaterResistanceMeters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||||
</startup>
|
</startup>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
2dd441a6dcab245f72940a1e3dc8fb177864ab58
|
90cb8bf3ebafd798eee9d80691d19f1b5819e6787f258fb71804932ed0b5e337
|
||||||
|
|||||||
@@ -27,3 +27,13 @@ C:\Users\Rens\Downloads\PoloClubApp\obj\Debug\PoloClubApp.csproj.GenerateResourc
|
|||||||
C:\Users\Rens\Downloads\PoloClubApp\obj\Debug\PoloClubApp.csproj.CoreCompileInputs.cache
|
C:\Users\Rens\Downloads\PoloClubApp\obj\Debug\PoloClubApp.csproj.CoreCompileInputs.cache
|
||||||
C:\Users\Rens\Downloads\PoloClubApp\obj\Debug\PoloClubApp.exe
|
C:\Users\Rens\Downloads\PoloClubApp\obj\Debug\PoloClubApp.exe
|
||||||
C:\Users\Rens\Downloads\PoloClubApp\obj\Debug\PoloClubApp.pdb
|
C:\Users\Rens\Downloads\PoloClubApp\obj\Debug\PoloClubApp.pdb
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\obj\Debug\PoloClubApp.csproj.AssemblyReference.cache
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\obj\Debug\PoloClubApp.PoloClubAppForm.resources
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\obj\Debug\PoloClubApp.Properties.Resources.resources
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\obj\Debug\PoloClubApp.csproj.GenerateResource.cache
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\obj\Debug\PoloClubApp.csproj.CoreCompileInputs.cache
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\obj\Debug\PoloClubApp.exe
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\obj\Debug\PoloClubApp.pdb
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\bin\Debug\PoloClubApp.exe.config
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\bin\Debug\PoloClubApp.exe
|
||||||
|
C:\Users\Gebruiker\T2\CS\CS1 PoloClubApp_RensPastoor\bin\Debug\PoloClubApp.pdb
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
CS/CS2A shipping UML.zip
Normal file
BIN
CS/CS2A shipping UML.zip
Normal file
Binary file not shown.
205
CS/CS2A shipping UML/UML_2A_Rens_Pastoor.drawio
Normal file
205
CS/CS2A shipping UML/UML_2A_Rens_Pastoor.drawio
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (X11; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0" version="27.1.4">
|
||||||
|
<diagram name="Page-1" id="__ajmCTHiHd_0gtwpgYY">
|
||||||
|
<mxGraphModel dx="1426" dy="783" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
|
||||||
|
<root>
|
||||||
|
<mxCell id="0" />
|
||||||
|
<mxCell id="1" parent="0" />
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-1" value="Main" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry width="160" height="64" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-3" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-1">
|
||||||
|
<mxGeometry y="26" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-10" value="<div align="left">+ Main</div>" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-1">
|
||||||
|
<mxGeometry y="34" width="160" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=diamondThin;endFill=0;strokeWidth=2;strokeColor=default;targetPerimeterSpacing=16;spacing=3;labelBorderColor=none;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-5">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="80" y="150" as="sourcePoint" />
|
||||||
|
<mxPoint x="79.81" y="64" as="targetPoint" />
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="80" y="80" />
|
||||||
|
<mxPoint x="80" y="80" />
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-5" value="Server" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry y="160" width="160" height="150" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-6" value="<div>- serverRunning: bool</div><div>- port: int</div><div>- address: IPAdrress</div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-5">
|
||||||
|
<mxGeometry y="26" width="160" height="54" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-7" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-5">
|
||||||
|
<mxGeometry y="80" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-8" value="<div>+ SetupServer</div><div>+ ServerLoop()</div><div>+ statemachine()</div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-5">
|
||||||
|
<mxGeometry y="88" width="160" height="62" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-13" value="Company" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="300" y="50" width="160" height="80" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-15" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-13">
|
||||||
|
<mxGeometry y="26" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-16" value="<div>+ Add(BaseContainer)</div><div>+ GenerateReport()</div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-13">
|
||||||
|
<mxGeometry y="34" width="160" height="46" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0;entryDx=0;entryDy=0;endArrow=diamondThin;endFill=0;strokeWidth=2;strokeColor=default;targetPerimeterSpacing=16;spacing=3;labelBorderColor=none;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-13" target="Ey-4shX72MY-NRdcRtJe-10">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="270" y="210" as="sourcePoint" />
|
||||||
|
<mxPoint x="210" y="260" as="targetPoint" />
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="210" y="80" />
|
||||||
|
<mxPoint x="210" y="34" />
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.519;entryY=0.996;entryDx=0;entryDy=0;entryPerimeter=0;startArrow=open;startFill=0;endArrow=none;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-6" target="Ey-4shX72MY-NRdcRtJe-16">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-20" value="uses" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="Ey-4shX72MY-NRdcRtJe-19">
|
||||||
|
<mxGeometry x="-0.2078" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-21" value="<i>BaseContainer</i>" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="590" y="50" width="160" height="140" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-22" value="<div>- idCount</div><div><span style="white-space: pre;">- Decription: string</span></div><div><span style="white-space: pre;">- CountryOfOrigin</span></div><div><span style="white-space: pre;">- id: int</span></div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-21">
|
||||||
|
<mxGeometry y="26" width="160" height="64" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-23" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-21">
|
||||||
|
<mxGeometry y="90" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-24" value="<div><i>+ Fee(): float</i></div><div>+ Container(string, string)</div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-21">
|
||||||
|
<mxGeometry y="98" width="160" height="42" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0;entryDx=0;entryDy=0;endArrow=diamondThin;endFill=0;strokeWidth=2;strokeColor=default;targetPerimeterSpacing=16;spacing=3;labelBorderColor=none;exitX=-0.005;exitY=0.332;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-22">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="600" y="136" as="sourcePoint" />
|
||||||
|
<mxPoint x="460" y="80" as="targetPoint" />
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="589" y="100" />
|
||||||
|
<mxPoint x="510" y="100" />
|
||||||
|
<mxPoint x="510" y="80" />
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-26" value="QuarterContainer" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="240" y="320" width="160" height="100" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-27" value="- price: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-26">
|
||||||
|
<mxGeometry y="26" width="160" height="26" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-28" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-26">
|
||||||
|
<mxGeometry y="52" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-29" value="<div>+ QuarterContainer()</div><div>+ Fee(): float</div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-26">
|
||||||
|
<mxGeometry y="60" width="160" height="40" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-41" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=0;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-31">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="669.9999999999998" y="190" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-31" value="HalfContainer" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="420" y="320" width="160" height="140" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-32" value="<div>- area: int</div><div>- maxErea: int</div><div>- pricePerM3</div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-31">
|
||||||
|
<mxGeometry y="26" width="160" height="54" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-33" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-31">
|
||||||
|
<mxGeometry y="80" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-34" value="<div>+ HalfContainer()</div><div>+ Fee(): float</div><div>+ Area(): int</div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-31">
|
||||||
|
<mxGeometry y="88" width="160" height="52" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=0;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-35">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="669.9999999999998" y="190" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-35" value="FullContainer" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="600" y="320" width="160" height="188" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-36" value="<div>- weight: int</div><div>- fridged: bool</div><div>- pricePerKg: float</div><div>- fridgePercentage: float</div><div>- maxWeight: int</div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-35">
|
||||||
|
<mxGeometry y="26" width="160" height="84" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-37" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-35">
|
||||||
|
<mxGeometry y="110" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-38" value="<div>+ FullContainer()</div><div>+ Fee(): float</div><div>+ Weight: int</div><div>+ Friged: bool</div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-35">
|
||||||
|
<mxGeometry y="118" width="160" height="70" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.51;entryY=0.99;entryDx=0;entryDy=0;entryPerimeter=0;endArrow=block;endFill=0;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-26" target="Ey-4shX72MY-NRdcRtJe-24">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="320" y="255" />
|
||||||
|
<mxPoint x="672" y="255" />
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-55" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=block;endFill=0;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-43" target="Ey-4shX72MY-NRdcRtJe-53">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-43" value="WeightMaxException" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="420" y="500" width="160" height="34" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-45" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-43">
|
||||||
|
<mxGeometry y="26" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-50" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;startArrow=open;startFill=0;endArrow=none;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-47" target="Ey-4shX72MY-NRdcRtJe-35">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-52" value="Throws" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="Ey-4shX72MY-NRdcRtJe-50">
|
||||||
|
<mxGeometry x="0.1961" y="1" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-56" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;endArrow=block;endFill=0;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-47">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="499.9999999999998" y="600" as="targetPoint" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-47" value="VolumeMaxException" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="600" y="550" width="160" height="34" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-48" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-47">
|
||||||
|
<mxGeometry y="26" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-49" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.499;entryY=1.071;entryDx=0;entryDy=0;entryPerimeter=0;startArrow=open;startFill=0;endArrow=none;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-43" target="Ey-4shX72MY-NRdcRtJe-34">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-51" value="Throws" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="Ey-4shX72MY-NRdcRtJe-49">
|
||||||
|
<mxGeometry x="0.383" y="-2" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-59" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=block;endFill=0;" edge="1" parent="1" source="Ey-4shX72MY-NRdcRtJe-53" target="Ey-4shX72MY-NRdcRtJe-57">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-53" value="BaseException" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="420" y="600" width="160" height="34" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-54" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-53">
|
||||||
|
<mxGeometry y="26" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-57" value="Exception" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="420" y="680" width="160" height="34" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-58" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="Ey-4shX72MY-NRdcRtJe-57">
|
||||||
|
<mxGeometry y="26" width="160" height="8" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-60" value="<div>1</div>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="280" y="60" width="30" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-61" value="<div>1</div>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="70" y="140" width="30" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="Ey-4shX72MY-NRdcRtJe-62" value="0..*" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="555" y="75" width="40" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
</root>
|
||||||
|
</mxGraphModel>
|
||||||
|
</diagram>
|
||||||
|
</mxfile>
|
||||||
BIN
CS/CS2A shipping UML/UML_2A_Rens_Pastoor_v1.1.pdf
Normal file
BIN
CS/CS2A shipping UML/UML_2A_Rens_Pastoor_v1.1.pdf
Normal file
Binary file not shown.
BIN
CS/CS2A shipping UML/UML_2A_Rens_Pastoor_v1.pdf
Normal file
BIN
CS/CS2A shipping UML/UML_2A_Rens_Pastoor_v1.pdf
Normal file
Binary file not shown.
BIN
CS/CS2B shipping company.zip
Normal file
BIN
CS/CS2B shipping company.zip
Normal file
Binary file not shown.
13
CS/CS2B shipping company/.idea/.idea.CS2B shipping company/.idea/.gitignore
generated
vendored
Normal file
13
CS/CS2B shipping company/.idea/.idea.CS2B shipping company/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/modules.xml
|
||||||
|
/.idea.CS2B shipping company.iml
|
||||||
|
/contentModel.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
10
CS/CS2B shipping company/.idea/.idea.CS2B shipping company/.idea/indexLayout.xml
generated
Normal file
10
CS/CS2B shipping company/.idea/.idea.CS2B shipping company/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders>
|
||||||
|
<Path>../../../T2</Path>
|
||||||
|
</attachedFolders>
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
CS/CS2B shipping company/.idea/.idea.CS2B shipping company/.idea/vcs.xml
generated
Normal file
6
CS/CS2B shipping company/.idea/.idea.CS2B shipping company/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
16
CS/CS2B shipping company/CS2B shipping company.sln
Normal file
16
CS/CS2B shipping company/CS2B shipping company.sln
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CS2B shipping company", "CS2B shipping company\CS2B shipping company.csproj", "{2E5A9359-DD17-4982-8329-7B046DA2DDA2}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{2E5A9359-DD17-4982-8329-7B046DA2DDA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2E5A9359-DD17-4982-8329-7B046DA2DDA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2E5A9359-DD17-4982-8329-7B046DA2DDA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2E5A9359-DD17-4982-8329-7B046DA2DDA2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<RootNamespace>CS2B_shipping_company</RootNamespace>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
59
CS/CS2B shipping company/CS2B shipping company/Company.cs
Normal file
59
CS/CS2B shipping company/CS2B shipping company/Company.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using System.Text;
|
||||||
|
using CS2B_shipping_company.Container;
|
||||||
|
|
||||||
|
namespace CS2B_shipping_company;
|
||||||
|
|
||||||
|
// Company.cs
|
||||||
|
public class Company
|
||||||
|
{
|
||||||
|
private readonly List<BaseContainer> containers = new List<BaseContainer>();
|
||||||
|
|
||||||
|
public void Add(BaseContainer container)
|
||||||
|
{
|
||||||
|
containers.Add(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GenerateReport()
|
||||||
|
{
|
||||||
|
StringBuilder report = new StringBuilder();
|
||||||
|
report.AppendLine("| Id | Weight | Volume | Refrid | Fee |");
|
||||||
|
|
||||||
|
// Process FullContainers
|
||||||
|
List<FullContainer> fullContainers = containers.OfType<FullContainer>().ToList();
|
||||||
|
if (fullContainers.Any())
|
||||||
|
{
|
||||||
|
foreach (FullContainer container in fullContainers)
|
||||||
|
{
|
||||||
|
report.AppendLine($"| Full Size {container.Id} | {container.Weight}kg | | {(container.IsRefrigerated ? "Y" : "N")} | €{container.Fee():F2} |");
|
||||||
|
}
|
||||||
|
report.AppendLine($"| Total | | | €{fullContainers.Sum(c => c.Fee()):F2} |");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process HalfContainers
|
||||||
|
List<HalfContainer> halfContainers = containers.OfType<HalfContainer>().ToList();
|
||||||
|
if (halfContainers.Any())
|
||||||
|
{
|
||||||
|
foreach (HalfContainer container in halfContainers)
|
||||||
|
{
|
||||||
|
report.AppendLine($"| Half Size {container.Id} | | {container.Volume}m3 | N/A | €{container.Fee():F2} |");
|
||||||
|
}
|
||||||
|
report.AppendLine($"| Total | | | €{halfContainers.Sum(c => c.Fee()):F2} |");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process Quarter Containers
|
||||||
|
List<QuarterContainer> quarterContainers = containers.OfType<QuarterContainer>().ToList();
|
||||||
|
if (quarterContainers.Any())
|
||||||
|
{
|
||||||
|
foreach (QuarterContainer container in quarterContainers)
|
||||||
|
{
|
||||||
|
report.AppendLine($"| Quarter Size {container.Id} | | | N/A | €{container.Fee():F2} |");
|
||||||
|
}
|
||||||
|
report.AppendLine($"| Total | | | €{quarterContainers.Sum(c => c.Fee()):F2} |");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grand Total
|
||||||
|
report.AppendLine($"| Grand Total | | | €{containers.Sum(c => c.Fee()):F2} |");
|
||||||
|
|
||||||
|
return report.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace CS2B_shipping_company.Container;
|
||||||
|
|
||||||
|
public abstract class BaseContainer
|
||||||
|
{
|
||||||
|
private static int idCount = 1000;
|
||||||
|
|
||||||
|
public int Id { get; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string CountryOfOrigin { get; set; }
|
||||||
|
|
||||||
|
protected BaseContainer(string description, string countryOfOrigin)
|
||||||
|
{
|
||||||
|
Id = idCount++;
|
||||||
|
Description = description;
|
||||||
|
CountryOfOrigin = countryOfOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract float Fee();
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using CS2B_shipping_company.Exception;
|
||||||
|
|
||||||
|
namespace CS2B_shipping_company.Container;
|
||||||
|
|
||||||
|
public class FullContainer : BaseContainer
|
||||||
|
{
|
||||||
|
private const float FeePerKg = 0.91f;
|
||||||
|
private const float FridgePercentage = 0.08f;
|
||||||
|
private const int MaxWeight = 20000;
|
||||||
|
private int weight;
|
||||||
|
|
||||||
|
public int Weight
|
||||||
|
{
|
||||||
|
get => weight;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value > MaxWeight)
|
||||||
|
throw new WeightExceededException($"Weight cannot exceed {MaxWeight}kg");
|
||||||
|
weight = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsRefrigerated { get; set; }
|
||||||
|
|
||||||
|
public FullContainer(string description, string countryOfOrigin)
|
||||||
|
: base(description, countryOfOrigin) { }
|
||||||
|
|
||||||
|
public override float Fee()
|
||||||
|
{
|
||||||
|
float fee = Weight * FeePerKg;
|
||||||
|
if (IsRefrigerated)
|
||||||
|
fee += fee * FridgePercentage;
|
||||||
|
return fee;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using CS2B_shipping_company.Exception;
|
||||||
|
|
||||||
|
namespace CS2B_shipping_company.Container;
|
||||||
|
|
||||||
|
public class HalfContainer : BaseContainer
|
||||||
|
{
|
||||||
|
private const float FeePerM3 = 19.37f;
|
||||||
|
private const int MaxVolume = 40;
|
||||||
|
private int volume;
|
||||||
|
|
||||||
|
public int Volume
|
||||||
|
{
|
||||||
|
get => volume;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value > MaxVolume)
|
||||||
|
throw new VolumeExceededException($"Volume cannot exceed {MaxVolume}m³");
|
||||||
|
volume = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HalfContainer(string description, string countryOfOrigin)
|
||||||
|
: base(description, countryOfOrigin) { }
|
||||||
|
|
||||||
|
public override float Fee() => Volume * FeePerM3;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace CS2B_shipping_company.Container;
|
||||||
|
|
||||||
|
public class QuarterContainer : BaseContainer
|
||||||
|
{
|
||||||
|
private const float FixedFee = 1692.72f;
|
||||||
|
|
||||||
|
public QuarterContainer(string description, string countryOfOrigin)
|
||||||
|
: base(description, countryOfOrigin) { }
|
||||||
|
|
||||||
|
public override float Fee() => FixedFee;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace CS2B_shipping_company.Exception;
|
||||||
|
|
||||||
|
public class InvalidInputException : ShippingException
|
||||||
|
{
|
||||||
|
public InvalidInputException(string message) : base(message) { }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace CS2B_shipping_company.Exception;
|
||||||
|
|
||||||
|
public class ShippingException : System.Exception
|
||||||
|
{
|
||||||
|
public ShippingException(string message) : base(message) { }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace CS2B_shipping_company.Exception;
|
||||||
|
|
||||||
|
public class VolumeExceededException : ShippingException
|
||||||
|
{
|
||||||
|
public VolumeExceededException(string message) : base(message) { }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace CS2B_shipping_company.Exception;
|
||||||
|
|
||||||
|
public class WeightExceededException : ShippingException
|
||||||
|
{
|
||||||
|
public WeightExceededException(string message) : base(message) { }
|
||||||
|
}
|
||||||
17
CS/CS2B shipping company/CS2B shipping company/Program.cs
Normal file
17
CS/CS2B shipping company/CS2B shipping company/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace CS2B_shipping_company;
|
||||||
|
|
||||||
|
public class Program {
|
||||||
|
public static async Task Main(string[] args){
|
||||||
|
Company company = new Company();
|
||||||
|
Server server = new Server(company);
|
||||||
|
|
||||||
|
server.SetupServer();
|
||||||
|
Console.WriteLine("Server started. Press any key to stop...");
|
||||||
|
|
||||||
|
Task serverTask = server.ServerLoop();
|
||||||
|
|
||||||
|
Console.ReadKey();
|
||||||
|
server.StopServer();
|
||||||
|
await serverTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
142
CS/CS2B shipping company/CS2B shipping company/Server.cs
Normal file
142
CS/CS2B shipping company/CS2B shipping company/Server.cs
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using CS2B_shipping_company.Container;
|
||||||
|
using CS2B_shipping_company.Exception;
|
||||||
|
|
||||||
|
namespace CS2B_shipping_company;
|
||||||
|
|
||||||
|
public class Server
|
||||||
|
{
|
||||||
|
private readonly Company company;
|
||||||
|
private TcpListener listener;
|
||||||
|
private bool serverRunning;
|
||||||
|
|
||||||
|
public Server(Company company)
|
||||||
|
{
|
||||||
|
this.company = company;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetupServer(int port = 23)
|
||||||
|
{
|
||||||
|
listener = new TcpListener(IPAddress.Any, port);
|
||||||
|
listener.Start();
|
||||||
|
serverRunning = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ServerLoop()
|
||||||
|
{
|
||||||
|
while (serverRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TcpClient client = await listener.AcceptTcpClientAsync();
|
||||||
|
NetworkStream stream = client.GetStream();
|
||||||
|
StreamReader reader = new StreamReader(stream);
|
||||||
|
StreamWriter writer = new StreamWriter(stream) { AutoFlush = true };
|
||||||
|
{
|
||||||
|
await HandleClient(reader, writer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Error: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task HandleClient(StreamReader reader, StreamWriter writer)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await writer.WriteLineAsync("WELCOME");
|
||||||
|
|
||||||
|
string? command = await reader.ReadLineAsync();
|
||||||
|
if (command == "STOP")
|
||||||
|
{
|
||||||
|
await writer.WriteLineAsync("ACK");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command != "START")
|
||||||
|
{
|
||||||
|
await writer.WriteLineAsync("ERR;Invalid command");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await writer.WriteLineAsync("TYPE");
|
||||||
|
string? type = await reader.ReadLineAsync();
|
||||||
|
|
||||||
|
BaseContainer container = null;
|
||||||
|
|
||||||
|
switch (type?.ToUpper())
|
||||||
|
{
|
||||||
|
case "FULL":
|
||||||
|
container = await ProcessFullContainer(reader, writer);
|
||||||
|
break;
|
||||||
|
case "HALF":
|
||||||
|
container = await ProcessHalfContainer(reader, writer);
|
||||||
|
break;
|
||||||
|
case "QUART":
|
||||||
|
container = new QuarterContainer("Unknown", "Unknown");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
await writer.WriteLineAsync("ERR;Invalid Type");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (container != null)
|
||||||
|
{
|
||||||
|
company.Add(container);
|
||||||
|
await writer.WriteLineAsync("ACK");
|
||||||
|
await writer.WriteLineAsync(company.GenerateReport());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ShippingException ex)
|
||||||
|
{
|
||||||
|
await writer.WriteLineAsync($"ERR;{ex.Message}");
|
||||||
|
}
|
||||||
|
catch (System.Exception ex)
|
||||||
|
{
|
||||||
|
await writer.WriteLineAsync($"ERR;{ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<FullContainer> ProcessFullContainer(StreamReader reader, StreamWriter writer)
|
||||||
|
{
|
||||||
|
await writer.WriteLineAsync("FRIDGE");
|
||||||
|
string? fridgeResponse = await reader.ReadLineAsync();
|
||||||
|
bool isRefrigerated = fridgeResponse?.ToUpper() == "YES";
|
||||||
|
|
||||||
|
await writer.WriteLineAsync("WEIGHT");
|
||||||
|
if (!int.TryParse(await reader.ReadLineAsync(), out int weight))
|
||||||
|
throw new InvalidInputException("Invalid weight");
|
||||||
|
|
||||||
|
FullContainer container = new FullContainer("Unknown", "Unknown")
|
||||||
|
{
|
||||||
|
IsRefrigerated = isRefrigerated,
|
||||||
|
Weight = weight
|
||||||
|
};
|
||||||
|
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<HalfContainer> ProcessHalfContainer(StreamReader reader, StreamWriter writer)
|
||||||
|
{
|
||||||
|
await writer.WriteLineAsync("VOLUME");
|
||||||
|
if (!int.TryParse(await reader.ReadLineAsync(), out int volume))
|
||||||
|
throw new InvalidInputException("Invalid volume");
|
||||||
|
|
||||||
|
HalfContainer container = new HalfContainer("Unknown", "Unknown")
|
||||||
|
{
|
||||||
|
Volume = volume
|
||||||
|
};
|
||||||
|
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopServer()
|
||||||
|
{
|
||||||
|
serverRunning = false;
|
||||||
|
listener?.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"runtimeTarget": {
|
||||||
|
"name": ".NETCoreApp,Version=v9.0",
|
||||||
|
"signature": ""
|
||||||
|
},
|
||||||
|
"compilationOptions": {},
|
||||||
|
"targets": {
|
||||||
|
".NETCoreApp,Version=v9.0": {
|
||||||
|
"CS2B shipping company/1.0.0": {
|
||||||
|
"runtime": {
|
||||||
|
"CS2B shipping company.dll": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"CS2B shipping company/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"serviceable": false,
|
||||||
|
"sha512": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"runtimeOptions": {
|
||||||
|
"tfm": "net9.0",
|
||||||
|
"framework": {
|
||||||
|
"name": "Microsoft.NETCore.App",
|
||||||
|
"version": "9.0.0"
|
||||||
|
},
|
||||||
|
"configProperties": {
|
||||||
|
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
|
||||||
|
"projectName": "CS2B shipping company",
|
||||||
|
"projectPath": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
|
||||||
|
"packagesPath": "/home/rens/.nuget/packages/",
|
||||||
|
"outputPath": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"configFilePaths": [
|
||||||
|
"/home/rens/.nuget/NuGet/NuGet.Config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net9.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
},
|
||||||
|
"SdkAnalysisLevel": "9.0.300"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "/home/rens/.dotnet/sdk/9.0.300/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/rens/.nuget/packages/</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/rens/.nuget/packages/</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.13.2</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="/home/rens/.nuget/packages/" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
[assembly: System.Reflection.AssemblyCompanyAttribute("CS2B shipping company")]
|
||||||
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+04072d831e97b3c2b671f814b538ff66918387e3")]
|
||||||
|
[assembly: System.Reflection.AssemblyProductAttribute("CS2B shipping company")]
|
||||||
|
[assembly: System.Reflection.AssemblyTitleAttribute("CS2B shipping company")]
|
||||||
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
|
// Generated by the MSBuild WriteCodeFragment class.
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
f4ce571968b5b266f724fd1c97923543f743c6a4b13182626c331000da0b437e
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
is_global = true
|
||||||
|
build_property.TargetFramework = net9.0
|
||||||
|
build_property.TargetPlatformMinVersion =
|
||||||
|
build_property.UsingMicrosoftNETSdkWeb =
|
||||||
|
build_property.ProjectTypeGuids =
|
||||||
|
build_property.InvariantGlobalization =
|
||||||
|
build_property.PlatformNeutralAssembly =
|
||||||
|
build_property.EnforceExtendedAnalyzerRules =
|
||||||
|
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||||
|
build_property.RootNamespace = CS2B_shipping_company
|
||||||
|
build_property.ProjectDir = /home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/
|
||||||
|
build_property.EnableComHosting =
|
||||||
|
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||||
|
build_property.EffectiveAnalysisLevelStyle = 9.0
|
||||||
|
build_property.EnableCodeStyleSeverity =
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// <auto-generated/>
|
||||||
|
global using global::System;
|
||||||
|
global using global::System.Collections.Generic;
|
||||||
|
global using global::System.IO;
|
||||||
|
global using global::System.Linq;
|
||||||
|
global using global::System.Net.Http;
|
||||||
|
global using global::System.Threading;
|
||||||
|
global using global::System.Threading.Tasks;
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
5d169557bd2a42faab7745e4d74a6575a9fbb85ef47e3589bb83f45afbd68f86
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/bin/Debug/net9.0/CS2B shipping company
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/bin/Debug/net9.0/CS2B shipping company.dll
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/bin/Debug/net9.0/CS2B shipping company.pdb
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.AssemblyInfoInputs.cache
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.AssemblyInfo.cs
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.csproj.CoreCompileInputs.cache
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.dll
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/refint/CS2B shipping company.dll
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.pdb
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/bin/Debug/net9.0/CS2B shipping company.deps.json
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/bin/Debug/net9.0/CS2B shipping company.runtimeconfig.json
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.genruntimeconfig.cache
|
||||||
|
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/ref/CS2B shipping company.dll
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
6dc63fc683064ca4e993659b38ad594dac85a1a95861ff2a2c9e888850bc3c64
|
||||||
Binary file not shown.
BIN
CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/apphost
Executable file
BIN
CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/apphost
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"targets": {
|
||||||
|
"net9.0": {}
|
||||||
|
},
|
||||||
|
"libraries": {},
|
||||||
|
"projectFileDependencyGroups": {
|
||||||
|
"net9.0": []
|
||||||
|
},
|
||||||
|
"packageFolders": {
|
||||||
|
"/home/rens/.nuget/packages/": {}
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
|
||||||
|
"projectName": "CS2B shipping company",
|
||||||
|
"projectPath": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
|
||||||
|
"packagesPath": "/home/rens/.nuget/packages/",
|
||||||
|
"outputPath": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"configFilePaths": [
|
||||||
|
"/home/rens/.nuget/NuGet/NuGet.Config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net9.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
},
|
||||||
|
"SdkAnalysisLevel": "9.0.300"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "/home/rens/.dotnet/sdk/9.0.300/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"dgSpecHash": "rp3IcKxAp1s=",
|
||||||
|
"success": true,
|
||||||
|
"projectFilePath": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
|
||||||
|
"expectedPackageFiles": [],
|
||||||
|
"logs": []
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"restore":{"projectUniqueName":"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj","projectName":"CS2B shipping company","projectPath":"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj","outputPath":"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net9.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net9.0":{"targetAlias":"net9.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.300"}"frameworks":{"net9.0":{"targetAlias":"net9.0","imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/home/rens/.dotnet/sdk/9.0.300/PortableRuntimeIdentifierGraph.json"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
17495474612743232
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
17495474612743232
|
||||||
Binary file not shown.
Reference in New Issue
Block a user