/// <summary> /// 安装入口 /// </summary> /// <param name="parameter">安装参数</param> /// <returns>是否安装成功</returns> public bool Run(auto.parameter parameter) { if (parameter != null) { if (fastCSharp.config.setup.Default.FastCSharpPath == parameter.ProjectPath) { string[] codes = parameter.Types.getArray(type => new definition { Type = type, Auto = type.customAttribute <auto>() }) .getFind(type => type.Auto != null && type.Auto.IsSetup && type.Auto.isCSharper && type.Auto.DependType == typeof(cSharper)) .getArray(type => type.ToString()); if (!error.IsError) { string fileName = fastCSharp.config.setup.Default.FastCSharpPath + pub.fastCSharp + ".cSharper.cs"; if (WriteFile(fileName, WarningCode + string.Concat(codes))) { error.Add(fileName + " 被修改"); throw new Exception(); } return(true); } return(false); } return(true); } return(false); }
/// <summary> /// 输出代码 /// </summary> public static void Output(auto.parameter parameter) { string[] codeArray = codes.getArray(); codes.Clear(); codeTypes.Clear(); error.ThrowError(); string code = string.Concat(codeArray); if (code.length() != 0) { string fileName = parameter.ProjectPath + parameter.DefaultNamespace + "." + pub.fastCSharp + ".cs"; if (WriteFile(fileName, WarningCode + code)) { fastCSharp.log.Default.ThrowReal(fileName + " 被修改", false, false); } } }
/// <summary> /// 安装入口 /// </summary> /// <param name="parameter">安装参数</param> /// <returns>是否安装成功</returns> public bool Run(auto.parameter parameter) { if (parameter != null) { string path = parameter.ProjectPath + (parameter.ProjectPath == config.setup.Default.FastCSharpPath ? DefaultTemplatePath : config.setup.Default.SimpleTemplatePath).pathSuffix(); if (Directory.Exists(path)) { list <string>[] codes = Directory.GetFiles(path, "*.cs").getArray(name => code(name)); if (!codes.any(code => code == null)) { cSharp.coder.Add(string.Concat(codes.getArray(code => code.ToArray()).getArray())); return(true); } return(false); } return(true); } return(false); }