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

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

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

View File

@ -24,7 +24,6 @@ protected override void Dispose(bool disposing) {
/// </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();

View File

@ -23,7 +23,6 @@ protected override void Dispose(bool disposing) {
/// 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();

View File

@ -89,8 +89,11 @@ public void WriteToFile(string path){
} }
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);
} }
} }

View File

@ -33,9 +33,9 @@ public bool Export(bool includeSession){
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;
} }
} }

View File

@ -33,7 +33,7 @@ public static int AddToDictionary(string args, IDictionary<string, string> dicti
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;
} }

View File

@ -27,7 +27,7 @@ public PluginControl(PluginManager pluginManager, Plugin plugin) : this(){
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 @@ public PluginControl(PluginManager pluginManager, Plugin plugin) : this(){
} }
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{

View File

@ -93,7 +93,7 @@ private static bool LoadEnvironments(string path, Plugin plugin, out string erro
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;
} }

View File

@ -85,7 +85,7 @@ public string ReadFile(int token, string path, bool cache){
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 @@ public void DeleteFile(int token, string path){
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.");
} }