public DirectoryContext() { // TODO: Replace this with something far more durable _settings = new DirectorySettings { Directory = ConfigurationManager.AppSettings["Directory"], Container = ConfigurationManager.AppSettings["Container"], Username = ConfigurationManager.AppSettings["Username"], Password = ConfigurationManager.AppSettings["Password"] }; }
public bool?WriteDirectory(string directory, [FromBody] DirectorySettings settings) { // Prepare to update var update = VCRConfiguration.Current.BeginUpdate(SettingNames.VideoRecorderDirectory, SettingNames.AdditionalRecorderPaths, SettingNames.FileNamePattern); // Change settings update[SettingNames.AdditionalRecorderPaths].NewValue = string.Join(", ", settings.TargetDirectories.Skip(1)); update[SettingNames.VideoRecorderDirectory].NewValue = settings.TargetDirectories.FirstOrDefault(); update[SettingNames.FileNamePattern].NewValue = settings.RecordingPattern; // Process return(ServerRuntime.Update(update.Values)); }
public static void SaveDirectorySettings(DirectorySettings settings) { if (Optiondb.DirectorySettings.Count == 0) { Optiondb.DirectorySettings.AddDirectorySettingsRow(Optiondb.DirectorySettings.NewDirectorySettingsRow()); } DataSet_Config.DirectorySettingsRow row = Optiondb.DirectorySettings[0]; row.DefaultFolder = settings.DefaultFolder; row.DefaultFolderTag = settings.DefaultFolderTag; row.LastUsedFolder = settings.LastUsedFolder; row.LastUsedFolderTag = settings.LastUsedFolderTag; Save(); }
private async void btnUpload_Click(object sender, EventArgs e) { TreeNode node = treeViewNodes?.SelectedNode; NodeTag tag = node?.Tag as NodeTag; if (tag != null) { imgLoad.Visible = true; btnUploadSelectedFolder.Enabled = false; Controller controller = new Controller(); int? folderCount = node?.Nodes?.Count; bool isUploaded; //se foldercount > 0 utilizzo l'upload con il datetime if (!folderCount.HasValue || folderCount.Value == 0) { isUploaded = await controller.UploadEmail(EmailItem, tag.Id, folderCount); } else { isUploaded = await controller.UploadEmailDateTime(EmailItem, tag.Id, DateTime.Now); } if (isUploaded) { Option.Read(); DirectorySettings dirSettings = Option.GetDirectorySettings(); LastUsedFolder = node.FullPath; LastUsedFolderTag = tag.Id; dirSettings.LastUsedFolder = LastUsedFolder; dirSettings.LastUsedFolderTag = LastUsedFolderTag; Option.SaveDirectorySettings(dirSettings); MessageBox.Show(UserInterfaceStrings.FilesUploadedSuccessfully); this.Close(); } else { if (string.IsNullOrEmpty(controller.Error)) MessageBox.Show(UserInterfaceStrings.ErrorOnUpload); else MessageBox.Show(controller.Error); } } imgLoad.Visible = false; btnUploadSelectedFolder.Enabled = true; }
private void CreateMigrationTerminalWizard() { try { var baseDir = DirectorySettings.GetSolutionDirectory(); Console.WriteLine("Skipping in 3 seconds.... \nAdd new migration? (y/N)"); var input = NConsole.ReadKeyWithTimeoutAsString(); if (input == null || !input.ToLower().Equals("y")) { return; } string migrationName; do { Console.WriteLine("\nMigration or change name (camel case, no spaces input): "); migrationName = Console.ReadLine(); if (migrationName?.TrimEmptyToNull() == null || migrationName.Split(" ").Length > 1) { _restartWizard = true; Console.WriteLine( "Incorrect input, please enter the name in CamelCase format and try again...."); } else { _restartWizard = false; } } while (_restartWizard); _logger.LogInformation("Creating migration...."); var migrationTask = new Task(() => { Tercmd.DotnetBuilder.Create(baseDir.MigrationsPathFromRoot()) .AddMigration(migrationName, 5000); }); migrationTask.Start(); migrationTask.Wait(); } catch (Exception ex) { Console.WriteLine(ex); } }
private void btnSelectDefaultFolder_Click(object sender, EventArgs e) { Option.Read(); DirectorySettings dirSettings = Option.GetDirectorySettings(); string lastUsedFolderName = String.Empty; string lastUsedFolderTag = String.Empty; if (dirSettings != null) { if (!String.IsNullOrWhiteSpace(dirSettings.LastUsedFolder) && !String.IsNullOrWhiteSpace(dirSettings.LastUsedFolderTag)) { lastUsedFolderName = dirSettings.LastUsedFolder; lastUsedFolderTag = dirSettings.LastUsedFolderTag; } } TreeNode node = treeViewNodes?.SelectedNode; NodeTag tag = node?.Tag as NodeTag; if (tag != null && tag.IsFolder) { DefaultFolderName = node.FullPath; DefaultFolderTag = tag.Id; DirectorySettings settings = new DirectorySettings(); settings.DefaultFolder = DefaultFolderName; settings.DefaultFolderTag = DefaultFolderTag; if (!String.IsNullOrWhiteSpace(lastUsedFolderName) && !String.IsNullOrWhiteSpace(lastUsedFolderTag)) { settings.LastUsedFolder = lastUsedFolderName; settings.LastUsedFolderTag = lastUsedFolderTag; } Option.SaveDirectorySettings(settings); MessageBox.Show(UserInterfaceStrings.DefaultFolderChanged, UserInterfaceStrings.Settings, MessageBoxButtons.OK); } }
public CoffeeDA() { this.directory = new DirectorySettings(); }
private void ReloadSettings() { Option.Read(); DirectorySettings dirSettings = Option.GetDirectorySettings(); if (dirSettings != null) { if (!String.IsNullOrWhiteSpace(dirSettings.DefaultFolderTag) && !String.IsNullOrWhiteSpace(dirSettings.DefaultFolder)) { DefaultFolderName = dirSettings.DefaultFolder; DefaultFolderTag = dirSettings.DefaultFolderTag; } } LabelSettings labelSettings = Option.GetLabelSettings(); if (labelSettings != null) { if (labelSettings.LoginExampleInstanceUrl != null) { LabelLoginExampleInstanceUrl = labelSettings.LoginExampleInstanceUrl; } if (labelSettings.Title != null) { LabelTitle = labelSettings.Title; } } ActionSettings actionSettings = Option.GetActionSettings(); if (actionSettings != null) { chkDisableStandardSaveButton.Checked = actionSettings.DisableStandardSave; chkDisableDefaultSaveButton.Checked = actionSettings.DisableDefaultdSave; chkDisableLastUsedSaveButton.Checked = actionSettings.DisableLastSave; } ImageSettings imageSettings = Option.GetimageSettings(); if (imageSettings != null) { if (!String.IsNullOrWhiteSpace(imageSettings.Logo)) { System.Drawing.Image img = System.Drawing.Image.FromFile(imageSettings.Logo); if (img.Width > 570 || img.Height > 90) { pictureBoxLogo.SizeMode = PictureBoxSizeMode.StretchImage; } else { pictureBoxLogo.SizeMode = PictureBoxSizeMode.CenterImage; } pictureBoxLogo.ImageLocation = imageSettings.Logo; pictureBoxLogoConfig.ImageLocation = imageSettings.Logo; currentlogo = imageSettings.Logo; } else { pictureBoxLogo.Image = Properties.Resources.logoalfresco; pictureBoxLogo.SizeMode = PictureBoxSizeMode.CenterImage; pictureBoxLogoConfig.Image = Properties.Resources.logoalfresco; currentlogo = null; } if (!String.IsNullOrWhiteSpace(imageSettings.HeadImage)) { pictureBoxImageConfig.ImageLocation = imageSettings.HeadImage; currentImage = imageSettings.HeadImage; } else { pictureBoxImageConfig.Image = Properties.Resources.logoalfrescosmall; currentImage = null; } if (!String.IsNullOrWhiteSpace(imageSettings.Icon)) { pictureBoxIconConfig.ImageLocation = imageSettings.Icon; currentIcon = imageSettings.Icon; this.Icon = new Icon(currentIcon); } else { pictureBoxIconConfig.Image = Properties.Resources.alfresco; currentIcon = null; //this.Icon = new Icon("Resources/alfresco.ico"); } } }
public Task ExecuteAsync(CancellationToken cancellationToken = default) { CreateMigrationTerminalWizard(); Tercmd.GitBuilder.Create(DirectorySettings.GetSolutionDirectory()).AddAllFiles(); return(Task.CompletedTask); }
public DirectoryService(DirectorySettings settings) { _settings = settings; }
private void ReloadSettings() { Option.Read(); LabelSettings labelSettings = Option.GetLabelSettings(); if (labelSettings != null) { if (labelSettings.Title != null) { LabelTitle = labelSettings.Title; } } ActionSettings actionSettings = Option.GetActionSettings(); if (actionSettings != null) { btnUploadSelectedFolder.Visible = !actionSettings.DisableStandardSave; btnUploadDefaultFolder.Visible = !actionSettings.DisableDefaultdSave; btnUploadLastFolder.Visible = !actionSettings.DisableLastSave; pnltxtDefaultFolder.Visible = !actionSettings.DisableDefaultdSave; pnltxtLastFolder.Visible = !actionSettings.DisableLastSave; } DirectorySettings dirSettings = Option.GetDirectorySettings(); if (dirSettings != null) { DefaultFolderTag = dirSettings.DefaultFolderTag; DefaultFolderName = dirSettings.DefaultFolder; if (!String.IsNullOrWhiteSpace(DefaultFolderTag)) { btnUploadDefaultFolder.Enabled = true; } else { btnUploadDefaultFolder.Enabled = false; } LastUsedFolder = dirSettings.LastUsedFolder; LastUsedFolderTag = dirSettings.LastUsedFolderTag; if (!String.IsNullOrWhiteSpace(LastUsedFolderTag)) { btnUploadLastFolder.Enabled = true; } else { btnUploadLastFolder.Enabled = false; } } ImageSettings imageSettings = Option.GetimageSettings(); if (imageSettings != null) { if (!String.IsNullOrWhiteSpace(imageSettings.HeadImage)) { pictureBoxHeadImage.ImageLocation = imageSettings.HeadImage; } else { pictureBoxHeadImage.Image = Properties.Resources.logoalfrescosmall; } try { if (!String.IsNullOrWhiteSpace(imageSettings.Icon)) { this.Icon = new Icon(imageSettings.Icon); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); //added } } }
private async void UploadDefaultFolder(int tryCount = 0) { if (!String.IsNullOrWhiteSpace(DefaultFolderTag)) { imgLoad.Visible = true; btnUploadDefaultFolder.Enabled = false; Controller controller = new Controller(); bool isUploaded; if (tryCount == 0) { isUploaded = await controller.UploadEmail(EmailItem, DefaultFolderTag, null); } else if (tryCount == 1) { isUploaded = await controller.UploadEmailDateTime(EmailItem, DefaultFolderTag, DateTime.Now); } else { imgLoad.Visible = false; btnUploadDefaultFolder.Enabled = true; return; } if (isUploaded) { Option.Read(); DirectorySettings dirSettings = Option.GetDirectorySettings(); LastUsedFolder = DefaultFolderName; LastUsedFolderTag = DefaultFolderTag; dirSettings.LastUsedFolder = LastUsedFolder; dirSettings.LastUsedFolderTag = LastUsedFolderTag; Option.SaveDirectorySettings(dirSettings); MessageBox.Show(UserInterfaceStrings.FilesUploadedSuccessfully); this.Close(); } else { //se vado in errore, riprovo aggiungendo al nome del file la data e l'ora if (tryCount == 0) { UploadDefaultFolder(++tryCount); //if (!string.IsNullOrEmpty(controller.Error))/*&& controller.Error.StartsWith("Duplicate child name not allowed")*/ //{ // UploadDefaultFolder(++tryCount); //} } else if (tryCount > 0) { if (string.IsNullOrEmpty(controller.Error)) MessageBox.Show(UserInterfaceStrings.ErrorOnUpload); else MessageBox.Show(controller.Error); } } imgLoad.Visible = false; btnUploadDefaultFolder.Enabled = true; } }