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

Address static code analysis issues (disposing objects, neutral language and CLSCompliant attribute)

This commit is contained in:
chylex 2016-04-12 23:33:37 +02:00
parent 38539c4a9b
commit 39f554693d
6 changed files with 16 additions and 7 deletions

View File

@ -10,6 +10,8 @@ partial class FlatProgressBar {
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) { protected override void Dispose(bool disposing) {
brush.Dispose();
if (disposing && (components != null)) { if (disposing && (components != null)) {
components.Dispose(); components.Dispose();
} }

View File

@ -38,6 +38,8 @@ public FormBrowser(){
Controls.Add(browser); Controls.Add(browser);
Disposed += (sender, args) => browser.Dispose();
notification = new FormNotification(this,bridge,true); notification = new FormNotification(this,bridge,true);
notification.Show(); notification.Show();
} }

View File

@ -39,6 +39,8 @@ public FormNotification(Form owner, TweetDeckBridge bridge, bool autoHide){
} }
panelBrowser.Controls.Add(browser); panelBrowser.Controls.Add(browser);
Disposed += (sender, args) => browser.Dispose();
} }
public FormNotification(Form owner, bool autoHide) : this(owner,null,autoHide){} public FormNotification(Form owner, bool autoHide) : this(owner,null,autoHide){}

View File

@ -14,8 +14,11 @@ static class MigrationManager{
public static void Run(){ public static void Run(){
if (!Program.UserConfig.IgnoreMigration && Directory.Exists(TweetDeckPath)){ if (!Program.UserConfig.IgnoreMigration && Directory.Exists(TweetDeckPath)){
FormMigrationQuestion formQuestion = new FormMigrationQuestion(); MigrationDecision decision;
MigrationDecision decision = formQuestion.ShowDialog() == DialogResult.OK ? formQuestion.Decision : MigrationDecision.AskLater;
using(FormMigrationQuestion formQuestion = new FormMigrationQuestion()){
decision = formQuestion.ShowDialog() == DialogResult.OK ? formQuestion.Decision : MigrationDecision.AskLater;
}
switch(decision){ switch(decision){
case MigrationDecision.MigratePurge: case MigrationDecision.MigratePurge:

View File

@ -8,6 +8,7 @@
using TweetDick.Core; using TweetDick.Core;
using TweetDick.Migration; using TweetDick.Migration;
[assembly: CLSCompliant(true)]
namespace TweetDick{ namespace TweetDick{
static class Program{ static class Program{
#if DUCK #if DUCK
@ -19,7 +20,7 @@ static class Program{
#endif #endif
public static readonly string StoragePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),BrandName); public static readonly string StoragePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),BrandName);
private static readonly LockManager LockManager; private static readonly LockManager LockManager = new LockManager(Path.Combine(StoragePath,".lock"));
public static UserConfig UserConfig { get; private set; } public static UserConfig UserConfig { get; private set; }
@ -36,10 +37,6 @@ private static string HeaderAcceptLanguage{
} }
} }
static Program(){
LockManager = new LockManager(Path.Combine(StoragePath,".lock"));
}
[DllImport("kernel32.dll", CharSet = CharSet.Auto)] [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr LoadLibrary(string name); public static extern IntPtr LoadLibrary(string name);

View File

@ -1,6 +1,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using TweetDick; using TweetDick;
using System.Resources;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
@ -34,3 +35,5 @@
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.1.0")] [assembly: AssemblyVersion("0.9.1.0")]
[assembly: AssemblyFileVersion("0.9.1.0")] [assembly: AssemblyFileVersion("0.9.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]