1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-08-18 13:31:41 +02:00

Address code analysis issues and fix unused parameter in CombinedFileStream.WriteToFile

This commit is contained in:
2016-09-04 19:32:33 +02:00
parent f38b188046
commit b2cc5d50bd
8 changed files with 14 additions and 13 deletions

@@ -24,7 +24,6 @@
/// </summary> /// </summary>
private void InitializeComponent() { private void InitializeComponent() {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBrowser));
this.trayIcon = new TweetDck.Core.TrayIcon(); this.trayIcon = new TweetDck.Core.TrayIcon();
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.SuspendLayout(); this.SuspendLayout();

@@ -23,7 +23,6 @@
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() { private void InitializeComponent() {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormSettings));
this.btnClose = new System.Windows.Forms.Button(); this.btnClose = new System.Windows.Forms.Button();
this.labelTip = new System.Windows.Forms.Label(); this.labelTip = new System.Windows.Forms.Label();
this.tabPanel = new TweetDck.Core.Controls.TabPanel(); this.tabPanel = new TweetDck.Core.Controls.TabPanel();

@@ -89,8 +89,11 @@ namespace TweetDck.Core.Other.Settings.Export{
} }
public void WriteToFile(string path, bool createDirectory){ public void WriteToFile(string path, bool createDirectory){
// ReSharper disable once AssignNullToNotNullAttribute if (createDirectory){
Directory.CreateDirectory(Path.GetDirectoryName(path)); // ReSharper disable once AssignNullToNotNullAttribute
Directory.CreateDirectory(Path.GetDirectoryName(path));
}
File.WriteAllBytes(path, contents); File.WriteAllBytes(path, contents);
} }
} }

@@ -33,9 +33,9 @@ namespace TweetDck.Core.Other.Settings.Export{
continue; continue;
} }
else if (split.Length == 3){ else if (split.Length == 3){
if (split[2].Equals(".meta", StringComparison.InvariantCultureIgnoreCase) || if (split[2].Equals(".meta", StringComparison.OrdinalIgnoreCase) ||
split[2].Equals("browser.js", StringComparison.InvariantCultureIgnoreCase) || split[2].Equals("browser.js", StringComparison.OrdinalIgnoreCase) ||
split[2].Equals("notification.js", StringComparison.InvariantCultureIgnoreCase)){ split[2].Equals("notification.js", StringComparison.OrdinalIgnoreCase)){
continue; continue;
} }
} }

@@ -33,7 +33,7 @@ namespace TweetDck.Core.Utils{
value = matchValue.Substring(indexEquals+1).Trim('"'); value = matchValue.Substring(indexEquals+1).Trim('"');
} }
if (key != string.Empty){ if (key.Length != 0){
dictionary[key] = value; dictionary[key] = value;
++count; ++count;
} }

@@ -27,7 +27,7 @@ namespace TweetDck.Plugins.Controls{
this.labelName.ForeColor = Color.DarkRed; this.labelName.ForeColor = Color.DarkRed;
this.btnToggleState.Enabled = false; this.btnToggleState.Enabled = false;
} }
else if (labelDescription.Text == string.Empty){ else if (labelDescription.Text.Length == 0){
labelDescription.Visible = false; labelDescription.Visible = false;
} }
@@ -35,7 +35,7 @@ namespace TweetDck.Plugins.Controls{
} }
private void panelDescription_Resize(object sender, EventArgs e){ private void panelDescription_Resize(object sender, EventArgs e){
if (labelDescription.Text == string.Empty){ if (labelDescription.Text.Length == 0){
Height = MinimumSize.Height; Height = MinimumSize.Height;
} }
else{ else{

@@ -93,7 +93,7 @@ namespace TweetDck.Plugins{
if (environment != PluginEnvironment.None){ if (environment != PluginEnvironment.None){
plugin.Environments |= environment; plugin.Environments |= environment;
} }
else if (!file.StartsWith("user.")){ else if (!file.StartsWith("user.", StringComparison.OrdinalIgnoreCase)){
error = "Unknown script file: "+file+". All custom script files have to be in the following naming style: user."+file; error = "Unknown script file: "+file+". All custom script files have to be in the following naming style: user."+file;
return false; return false;
} }

@@ -85,7 +85,7 @@ namespace TweetDck.Plugins{
public void DeleteFile(int token, string path){ public void DeleteFile(int token, string path){
string fullPath = GetFullPathIfSafe(token, path); string fullPath = GetFullPathIfSafe(token, path);
if (fullPath == string.Empty){ if (fullPath.Length == 0){
throw new Exception("File path has to be relative to the plugin folder."); throw new Exception("File path has to be relative to the plugin folder.");
} }
@@ -96,7 +96,7 @@ namespace TweetDck.Plugins{
public bool CheckFileExists(int token, string path){ public bool CheckFileExists(int token, string path){
string fullPath = GetFullPathIfSafe(token, path); string fullPath = GetFullPathIfSafe(token, path);
if (fullPath == string.Empty){ if (fullPath.Length == 0){
throw new Exception("File path has to be relative to the plugin folder."); throw new Exception("File path has to be relative to the plugin folder.");
} }