μΉ΄μΉ΄μ€ν‘μ λͺ¨ν°λΈλ‘ C# (.Net Core 3.1, .Net Framework 4.7.2)
κ³Ό MySQL
λ±μ μ¬μ©ν΄ λ§λ μ¬λ΄ μ±ν
νλ‘κ·Έλ¨ ννλ‘μ νΈ μ
λλ€.
μ€ννκΈ° μν΄μλ λͺκ°μ§ μ€μ μ΄ νμν©λλ€.
μλ² νλ‘κ·Έλ¨μ λ리기 μν΄ .Net Core
μ MySQL
νλ‘κ·Έλ¨μ΄ μ€μΉλ μ μλ Ubuntu 20.04 LTS
μ΄μ체μ μμ μ°μ MySQL
μ μ€μΉνκ³ DB
λ° User
λ₯Ό μμ±ν©λλ€.
sudo mysql -u root -p
CREATE DATABASE ost DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER ost@localhost identified BY 'dr@M@0st';
GRANT ALL PRIVILEGES ON ost.* TO ost@localhost;
FLUSH PRIVILEGES;
CREATE TABLE `ost`.`employee` (
`id` INT NOT NULL,
`password` VARCHAR(64) NOT NULL,
`name` VARCHAR(20) NOT NULL,
`phone` VARCHAR(14) NULL,
`central` VARCHAR(45) NOT NULL,
`team` VARCHAR(45) NOT NULL,
`rank` VARCHAR(45) NOT NULL,
`profile` LONGBLOB NULL,
`profile_length` INT UNSIGNED NULL,
PRIMARY KEY (`id`));
CREATE TABLE `ost`.`schedule` (
`author` INT NOT NULL,
`title` VARCHAR(45) NULL,
`start` DATETIME NOT NULL,
`end` DATETIME NOT NULL,
`scope` VARCHAR(45) NULL,
`contents` LONGTEXT NULL,
`target` VARCHAR(45) NULL,
CONSTRAINT `schedule_id`
FOREIGN KEY (`author`)
REFERENCES `ost`.`employee` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE TABLE `ost`.`room` (
`id` VARCHAR(32) NOT NULL,
`scope` INT NULL,
`target` VARCHAR(45) NULL,
PRIMARY KEY (`id`));
CREATE TABLE `ost`.`chat` (
`room_id` VARCHAR(32) NOT NULL,
`chat_date` DATETIME(6) NOT NULL,
`employee_id` INT NOT NULL,
`data` LONGBLOB NULL,
`data_length` INT NULL,
`data_type` INT NULL,
UNIQUE INDEX `chat_date_UNIQUE` (`chat_date` ASC) VISIBLE,
INDEX `chat_room_id_idx` (`room_id` ASC) VISIBLE,
INDEX `chat_date_idx` (`chat_date` ASC) VISIBLE,
INDEX `chat_employee_id_idx` (`employee_id` ASC) VISIBLE,
CONSTRAINT `chat_room_id`
FOREIGN KEY (`room_id`)
REFERENCES `ost`.`room` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `chat_employee_id`
FOREIGN KEY (`employee_id`)
REFERENCES `ost`.`employee` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
μ΄λ‘μ¨ μ¬μ μΈν
μ΄ λͺ¨λ λλ¬μ΅λλ€.
Release
νμμ OSTServer.zip
μ λ€μ΄λ°κ³ μμΆμ νμ΄μ£ΌμΈμ.
μλ²λ
.Net Core 3.1
λ₯Ό μ¬μ©νλ©° μ€ννλ κ³³μ μ€μΉκ° λμ΄ μμ΄μΌν©λλ€. λνMySQL
λλMariaDB
κ° μ€μΉλμ΄ μμ΄μΌνλ©° λ°μ΄ν° λ² μ΄μ€λ127.0.0.1
λ‘ μ μνκΈ° λλ¬Έμ λ‘컬μ μ€μΉλμ΄ μμ΄μΌν©λλ€. (νλ‘μ νΈServer/Classes/Database.cs
μμ λ³κ²½ κ°λ₯)
dotnet [server-ip] [server-port]
.\OSTServer.exe [port]
OSTServer.exe
λ₯Ό κ·Έλ₯ μ€νν΄λ λμ§λ§ ν¬νΈλ κΈ°λ³Έκ°μΈ6756
μΌλ‘λ§ μ€νλ©λλ€.
PS C:\Users\chchc\Downloads\OSTServer> .\OSTServer.exe
[2021-07-14 13:40:19] DB | Server 127.0.0.1 is connected
[2021-07-14 13:40:19] System | Server is opend with port 6756
.Net Framework 4.7.2
κΈ°λ°μ΄λ©° Window Forms
λ‘ μ μλμ΄ μλμ°μμλ§ μ€ννμκΈΈ λ°λλλ€.
리λ
μ€μ κ°μ μ΄μ체μ μμ μ€νκ°λ₯ν λ°©λ²λ μμΌλ μ¬κΈ°μ λ€λ£¨μ§ μκ² μ΅λλ€.
.\OfficeMessengarST.exe [server-ip] [server-port]
OfficeMessengarST.exe
λ₯Ό κ·Έλ₯ μ€νν΄λ λμ§λ§ κΈ°λ³Έκ°μΈ127.0.0.1:6756
μΌλ‘λ§ μ€νλ©λλ€.
μ΄μ λΆν° νλ‘κ·Έλ¨ κΈ°λ₯μ νν΄μ³ 보λλ‘ νκ² μ΅λλ€.
target
컬λΌμ΄ μ 1μ κ·νλ λ§μ‘±νμ§ λͺ»νλ€λ μ μ΄ μμ½κΈ΄ ν©λλ€.
μ±ν
ν
μ΄λΈμ key
λ₯Ό μ§μ νκΈ° μν΄ chat_date
컬λΌμ DATETIME(6)
μΌλ‘ μ§μ νμ¬ millisecond
κΉμ§ μ μ₯νλλ‘ νμμ΅λλ€.
μΉ΄μΉ΄μ€ν‘ μ²λΌ κ°μμ¬λ, κ°μ μκ°(λΆ λ¨μ κΉμ§) μΌ κ²½μ° μ±ν μ΄ μ°κ²°λλλ‘ λμ΄μμ΅λλ€.
λ°μ΄ν°λ² μ΄μ€μ μ¬μ μ λ³΄κ° μ μ₯λ λ λΉλ°λ²νΈλ₯Ό SHA-512
μνΈν μκ³ λ¦¬μ¦μ μ μ©νμ¬ μ μ₯νμ¬ λ³΄μμ ν μΈ΅ λ κ°ννμμ΅λλ€.