Skip to content

Commit

Permalink
1.1.2.3 Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taicanium committed Feb 13, 2024
1 parent 0c94489 commit 22537c2
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 34 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.1.2.3 - 12/02/2024
- Fixed a major error whereby only the first tag in a message was handled in HTML format. Yes, really.
- Newlines are now handled correctly in HTML output after being broken.

# 1.1.2.2 - 09/02/2024
- Quick fix: HTML entities are no longer handled in plaintext output. Oops.

Expand Down
2 changes: 1 addition & 1 deletion FLogS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<UseWPF>true</UseWPF>
<SignAssembly>False</SignAssembly>
<Title>FLogS</Title>
<Version>1.1.2.2</Version>
<Version>1.1.2.3</Version>
<IncludeSymbols>True</IncludeSymbols>
<ErrorReport>none</ErrorReport>
<UseWindowsForms>True</UseWindowsForms>
Expand Down
4 changes: 1 addition & 3 deletions KNOWN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# Known Issues
- Ads are read correctly as they are in later versions, but much older clients didn't record ads as uniquely ID'd messages - they appear to have just been plaintext, with no delimiter. Reading them causes patches of garbage.
- Subscripts are causing future tags in a message to wholly vanish. Repeat: Subscripts break all other tags. Good lord.
- HTML output doesn't retain intra-message newlines.
- Ads are read correctly as they are in later versions, but much older clients didn't record ads as uniquely ID'd messages - they appear to have just been plaintext, with no delimiter. Reading them causes patches of garbage.
8 changes: 4 additions & 4 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<ProgressBar x:Name="FileProgress" Width="600" Height="25" HorizontalAlignment="Center" Minimum="0" Maximum="100"/>
</StackPanel>
</Grid>
<Label x:Name="FileVersionNumber" Content="FLogS — Version 1.1.2.2 © Taica, 2024" HorizontalAlignment="Right" FontStyle="Italic" Margin="10,5" FontWeight="Thin"/>
<Label x:Name="FileVersionNumber" Content="FLogS — Version 1.1.2.3 © Taica, 2024" HorizontalAlignment="Right" FontStyle="Italic" Margin="10,5" FontWeight="Thin"/>
</StackPanel>
</Grid>
</Grid>
Expand Down Expand Up @@ -176,7 +176,7 @@
<ProgressBar x:Name="DirectoryProgress" Width="600" Height="25" HorizontalAlignment="Center" Minimum="0" Maximum="100"/>
</StackPanel>
</Grid>
<Label x:Name="DirectoryVersionNumber" Content="FLogS — Version 1.1.2.2 © Taica, 2024" HorizontalAlignment="Right" FontStyle="Italic" Margin="10,5" FontWeight="Thin"/>
<Label x:Name="DirectoryVersionNumber" Content="FLogS — Version 1.1.2.3 © Taica, 2024" HorizontalAlignment="Right" FontStyle="Italic" Margin="10,5" FontWeight="Thin"/>
</StackPanel>
</Grid>
</Grid>
Expand Down Expand Up @@ -267,7 +267,7 @@
<ProgressBar x:Name="PhraseProgress" Width="600" Height="25" HorizontalAlignment="Center" Minimum="0" Maximum="100"/>
</StackPanel>
</Grid>
<Label x:Name="PhraseVersionNumber" Content="FLogS — Version 1.1.2.2 © Taica, 2024" HorizontalAlignment="Right" FontStyle="Italic" Margin="10,5" FontWeight="Thin"/>
<Label x:Name="PhraseVersionNumber" Content="FLogS — Version 1.1.2.3 © Taica, 2024" HorizontalAlignment="Right" FontStyle="Italic" Margin="10,5" FontWeight="Thin"/>
</StackPanel>
</Grid>
</Grid>
Expand Down Expand Up @@ -323,7 +323,7 @@
</Grid>
<Grid Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" Margin="2,2">
<StackPanel Background="LightGray" Margin="2,2">
<Label x:Name="HelpVersionNumber" Content="FLogS — Version 1.1.2.2 © Taica, 2024" HorizontalAlignment="Right" FontStyle="Italic" Margin="10,3" FontWeight="Thin"/>
<Label x:Name="HelpVersionNumber" Content="FLogS — Version 1.1.2.3 © Taica, 2024" HorizontalAlignment="Right" FontStyle="Italic" Margin="10,3" FontWeight="Thin"/>
</StackPanel>
</Grid>
</Grid>
Expand Down
7 changes: 7 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ private void MainGrid_MouseMove(object sender, System.Windows.Input.MouseEventAr
if (!overrideFormat && FileOutput.Text.EndsWith(".html"))
SaveFormat.SelectedIndex = 1;

if (!overrideFormat && DirectoryOutput.Text.EndsWith(".txt"))
DirectorySaveFormat.SelectedIndex = 0;
if (!overrideFormat && PhraseOutput.Text.EndsWith(".txt"))
PhraseSaveFormat.SelectedIndex = 0;
if (!overrideFormat && FileOutput.Text.EndsWith(".txt"))
SaveFormat.SelectedIndex = 0;

Common.plaintext = DirectorySaveFormat.SelectedIndex != 1;
}

