protected async Task WriteFileAsync(string path, string name, string extention, string content, bool creatDirectoryIfNotExist = false) { path = AuthorizeManager.AuthorizeActionOnPath(path.Replace("//", "/"), ActionKey.WriteToDisk); await FileSystemManager.WriteAsync( (creatDirectoryIfNotExist ? FileSystemManager.CreatDirectoryIfNotExist(path) : FileSystemManager.RelativeToAbsolutePath(path)) + name + extention, content); }
public void BackUp(string backUpName) { lock (Lock) { GetActionById(1); if (!ToggleLogInMemoryOnly()) { ToggleLogInMemoryOnly(); } _fileSystemManager.CopyFile(DbPath, _fileSystemManager.CreatDirectoryIfNotExist(Config.LogPath) + "ActionLog_" + backUpName + ".db"); _fileSystemManager.DeleteFile(DbPath); CreateDb(); if (ToggleLogInMemoryOnly()) { ToggleLogInMemoryOnly(); } } }
protected virtual KeyValue CreateSourceControlDataBase(string codePath) { var codePathSegment = codePath.Split('/'); var dbName = codePathSegment[codePathSegment.Length - 2]; // var dbName = codeName.Remove(codeName.IndexOf(".", StringComparison.Ordinal)); //var dbPath = ""; //for (var i = 0; i < codePathSegment.Length - 1; i++) // dbPath += codePathSegment[i] ; //AuthorizeManager.AuthorizePath(codePath, ActionKey.WriteToDisk); using (var db = new LiteDatabase((FileSystemManager.CreatDirectoryIfNotExist(codePath) + "/" + dbName + ".db").Replace("//", "/"))) { var logs = db.GetCollection <SourceControlChange>(dbName); logs.EnsureIndex(lg => lg.Name); logs.EnsureIndex(lg => lg.Comment); logs.EnsureIndex(lg => lg.Version); logs.EnsureIndex(lg => lg.LocalDateTime); } return(new KeyValue() { Key = dbName, Value = codePath }); }
protected async Task WriteFileAsync(string path, string name, string extention, string content, bool creatDirectoryIfNotExist = false) { path = path.Replace("//", "/"); await _fileSystemManager.WriteAsync( (creatDirectoryIfNotExist ? _fileSystemManager.CreatDirectoryIfNotExist(path) : _fileSystemManager.RelativeToAbsolutePath(path)) + name + extention, content); }
protected virtual void CreateDebugDataBase(string dbPath) { if (!FileSystemManager.FileExist((dbPath + "/" + DebugDb).Replace("//", "/"))) { using (var db = new LiteDatabase((FileSystemManager .CreatDirectoryIfNotExist(dbPath) + "/" + DebugDb).Replace("//", "/"))) { var debugDb = db.GetCollection <DebugInfo>(DebugCollection); debugDb.EnsureIndex(dg => dg.CodeId); //debugDb.EnsureIndex(dg => dg.Data); debugDb.EnsureIndex(dg => dg.IsOk); debugDb.EnsureIndex(dg => dg.IntegerValue); debugDb.EnsureIndex(dg => dg.DecimalValue); debugDb.EnsureIndex(dg => dg.DateTime); debugDb.EnsureIndex(dg => dg.CreateDateTime); debugDb.EnsureIndex(dg => dg.DllVersion); debugDb.EnsureIndex(dg => dg.IsAppDebugInfo); } } }
public bool CreateDirectory(string path) { _fileSystemManager.CreatDirectoryIfNotExist(AuthorizeManager.AuthorizeActionOnPath(path, ActionKey.WriteToDisk)); return(true); }