public FrmDetails(SqlAdoExecutor.SqlHelper sqlHelper, ScriptFiles files, string rootPath, string storePath, IWatch watch, Stack <string> newDirs, IDictionary <ScriptType, List <string> > newObjs) : this() { this.sqlHelper = sqlHelper; this.files = files; this.rootPath = rootPath; this.needStore = !string.IsNullOrEmpty(storePath); this.storePath = storePath; this.watch = watch; this.newDirs = newDirs; this.newObjs = newObjs; this.SetDetails(); }
public void Init(PatchContext context, IWatch watch) { this.Watch = watch; this.needStore = context.IsNeedStore; this.files = context.Files; this.scriptPath = context.Path; this.connectionString = context.ConnectionString; this.isShowDetails = context.ShowDetails; this.CanRun = InternalInit();; this.CanRollback = this.CanRun; this.CommandStatus = CommandStatus.Inited; }
public static ScriptFiles GetFiles(string dir) { if (string.IsNullOrEmpty(dir)) { return(null); } var scriptPath = Path.Combine(Environment.CurrentDirectory, dir); var pathDir = new DirectoryInfo(scriptPath); if (!pathDir.Exists) { return(null); } var result = new ScriptFiles(); var subFolders = pathDir.GetDirectories("*", SearchOption.TopDirectoryOnly); foreach (var subFolder in subFolders) { var groupName = subFolder.Name; var type = ScriptType.Other; foreach (var key in keywords.Keys) { if (groupName.EndsWith("." + key, StringComparison.OrdinalIgnoreCase)) { type = key; } } var scripts = subFolder.GetFiles("*.sql", SearchOption.TopDirectoryOnly); if (scripts.Length > 0) { foreach (var fileInfo in scripts) { var scf = new ScriptFile() { Group = groupName, File = fileInfo.FullName, Type = type, Status = ScriptStatus.UnRun }; result.Add(scf); } } } return(result); }
public override void Init() { if (initArgs != null && initArgs.Any()) { files = GetFiles(initArgs[0]); this.scriptPath = initArgs[0]; var cfg = initArgs.FirstOrDefault(x => x.StartsWith("showdetails:")); if (cfg != null) { cfg = cfg.Replace("showdetails:", "").Trim(); isShowDetails = cfg.Equals("1") || cfg.Equals("true", StringComparison.OrdinalIgnoreCase); } } else { files = null; } this.CanRun = InternalInit(); this.CanRollback = this.CanRun; this.CommandStatus = CommandStatus.Inited; }