public (FileUploadConfig, string, string) GenerateConvertDirs(string datastoreName, string savedFileName, string scenario) { FileUploadConfig uploadConfig = this.dataLoader.GetUploadConfig(); PersistanceType persistanceType = this.dataLoader.GetPersistanceType(); FilePathConfig filePathConfig = this.dataLoader.GetFilePathConfig(); string excelDir = uploadConfig.ExcelDir; string pythonArgs = "--configPath \"" + uploadConfig.ColorConfigPath + "\" "; pythonArgs += " --srcPaths "; pythonArgs += "\"" + excelDir + Path.DirectorySeparatorChar + savedFileName + "\" "; pythonArgs += " --scenarios "; pythonArgs += "\"" + scenario + "\" "; string targetDir = null; if (persistanceType == PersistanceType.File && filePathConfig != null) { targetDir = filePathConfig.RootPath + Path.DirectorySeparatorChar + datastoreName; } else { targetDir = excelDir + Path.DirectorySeparatorChar + DateTime.Now.ToString("MMddyyyyHHmmss"); } pythonArgs += " --destPath \"" + targetDir + "\" "; return(uploadConfig, pythonArgs, targetDir); }
public static bool SetCredentials( string target, string username, string password, PersistanceType persistenceType) { return(new Credential { Target = target, Username = username, Password = password, PersistanceType = persistenceType }.Save()); }
/** * */ public void SetCredential(string password, PersistanceType persistanceType) { _credential.Username = _credential.Target; _credential.Password = password; _credential.PersistanceType = persistanceType; _credential.Save(); }
public Credential(string username, string password, string target, CredentialType type) { Username = username; Password = password; Target = target; Type = type; PersistanceType = PersistanceType.Session; _lastWriteTime = DateTime.MinValue; }
public static bool SetCredentials( string target, string username, string password, PersistanceType persistenceType = PersistanceType.Enterprise) { return(new Credential { Target = target, Username = username, Password = password, PersistanceType = persistenceType, Type = CredentialType.Generic }.Save()); }
internal void LoadInternal(NativeMethods.CREDENTIAL credential) { Username = credential.UserName; if (credential.CredentialBlobSize > 0) { Password = Marshal.PtrToStringUni(credential.CredentialBlob, credential.CredentialBlobSize / 2); } Target = credential.TargetName; Type = (CredentialType)credential.Type; PersistanceType = (PersistanceType)credential.Persist; Description = credential.Comment; LastWriteTimeUtc = DateTime.FromFileTimeUtc(credential.LastWritten); }
internal CredentialOutput( CredentialType credentialType, string targetName, string comment, DateTime lastWriteTimeUtc, string password, PersistanceType persistanceType, string userName) { CredentialType = credentialType; TargetName = targetName; Comment = comment; LastWriteTimeUtc = lastWriteTimeUtc; Password = password; PersistanceType = persistanceType; UserName = userName; }
protected override void Execute(NativeActivityContext context) { try { string userName = UserName.Get(context); string password = Password.Get(context); string applicationName = ApplicationName.Get(context); bool result = false; PersistanceType pt = new PersistanceType(); if (PersistType == "LocalComputer") { pt = PersistanceType.LocalComputer; } else if (PersistType == "Enterprise") { pt = PersistanceType.Enterprise; } else if (PersistType == "Session") { pt = PersistanceType.Session; } result = new Credential { Target = applicationName, Username = userName, Password = password, PersistanceType = pt, Type = CredentialType.Generic }.Save(); Result.Set(context, result); } catch (Exception ex) { Result.Set(context, false); Log.Logger.LogData(ex.Message + " in activity CellValue_Clear", LogLevel.Error); if (!ContinueOnError) { context.Abort(); } } }
public DataLoader(IConfiguration config) { this.log = Log.Logger.ForContext <DataLoader>(); uploadConfig = config.GetSection("FileUploadConfig").Get <FileUploadConfig>(); persistanceType = (PersistanceType)Enum.Parse(typeof(PersistanceType), config.GetSection("PersistanceType").Value, true); if (persistanceType == PersistanceType.File) { this.filePathConfig = config.GetSection("FileDataPath").Get <FilePathConfig>(); this.dataAccessor = new FileDataAccessor(filePathConfig.RootPath); } else { string connectionString = config.GetConnectionString("MongoDbConnection"); string mgmtDBName = config.GetConnectionString("DataStoreMgmtDatabaseName"); this.dataAccessor = new MongoDataAccessor(connectionString, mgmtDBName); } }
public CredentialInput( int flags, CredentialType credentialType, string targetName, string comment, string password, PersistanceType persistanceType, string userName) { if (string.IsNullOrEmpty(userName)) { throw new ArgumentException($"{userName} is null or empty"); } Flags = flags; CredentialType = credentialType; TargetName = targetName; Comment = comment; Password = password; PersistanceType = persistanceType; UserName = userName; }
public (string, string) GetTargetDirPath(string datastoreName) { FileUploadConfig uploadConfig = this.dataLoader.GetUploadConfig(); PersistanceType persistanceType = this.dataLoader.GetPersistanceType(); FilePathConfig filePathConfig = this.dataLoader.GetFilePathConfig(); string configPath = uploadConfig.ColorConfigPath; string targetDir = null; if (persistanceType == PersistanceType.File && filePathConfig != null) { targetDir = filePathConfig.RootPath + Path.DirectorySeparatorChar + datastoreName; } else { string excelDir = uploadConfig.ExcelDir; targetDir = excelDir + Path.DirectorySeparatorChar + DateTime.Now.ToString("MMddyyyyHHmmss"); } return(configPath, targetDir); }
public static NetworkCredential GetCredential(string target, PersistanceType persistanceType) { var cm = new Credential { Target = target, PersistanceType = persistanceType }; if (!cm.Load()) { return(null); } var networkCredential = new NetworkCredential(cm.Username, cm.Password); var userNameParts = networkCredential.UserName.Split('\\'); if (userNameParts.Length > 1) { networkCredential.Domain = userNameParts[0]; networkCredential.UserName = userNameParts[1]; } return(networkCredential); }
public static DataLoader initInstance(IConfiguration config) { if (uniqueInstance == null) { uniqueInstance = new DataLoader(); persistanceType = (PersistanceType)Enum.Parse(typeof(PersistanceType), config.GetSection("PersistanceType").Value, true); if (persistanceType == PersistanceType.File) { filePathConfig = config.GetSection("FileDataPath").Get <FilePathConfig>(); uniqueInstance.dataAccessor = new FileDataAccessor(filePathConfig.RootPath); } else { string connectionString = config.GetConnectionString("MongoDbConnection"); string mgmtDBName = config.GetConnectionString("DataStoreMgmtDatabaseName"); uniqueInstance.dataAccessor = new MongoDataAccessor(connectionString, mgmtDBName); } } return(uniqueInstance); }
internal void LoadInternal(NativeMethods.CREDENTIAL credential) { Username = credential.UserName; if (credential.CredentialBlobSize > 0) { Password = Marshal.PtrToStringUni(credential.CredentialBlob, credential.CredentialBlobSize / 2); } Target = credential.TargetName; Type = (CredentialType)credential.Type; PersistanceType = (PersistanceType)credential.Persist; Description = credential.Comment; LastWriteTimeUtc = DateTime.FromFileTimeUtc(credential.LastWritten); }
public AddCredential() { CredentialType = CredentialType.Generic; PersistanceType = PersistanceType.Enterprise; }
public WincredCredentialsAdapter() { credentialType = CredentialType.Generic; persistanceType = PersistanceType.LocalComputer; }