/// <summary> /// 特定のフォルダ内のスクリプト情報を列挙します。 /// </summary> /// <param name="directoryPath">フォルダパス。</param> public void EnumerateClasses(string directoryPath) { var types = new List <AssemblyAndType>(); foreach (string dllFile in Directory.GetFiles(directoryPath, "*.dll")) { if (!includeDlls.Contains(Path.GetFileName(dllFile))) { continue; } foreach (AssemblyAndType asm in FlowSourceEnumerator.EnumerateFromFile(dllFile, new Type[0])) { } } }
public static void EnumerateClass(string filePath) { foreach (AssemblyAndType asmAndType in FlowSourceEnumerator.EnumerateFromFile(filePath, new Type[] { typeof(FlowSourceObjectBase), typeof(TypeColorBase), typeof(TypeAliasBase) })) { if (asmAndType.Type.IsSubclassOf(typeof(FlowSourceObjectBase))) { flowSources.Add(asmAndType); } else if (asmAndType.Type.IsSubclassOf(typeof(TypeColorBase))) { AddColorDefinition(asmAndType); } else if (asmAndType.Type.IsSubclassOf(typeof(TypeAliasBase))) { AddTypeAlias(asmAndType); } } }
static void Process(string dllPath, string projectPath) { var fileList = GetFileList(projectPath); var dict = GetClassInfo(fileList); foreach (AssemblyAndType asm in FlowSourceEnumerator.EnumerateFromFile(dllPath, new Type[] { typeof(FlowSourceObjectBase) })) { var temp = (FlowSourceObjectBase)asm.Assembly.CreateInstance(asm.Type.FullName); if (temp != null) { if (dict.TryGetValue(asm.Type.FullName, out ClassInfo classInfo)) { CheckSetProperties(dict, classInfo, temp); var autoFastContent = Generator.GetFastCode(temp); var path = Path.Combine(Path.GetDirectoryName(classInfo.FilePath), String.Format("{0}.AutoFast.cs", Path.GetFileNameWithoutExtension(classInfo.FilePath))); UpdateContent(autoFastContent, path); if (!classInfo.HasPartial) { string content; using (StreamReader sr = new StreamReader(classInfo.FilePath, Encoding.UTF8)) { content = sr.ReadToEnd(); } var classRegex = new Regex(String.Format("public +class +{0}", classInfo.ClassName)); var m = classRegex.Match(content); if (m.Success) { content = content.Substring(0, m.Groups[0].Index) + "public partial class " + classInfo.ClassName + content.Substring(m.Groups[0].Index + m.Groups[0].Length); UpdateContent(content, classInfo.FilePath); } } } } } HideAutoFastCs(projectPath); }
private static void EnumerateFile(string fileName) { foreach (var asmAndType in FlowSourceEnumerator.EnumerateFromFile(Path.Combine(ApplicationDir, fileName), new Type[] { typeof(FlowSourceObjectBase) })) { } }