Пример #1
0
		private static dynamic Compile(CodeActionDefinition codeActionDefinition)
		{
			object variable;
			if (!CodeActionsCompiller.CompillationEnable)
			{
				return new { Success = false, Message = "Code actions compillation disabled." };
			}
			codeActionDefinition = codeActionDefinition.Decode();
			try
			{
				List<CodeActionDefinition> codeActionDefinitions = new List<CodeActionDefinition>()
				{
					codeActionDefinition
				};
				Guid guid = Guid.NewGuid();
				CodeActionsCompiller.CompileCodeActions(codeActionDefinitions, string.Format("TestCompile_{0}", guid.ToString("N")));
				return new { Success = true };
			}
			catch (Exception exception1)
			{
				Exception exception = exception1;
				variable = new { Success = false, Message = exception.Message.Replace("\n", "<br/>") };
			}
			return variable;
		}
Пример #2
0
		public static CodeActionDefinition Create(string name, string usings, string actionCode, string isglobal, string type)
		{
			CodeActionDefinition codeActionDefinition = new CodeActionDefinition()
			{
				ActionCode = actionCode,
				Name = name,
				Usings = usings,
				Type = (string.IsNullOrEmpty(type) ? CodeActionType.Action : (CodeActionType)Enum.Parse(typeof(CodeActionType), type, true)),
				IsGlobal = (string.IsNullOrEmpty(isglobal) ? false : bool.Parse(isglobal))
			};
			return codeActionDefinition;
		}
Пример #3
0
		private static string GetMethodName(CodeActionDefinition codeActionDefinition)
		{
			return CodeActionsCompiller.GetMethodName(codeActionDefinition.Name, codeActionDefinition.Type);
		}