forked from fdorg/flashdevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBridgeManager.cs
More file actions
87 lines (76 loc) · 2.68 KB
/
Copy pathBridgeManager.cs
File metadata and controls
87 lines (76 loc) · 2.68 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Collections.Generic;
using System.Text;
using PluginCore.Bridge;
using PluginCore.Managers;
using System.IO;
namespace PluginCore.Bridge
{
public class BridgeManager
{
static private IBridgeSettings settings;
static private BridgeClient remoteClient;
#region Properties
/// <summary>
/// Enable delegation to host system
/// </summary>
static public bool Active
{
get { return settings != null ? settings.Active : false; }
}
/// <summary>
/// Bridge configuration is externalized in a plugin
/// </summary>
static public IBridgeSettings Settings
{
get { return settings; }
set { settings = value; }
}
#endregion
#region Tool functions
/// <summary>
/// Check if the provided file type should always be executed under Windows
/// </summary>
static public bool AlwaysOpenLocal(string path)
{
if (!Active) return true;
string ext = Path.GetExtension(path).ToLower();
foreach (string item in settings.AlwaysOpenLocal)
if (ext == item) return true;
return false;
}
/// <summary>
/// Open a shared document by the associated application of the host
/// </summary>
static public void RemoteOpen(string shared)
{
if (remoteClient == null || !remoteClient.Connected)
remoteClient = new BridgeClient();
if (remoteClient != null && remoteClient.Connected)
{
PluginBase.MainForm.StatusStrip.Items[0].Text = " Opening document in host system...";
remoteClient.Send("open:" + shared);
}
else TraceManager.AddAsync("Unable to connect to host bridge.");
}
/// <summary>
/// Open the console in the shared location on the host
/// </summary>
/*static public void RemoteConsole(string shared)
{
if (remoteClient == null || !remoteClient.Connected)
remoteClient = new BridgeClient();
if (remoteClient != null && remoteClient.Connected)
{
PluginBase.MainForm.StatusStrip.Items[0].Text = " Opening console in host system...";
remoteClient.Send("console:" + shared);
}
else TraceManager.AddAsync("Unable to connect to host bridge.");
}*/
#endregion
public static bool IsRemote(string path)
{
return Active && path != null && path.StartsWith(Settings.SharedDrive);
}
}
}