blob: 41e0093f0cb7bb4a5f5a7f6ed62d254749cd8cd2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
using System;
using System.Diagnostics;
using System.IO;
using RedGate.SIPFrameworkShared;
namespace ExpressProfiler.Ecosystem
{
class ExpressProfiler : ISsmsAddin4
{
public string Version { get { return "2.0"; } }
public string Description { get { return "Ecosystem integration for ExpressProfiler"; } }
public string Name { get { return "ExpressProfiler"; } }
public string Author { get { return "ExpressProfiler"; } }
public string Url { get { return "https://expressprofiler.codeplex.com/"; } }
internal static ISsmsFunctionalityProvider6 m_Provider;
public void OnLoad(ISsmsExtendedFunctionalityProvider provider)
{
m_Provider = (ISsmsFunctionalityProvider6)provider;
m_Provider.AddToolbarItem(new ExecuteExpressProfiler());
var command = new ExecuteExpressProfiler();
m_Provider.AddToolsMenuItem(command);
}
public void OnNodeChanged(ObjectExplorerNodeDescriptorBase node)
{
}
public void OnShutdown(){}
}
public class ExecuteExpressProfiler : ISharedCommand
{
public void Execute()
{
string param ="";
IConnectionInfo2 con;
if(ExpressProfiler.m_Provider.ObjectExplorerWatcher.TryGetSelectedConnection(out con))
{
string server = con.Server;
string user = con.UserName;
string password = con.Password;
bool trusted = con.IsUsingIntegratedSecurity;
param = trusted ? String.Format("-server \"{0}\"",server) : String.Format("-server \"{0}\" -user \"{1}\" -password \"{2}\"", server,user,password);
}
string root = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
string profiler = Path.Combine(root, "ExpressProfiler\\ExpressProfiler.exe");
Process.Start(profiler, param);
}
private readonly ICommandImage m_CommandImage = new CommandImageForEmbeddedResources(typeof(ExecuteExpressProfiler).Assembly, "ExpressProfiler.Ecosystem.Resources.Icon.png");
public string Name {get { return "ExpressProfilerExecute"; }}
public string Caption { get { return "ExpressProfiler"; } }
public string Tooltip { get { return "Execute ExpressProfiler"; } }
public ICommandImage Icon { get { return m_CommandImage; } }
public string[] DefaultBindings { get { return new string[] { }; } }
public bool Visible { get { return true; } }
public bool Enabled { get { return true; } }
}
}
|