コード例 #1
0
ファイル: Designer.cs プロジェクト: kanpinar/WFCore
		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);
		}