1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-05 20:34:07 +02:00

Address code analysis issues

This commit is contained in:
chylex 2016-05-28 22:34:40 +02:00
parent 5eb64829a5
commit 973e0c489e
7 changed files with 21 additions and 40 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
@ -192,7 +193,7 @@ public override Type BindToType(string assemblyName, string typeName){
#endif
typeName = typeName.Replace("TweetDick","TweetDck");
return Type.GetType(string.Format("{0}, {1}",typeName,assemblyName));
return Type.GetType(string.Format(CultureInfo.CurrentCulture,"{0}, {1}",typeName,assemblyName));
}
}
}

View File

@ -1,33 +1,3 @@
namespace TweetDck.Core.Controls {
partial class FlatProgressBar {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (brush != null)brush.Dispose();
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
components = new System.ComponentModel.Container();
}
#endregion
}
namespace TweetDck.Core.Controls{
partial class FlatProgressBar{}
}

View File

@ -23,5 +23,11 @@ protected override void OnPaint(PaintEventArgs e){
rect.Width = (int)(rect.Width*((double)Value/Maximum));
e.Graphics.FillRectangle(brush,rect);
}
protected override void Dispose(bool disposing){
if (brush != null)brush.Dispose();
base.Dispose(disposing);
}
}
}

View File

@ -1,4 +1,5 @@
using CefSharp;
using System;
using System.IO;
using System.Windows.Forms;
using TweetDck.Core.Utils;
@ -12,7 +13,7 @@ abstract class ContextMenuBase : IContextMenuHandler{
private const int MenuCopyImageUrl = 26504;
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#")){
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#",StringComparison.Ordinal)){
model.AddItem((CefMenuCommand)MenuOpenUrlInBrowser,"Open in browser");
model.AddItem((CefMenuCommand)MenuCopyUrl,"Copy link address");
model.AddSeparator();
@ -77,7 +78,7 @@ public virtual bool RunContextMenu(IWebBrowser browserControl, IBrowser browser,
return false;
}
protected void RemoveSeparatorIfLast(IMenuModel model){
protected static void RemoveSeparatorIfLast(IMenuModel model){
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
model.RemoveAt(model.Count-1);
}

View File

@ -257,7 +257,7 @@
}
}
else if (e.type === "mousemove"){
if (tooltipDisplayed && (prevMouseX != e.clientX || prevMouseY != e.clientY)){
if (tooltipDisplayed && (prevMouseX !== e.clientX || prevMouseY !== e.clientY)){
$TD.displayTooltip(me.attr("data-full-url"),false);
prevMouseX = e.clientX;
prevMouseY = e.clientY;
@ -319,7 +319,7 @@
var lastTweet = "";
var updateHighlightedTweet = function(link, embeddedLink){
if (lastTweet != link){
if (lastTweet !== link){
$TD.setLastHighlightedTweet(link,embeddedLink);
lastTweet = link;
}

View File

@ -88,7 +88,7 @@
});
addEventListener(links,"mousemove",function(e){
if (tooltipDisplayed && (prevMouseX != e.clientX || prevMouseY != e.clientY)){
if (tooltipDisplayed && (prevMouseX !== e.clientX || prevMouseY !== e.clientY)){
var url = e.currentTarget.getAttribute("data-full-url");
if (!url)return;

View File

@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Net;
using System.Windows.Forms;
@ -8,6 +9,8 @@
namespace TweetDck.Updates{
sealed partial class FormUpdateDownload : Form{
private const double BytesToMB = 1024.0*1024.0;
public string InstallerPath{
get{
return Path.Combine(Path.GetTempPath(),updateInfo.FileName);
@ -66,7 +69,7 @@ private void webClient_DownloadProgressChanged(object sender, DownloadProgressCh
progressDownload.SetValueInstant(1000);
}
labelStatus.Text = (e.BytesReceived/(1024.0*1024.0)).ToString("0.0")+" MB";
labelStatus.Text = (e.BytesReceived/BytesToMB).ToString("0.0",CultureInfo.CurrentCulture)+" MB";
}
else{
if (progressDownload.Style != ProgressBarStyle.Continuous){
@ -74,7 +77,7 @@ private void webClient_DownloadProgressChanged(object sender, DownloadProgressCh
}
progressDownload.SetValueInstant(e.ProgressPercentage*10);
labelStatus.Text = (e.BytesReceived/(1024.0*1024.0)).ToString("0.0")+" / "+(e.TotalBytesToReceive/(1024.0*1024.0)).ToString("0.0")+" MB";
labelStatus.Text = (e.BytesReceived/BytesToMB).ToString("0.0",CultureInfo.CurrentCulture)+" / "+(e.TotalBytesToReceive/BytesToMB).ToString("0.0",CultureInfo.CurrentCulture)+" MB";
}
});
}