Skip to content

Commit

Permalink
Generalize branding and namespaces stuff for easier porting
Browse files Browse the repository at this point in the history
  • Loading branch information
XenHat committed Jan 17, 2018
1 parent 838093f commit 4682f05
Show file tree
Hide file tree
Showing 18 changed files with 467 additions and 296 deletions.
2 changes: 1 addition & 1 deletion AboutBox.Designer.cs

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

59 changes: 29 additions & 30 deletions AboutBox.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System;
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

using System;
using System.Reflection;
using System.Windows.Forms;

namespace TrayReader
namespace TrayApp
{
partial class AboutBox : Form
{
Expand All @@ -17,30 +20,29 @@ public AboutBox()
this.textBoxDescription.Text = AssemblyDescription;
}

#region Assembly Attribute Accessors

public string AssemblyTitle
public string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
return "";
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}

public string AssemblyVersion
public string AssemblyCopyright
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}

Expand Down Expand Up @@ -70,32 +72,29 @@ public string AssemblyProduct
}
}

public string AssemblyCopyright
public string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
return "";
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}

public string AssemblyCompany
public string AssemblyVersion
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}

#endregion Assembly Attribute Accessors
}
}
}
2 changes: 1 addition & 1 deletion AddFeed.Designer.cs

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

57 changes: 30 additions & 27 deletions AddFeed.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using System;
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

using System;
using System.Drawing;
using System.Windows.Forms;
using TrayReader.Properties;
using TrayApp.Properties;

namespace TrayReader
namespace TrayApp
{
public partial class AddFeed : Form
{
private string currentURLInput;
private bool can_add;
private string currentURLInput;

public AddFeed()
{
Expand All @@ -19,27 +22,6 @@ private void AddFeed_Load(object sender, EventArgs e)
{
}

private void textBox1_TextChanged(object sender, EventArgs e)
{
var text = textBox1.Text;
if (!text.Contains("http"))
{
text = "http://" + text;
}
can_add = Helper.ValidateURL(text);
if (can_add)
{
textBox1.BackColor = Color.Empty;
can_add = true;
}
else
{
textBox1.BackColor = Color.Red;
can_add = false;
}
currentURLInput = text;
}

private void FeedSubmitButton_Click(object sender, EventArgs e)
{
// Get value of field
Expand All @@ -54,7 +36,7 @@ private void FeedSubmitButton_Click(object sender, EventArgs e)
{
Settings.Default.SettingFeedList.Add(potential_url.TrimEnd('/'));
Settings.Default.Save();
TrayReader.ProcessIcon.ni.ContextMenuStrip = new ContextMenus().CreateFeedsMenu();
TrayApp.ProcessIcon.ni.ContextMenuStrip = new ContextMenus().CreateFeedsMenu();
this.Close();
}
}
Expand All @@ -63,5 +45,26 @@ private void FeedSubmitButton_Click(object sender, EventArgs e)
Program.ExceptionHandler(exception);
}
}

private void textBox1_TextChanged(object sender, EventArgs e)
{
var text = textBox1.Text;
if (!text.Contains("http"))
{
text = "http://" + text;
}
can_add = Helper.ValidateURL(text);
if (can_add)
{
textBox1.BackColor = Color.Empty;
can_add = true;
}
else
{
textBox1.BackColor = Color.Red;
can_add = false;
}
currentURLInput = text;
}
}
}
}
Loading

0 comments on commit 4682f05

Please sign in to comment.