Skip to content

Commit

Permalink
Merge pull request #21 from jamesjohnmcguire/details-check
Browse files Browse the repository at this point in the history
Details check
  • Loading branch information
jamesjohnmcguire authored Dec 29, 2024
2 parents ea64255 + a8a243f commit 6d7b445
Show file tree
Hide file tree
Showing 5 changed files with 908 additions and 176 deletions.
20 changes: 20 additions & 0 deletions ToolKit.Application/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ public static async Task<int> Main(string[] arguments)

switch (command.Name)
{
case "details":
result = Details(command);
break;
case "dbx-to-pst":
result = DbxToPst(command);
break;
Expand Down Expand Up @@ -158,6 +161,19 @@ public static async Task<int> Main(string[] arguments)
return result;
}

private static int Details(Command command)
{
OutlookAccount outlookAccount = OutlookAccount.Instance;
OutlookStore outlookStore = new (outlookAccount);

string pstFilePath = command.Parameters[0];
string entryId = command.Parameters[1];

outlookStore.Details(pstFilePath, entryId);

return 0;
}

private static void DisplayParameters(
Command command, string[] arguments)
{
Expand Down Expand Up @@ -323,6 +339,10 @@ private static List<Command> GetCommands()
"remove-empty-folders", null, 1, "Prune empty folders");
commands.Add(removeEmptyFolders);

Command details = new (
"details", null, 2, "Show details of given item");
commands.Add(details);

return commands;
}

Expand Down
128 changes: 122 additions & 6 deletions ToolKit.Library/OutlookAppointment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,47 @@ public IList<byte[]> GetProperties(bool strict = false)
return buffers;
}

/// <summary>
/// Get the text of all relevant properties.
/// </summary>
/// <param name="strict">Indicates whether the check should be strict
/// or not.</param>
/// <returns>The text of all relevant properties.</returns>
public string GetPropertiesText(bool strict = false)
{
string propertiesText = string.Empty;

propertiesText += GetBooleansText();
propertiesText += Environment.NewLine;

propertiesText +=
OutlookItem.GetActionsText(appointmentItem.Actions);
propertiesText += Environment.NewLine;

propertiesText +=
OutlookItem.GetAttachmentsText(appointmentItem.Attachments);
propertiesText += Environment.NewLine;

propertiesText += GetDateTimesText();
propertiesText += Environment.NewLine;

propertiesText += GetEnumsText();
propertiesText += Environment.NewLine;

propertiesText +=
OutlookItem.GetRecipientsText(appointmentItem.Recipients);
propertiesText += Environment.NewLine;

propertiesText += GetStringPropertiesText(strict);
propertiesText += Environment.NewLine;

propertiesText += OutlookItem.GetUserPropertiesText(
appointmentItem.UserProperties);
propertiesText += Environment.NewLine;

return propertiesText;
}

/// <summary>
/// Get the item's synopses.
/// </summary>
Expand Down Expand Up @@ -162,6 +203,38 @@ private ushort GetBooleans()
return boolHolder;
}

private string GetBooleansText()
{
string booleansText = string.Empty;

booleansText += OutlookItem.GetBooleanText(
appointmentItem.AllDayEvent);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.AutoResolvedWinner);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.ForceUpdateToAllAttendees);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.IsConflict);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.IsRecurring);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.NoAging);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.ReminderOverrideDefault);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.ReminderPlaySound);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.ReminderSet);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.ResponseRequested);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.Saved);
booleansText += OutlookItem.GetBooleanText(
appointmentItem.UnRead);

return booleansText;
}

private byte[] GetDateTimes()
{
List<DateTime> times = [];
Expand All @@ -180,6 +253,24 @@ private byte[] GetDateTimes()
return data;
}

private string GetDateTimesText()
{
List<DateTime> times = [];

DateTime endUTC = appointmentItem.EndUTC;
times.Add(endUTC);

DateTime replyTime = appointmentItem.ReplyTime;
times.Add(replyTime);

DateTime startUTC = appointmentItem.StartUTC;
times.Add(startUTC);

string dateTimesText = OutlookItem.GetDateTimesText(times);

return dateTimesText;
}

private byte[] GetEnums()
{
List<int> ints = [];
Expand Down Expand Up @@ -213,9 +304,38 @@ private byte[] GetEnums()
return buffer;
}

private string GetEnumsText()
{
string enumsText = string.Empty;

enumsText += nameof(appointmentItem.BusyStatus);
enumsText += nameof(appointmentItem.Class);
enumsText += nameof(appointmentItem.Importance);
enumsText += nameof(appointmentItem.MarkForDownload);
enumsText += nameof(appointmentItem.MeetingStatus);
enumsText += nameof(appointmentItem.RecurrenceState);
enumsText += nameof(appointmentItem.ResponseStatus);
enumsText += nameof(appointmentItem.Sensitivity);

return enumsText;
}

private byte[] GetStringProperties(
bool strict = false,
bool ignoreConversation = true)
{
string buffer =
GetStringPropertiesText(strict, ignoreConversation);

Encoding encoding = Encoding.UTF8;
byte[] data = encoding.GetBytes(buffer);

return data;
}

private string GetStringPropertiesText(
bool strict = false,
bool ignoreConversation = true)
{
string billingInformation = null;

Expand Down Expand Up @@ -278,13 +398,9 @@ private byte[] GetStringProperties(
builder.Append(resources);
builder.Append(subject);

string buffer = builder.ToString();

Encoding encoding = Encoding.UTF8;

byte[] data = encoding.GetBytes(buffer);
string stringProperties = builder.ToString();

return data;
return stringProperties;
}
}
}
Loading

0 comments on commit 6d7b445

Please sign in to comment.