logic: vs plugin upgrade

Updated documentation and removed obsolete plugin ui
This commit is contained in:
Manuel Dobusch
2016-11-29 14:06:02 +01:00
parent e1968eaaac
commit d24e5b5bbd
13 changed files with 279 additions and 11 deletions
Binary file not shown.
@@ -66,6 +66,7 @@
</Button>
-->
<!--
<Button guid="guidCoatiPluginCmdSet" id="cmdidCoatiCreateProject" priority="0x0100" type="Button">
<Parent guid="guidCoatiPluginCmdSet" id="SubMenu" />
<Icon guid="icon" id="icon0" />
@@ -73,12 +74,13 @@
<ButtonText>Create Coati Project</ButtonText>
</Strings>
</Button>
-->
<Button guid="guidCoatiPluginCmdSet" id="cmdidCoatiCreateCDB" priority="0x0100" type="Button">
<Parent guid="guidCoatiPluginCmdSet" id="SubMenu" />
<Icon guid="icon" id="icon0" />
<Strings>
<ButtonText>Create CDB (Beta)</ButtonText>
<ButtonText>Create CDB</ButtonText>
</Strings>
</Button>
@@ -198,6 +198,8 @@ namespace CoatiSoftware.CoatiPlugin
_solutionEvents.Opened += OnSolutionOpened;
_solutionEvents.AfterClosing += OnSolutionClosed;
SendPing();
Logging.Logging.LogInfo("Initialization done");
}
@@ -287,6 +289,13 @@ namespace CoatiSoftware.CoatiPlugin
Logging.Logging.LogInfo("Logging initialized");
}
private void SendPing()
{
string message = Utility.NetworkProtocolUtility.CreatePingMessage();
Utility.AsynchronousClient.Send(message);
}
private void OnCreateProject(List<EnvDTE.Project> projects, string configurationName, string platformName, string targetDir, string fileName, string cStandard)
{
Wizard.WindowCreateCDB createCDB = new Wizard.WindowCreateCDB();
@@ -461,6 +470,10 @@ namespace CoatiSoftware.CoatiPlugin
CreateCompilationDatabase(dte);
}
}
else if(messageType == Utility.NetworkProtocolUtility.MESSAGE_TYPE.PING)
{
SendPing();
}
}
private void OnNetworkErrorCallback(string message)
@@ -13,17 +13,20 @@ namespace CoatiSoftware.CoatiPlugin.Utility
private static string s_moveCursorPrefix = "moveCursor";
private static string s_endOfMessageToken = "<EOM>";
private static string s_createProjectPrefix = "createProject";
private static string s_createProjectPrefix = "createProject"; // deprecate
private static string s_createCDBProjectPrefix = "createCDBProject";
private static string s_ideId = "vs";
private static string s_createCDB = "createCDB";
private static string s_createCDBPrefix = "createCDB";
private static string s_pingPrefix = "ping";
public enum MESSAGE_TYPE
{
UNKNOWN = 0,
MOVE_CURSOR,
CREATE_CDB
CREATE_CDB,
PING
}
public class CursorPosition
@@ -58,6 +61,24 @@ namespace CoatiSoftware.CoatiPlugin.Utility
}
}
public class Ping
{
private string _id = "";
private bool _valid = false;
public string Id
{
get { return _id; }
set { _id = value; }
}
public bool Valid
{
get { return _valid; }
set { _valid = value; }
}
}
public static string CreateActivateTokenMessage(string filePath, int lineNumber, int columnNumber)
{
string message = s_setActiveTokenPrefix;
@@ -120,20 +141,37 @@ namespace CoatiSoftware.CoatiPlugin.Utility
return message;
}
public static string CreatePingMessage()
{
string message = s_pingPrefix;
message += s_divider;
message += s_ideId;
message += s_endOfMessageToken;
return message;
}
public static MESSAGE_TYPE GetMessageType(string message)
{
List<string> tokens = GetMessageTokens(message);
if (tokens.Count > 0)
{
if(tokens[0] == s_createCDB)
if (tokens[0] == s_createCDBPrefix)
{
return MESSAGE_TYPE.CREATE_CDB;
}
else if(tokens[0] == s_moveCursorPrefix)
else if (tokens[0] == s_moveCursorPrefix)
{
return MESSAGE_TYPE.MOVE_CURSOR;
}
else if (tokens[0] == s_pingPrefix)
{
return MESSAGE_TYPE.PING;
}
else
{
return MESSAGE_TYPE.UNKNOWN;
@@ -193,6 +231,32 @@ namespace CoatiSoftware.CoatiPlugin.Utility
return result;
}
public static Ping ParsePingMessage(string message)
{
Ping result = new Ping();
List<string> tokens = GetMessageTokens(message);
if(tokens.Count != 2)
{
Logging.Logging.LogError("Invalid message: " + message);
Logging.Logging.LogError("Invalid token count for 'ping' message. Expected 2, but got " + tokens.Count.ToString());
return result;
}
if (tokens[0] != s_pingPrefix)
{
Logging.Logging.LogError("Invalid message: " + message);
Logging.Logging.LogError("Invalid message type. Expected '" + s_pingPrefix + "' but got '" + tokens[0] + "'");
return result;
}
result.Id = tokens[1];
result.Valid = true;
return result;
}
private static List<string> GetMessageTokens(string message)
{
List<string> tokens = new List<string>();
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="acf15780-03b5-440e-a41e-db79b7043fc2" Version="0.8.25" Language="en-US" Publisher="Coati Software OG" />
<Identity Id="acf15780-03b5-440e-a41e-db79b7043fc2" Version="0.8.28" Language="en-US" Publisher="Coati Software OG" />
<DisplayName>CoatiPlugin</DisplayName>
<Description xml:space="preserve">This package allows Coati to communicate with Visual Studio and vice versa.</Description>
<MoreInfo>https://www.coati.io/</MoreInfo>