Expand Down
54 changes: 28 additions & 26 deletions MessagePool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal class MessagePool
public static DateTime? dtAfter;
public static DateTime? dtBefore;
public static uint emptyMessages;
private static List<string> filesDone;
private static List<string>? filesDone;
private static readonly Dictionary<string, string> htmlEntities = new()
{
{ "\"", "&quot;" },
Expand All @@ -34,6 +34,7 @@ internal class MessagePool
{ "€", "&euro;" },
{ "©", "&copu;" },
{ "®", "&reg;" },
{ "\n", "<br />" },
};
public static ByteCount intactBytes;
public static uint intactMessages;
Expand Down Expand Up @@ -167,25 +168,24 @@ public static void DoWork(object? sender, DoWorkEventArgs e)

if (!Common.plaintext) // HTML.
dstFS.Write(@"
<!DOCTYPE html>
<html>
<head>
<meta charset=""UTF-8"" />
<title>F-Chat Exported Logs</title>
<style>
body { padding: 10px; background-color: #1A1930; display: block; word-wrap: break-word; -ms-hyphens: auto; -moz-hyphens: auto; -webkit-hyphens: auto; hyphens: auto; max-width: 100%; position: relative; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,Liberation Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji; font-size: 1rem; font-weight: 400; line-height: 1.5; color: #EDEDF5; text-align: left; }
script { display: block; }
.profile { color: #6766AD; text-decoration: none; font-weight: bold; }
.url { color: #FFFFFF; text-decoration: underline; }
.warning { color: #909090; }
.timestamp { color: #C0C0C0; }
.eicon { width: 50px. height: 50px; vertical-align: middle; display: inline; }
.spoiler { background-color: #0D0D0F; color: #0D0D0F; }
.spoiler:hover { background-color: #0D0D0F; color: #FFFFFF; }
</style>
</head>
<body>
");
<!DOCTYPE html>
<html>
<head>
<meta charset=""UTF-8"" />
<title>F-Chat Exported Logs</title>
<style>
body { padding: 10px; background-color: #1A1930; display: block; word-wrap: break-word; -ms-hyphens: auto; -moz-hyphens: auto; -webkit-hyphens: auto; hyphens: auto; max-width: 100%; position: relative; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,Liberation Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji; font-size: 1rem; font-weight: 400; line-height: 1.5; color: #EDEDF5; text-align: left; }
script { display: block; }
.profile { color: #6766AD; text-decoration: none; font-weight: bold; }
.url { color: #FFFFFF; text-decoration: underline; }
.warning { color: #909090; }
.timestamp { color: #C0C0C0; }
.eicon { width: 50px. height: 50px; vertical-align: middle; display: inline; }
.spoiler { background-color: #0D0D0F; color: #0D0D0F; }
.spoiler:hover { background-color: #0D0D0F; color: #FFFFFF; }
</style>
</head>
<body>");

while (srcFS.Position < srcFS.Length - 1)
{
Expand Down Expand Up @@ -328,11 +328,8 @@ private static bool TranslateMessage(FileStream srcFS, StreamWriter dstFS)

if (srcFS.Read(idBuffer, 0, 4) < 4) // Read the timestamp.
return written;

if (!Common.plaintext)
messageData.Add("<br />\n");
else
messageData.Add("\n");

messageData.Add(string.Empty);

timestamp = Common.BEInt(idBuffer); // The timestamp is Big-endian. Fix that.
if (Common.IsValidTimestamp(timestamp))
Expand Down Expand Up @@ -459,6 +456,8 @@ private static bool TranslateMessage(FileStream srcFS, StreamWriter dstFS)
if (!Common.plaintext)
foreach (KeyValuePair<string, string> entity in htmlEntities)
messageOut = Regex.Replace(messageOut, entity.Key, entity.Value);
if (msId == MessageType.Me || msId == MessageType.DiceRoll)
messageOut = messageOut.TrimStart();
messageData.Add(messageOut);
}
}
Expand Down Expand Up @@ -495,6 +494,9 @@ private static bool TranslateMessage(FileStream srcFS, StreamWriter dstFS)
messageOut = Regex.Replace(messageOut, @"\p{Co}+", string.Empty); // Once more, remove everything that's not a printable, newline, or format character.

dstFS.Write(messageOut);
if (!Common.plaintext)
dstFS.Write("<br />");
dstFS.Write(dstFS.NewLine);
lastDiscrepancy = 0;
written = true;
}
Expand Down Expand Up @@ -553,7 +555,6 @@ private static string TranslateTags(string message)
{
int anchorIndex = 0;
int indexAdj = 0;
bool isClosing = false;
string lastTag;
string messageOut = message;
bool noParse = false;
Expand All @@ -565,6 +566,7 @@ private static string TranslateTags(string message)
{
string arg = "";
string tag = tags[i].Groups[1].Value.ToLower();
bool isClosing = false;
bool validTag = true;
if (tags[i].Groups.Count > 2)
arg = tags[i].Groups[2].Value;
Expand Down

0 comments on commit 22537c2

Please sign in to comment.