More modernization

- Split generic "common" libraries into specific libraries
- Use other packages in lieu of custom code
- General cleanup
This commit is contained in:
2023-04-05 16:06:38 -04:00
parent f480a6c373
commit b5f570688d
46 changed files with 1210 additions and 656 deletions

View File

@@ -1,42 +1,38 @@
using Common.IO;
using System;
using System;
namespace FeedCenter
{
public partial class MainWindow
{
private InterprocessMessageListener _commandLineListener;
private void HandleCommandLine(object sender, InterprocessMessageListener.InterprocessMessageEventArgs e)
private void HandleCommandLine(string commandLine)
{
// If the command line is blank then ignore it
if (e.Message.Length == 0)
if (commandLine.Length == 0)
return;
// Pad the command line with a trailing space just to be lazy in parsing
var commandLine = e.Message + " ";
commandLine += " ";
// Look for the feed URL in the command line
var startPosition = commandLine.IndexOf("feed://", StringComparison.Ordinal);
// If we found one then we should extract and process it
if (startPosition > 0)
{
// Advance past the protocol
startPosition += 7;
// If nothing was found then exit
if (startPosition <= 0) return;
// Starting at the URL position look for the next space
var endPosition = commandLine.IndexOf(" ", startPosition, StringComparison.Ordinal);
// Advance past the protocol
startPosition += 7;
// Extract the feed URL
var feedUrl = commandLine.Substring(startPosition, endPosition - startPosition);
// Starting at the URL position look for the next space
var endPosition = commandLine.IndexOf(" ", startPosition, StringComparison.Ordinal);
// Add the HTTP protocol by default
feedUrl = "http://" + feedUrl;
// Extract the feed URL
var feedUrl = commandLine.Substring(startPosition, endPosition - startPosition);
// Create a new feed using the URL
HandleNewFeed(feedUrl);
}
// Add the HTTP protocol by default
feedUrl = "http://" + feedUrl;
// Create a new feed using the URL
HandleNewFeed(feedUrl);
}
}
}
}