Skip to content

Commit

Permalink
Added ExportCommand into parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Macchazuki committed Mar 18, 2019
2 parents 36dfe61 + aebaff1 commit 6e48781
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ image::UndoRedoActivityDiagram.png[width="650"]

=== Data Encryption

The storage file "PlanMySem.txt" is encrypted to prevent easy access of the user's calendar.

The storage file "PlanMySem.txt" is encrypted to prevent easy access of the user calendar.
We are encrypting and decrypting the data using the Java Cypher class.
This feature is implemented through creating a Encryptor that contains encrypt and decrypt methods. The encrypt method takes a String object as an argument and returns a encrypted String object. The decrypt method takes in a String object as an argument and returns the decrypted message as a String object.

Expand All @@ -371,7 +372,7 @@ Similarly, decryption of the data is done automatically before it is loaded. In
=== Exporting .ics file

The user can export the current planner into a .ics file to use in external calendar applications. The .ics file will contain the names of the slots in the SUMMARY field and the descriptions in the DESCRIPTION field. This command automatically exports into the main directory and names the file “PlanMySem.ics”. Future updates can include user input to allow saving the file in another directory and naming the file.
We have chosen to use the iCalendar format due to its popularity and it’s use in applications such as Google Calendar, Microsoft Outlook and Nusmods.
We have chosen to use the iCalendar format due to its popularity and its use in applications such as Google Calendar, Microsoft Outlook and Nusmods.

In our implementation, we have chosen not to export the tags into the .ics file. This is because iCalendar does not have in-built tag fields. This means that other other applications that import .ics will not be able to use the tags.

Expand Down
1 change: 0 additions & 1 deletion src/planmysem/commands/ExportCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class ExportCommand extends Command {
@Override
public CommandResult execute() {
AdaptedSemester semester = new AdaptedSemester(planner.getSemester());
System.out.println(semester.toString());
try {
BufferedWriter writer = new BufferedWriter(new FileWriter("PlanMySem.ics"));
writer.write(semester.toString());
Expand Down
6 changes: 5 additions & 1 deletion src/planmysem/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import planmysem.commands.DeleteCommand;
import planmysem.commands.EditCommand;
import planmysem.commands.ExitCommand;
import planmysem.commands.ExportCommand;
import planmysem.commands.FindCommand;
import planmysem.commands.HelpCommand;
import planmysem.commands.IncorrectCommand;
Expand All @@ -28,7 +29,7 @@
/**
* Parses user input.
*/
public class Parser {
public class Parser {

public static final Pattern PERSON_INDEX_ARGS_FORMAT = Pattern.compile("(?<targetIndex>.+)");

Expand Down Expand Up @@ -96,6 +97,9 @@ public Command parseCommand(String userInput) {
case ExitCommand.COMMAND_WORD:
return new ExitCommand();

case ExportCommand.COMMAND_WORD:
return new ExportCommand();

case HelpCommand.COMMAND_WORD: // Fallthrough

default:
Expand Down

0 comments on commit 6e48781

Please sign in to comment.