Skip to content

Commit

Permalink
Merge pull request #2 from mikeMoreno/feature/refactor
Browse files Browse the repository at this point in the history
Feature/refactor
  • Loading branch information
mikeMoreno authored Feb 12, 2022
2 parents 908db17 + db39e56 commit 99be308
Show file tree
Hide file tree
Showing 27 changed files with 1,849 additions and 219 deletions.
9 changes: 0 additions & 9 deletions Waffle.Lib/LinkLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,5 @@ public override string GetLink()
{
return Raw;
}

public string GetUserFriendlyName()
{
var absoluteUrl = Raw;
absoluteUrl = absoluteUrl.Replace("gopher://", "");
absoluteUrl = absoluteUrl.TrimEnd('/');

return absoluteUrl;
}
}
}
38 changes: 24 additions & 14 deletions Waffle.Lib/SelectorLine.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -8,18 +10,23 @@ namespace Waffle.Lib
{
public record SelectorLine
{
public string Raw { get; protected set; }
public string Raw { get; set; }

public string DisplayString { get; protected set; }
public string DisplayString { get; set; }

[JsonConverter(typeof(StringEnumConverter))]
public ItemType ItemType { get; set; }

public string Selector { get; protected set; }
public string Selector { get; set; }

public string HostName { get; protected set; }
public string HostName { get; set; }

public int Port { get; protected set; }
public int Port { get; set; }

public SelectorLine()
{

}

public SelectorLine(string line)
{
Expand All @@ -46,17 +53,20 @@ public SelectorLine(string line)
}
}

public string GetUserFriendlyName()
{
var absoluteUrl = GetLink();
absoluteUrl = absoluteUrl.Replace("gopher://", "");
absoluteUrl = absoluteUrl.TrimEnd('/');

return absoluteUrl;
}

public virtual string GetLink()
{
if (ItemType != ItemType.Text &&
ItemType != ItemType.Menu &&
ItemType != ItemType.Search &&
ItemType != ItemType.PNG &&
ItemType != ItemType.Image &&
ItemType != ItemType.BinaryFile
)
if(string.IsNullOrWhiteSpace(HostName) && string.IsNullOrWhiteSpace(Selector))
{
return null;
return Raw;
}

return $"gopher://{HostName}{Selector}";
Expand Down
1 change: 1 addition & 0 deletions Waffle.Lib/Waffle.Lib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>

Expand Down
105 changes: 105 additions & 0 deletions Waffle/AboutForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions Waffle/AboutForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Waffle
{
public partial class AboutForm : Form
{
public AboutForm()
{
InitializeComponent();
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
var process = new ProcessStartInfo
{
FileName = "https://github.com/mikeMoreno/waffle",
UseShellExecute = true
};

Process.Start(process);
}
}
}
Loading

0 comments on commit 99be308

Please sign in to comment.