public void AddFile(ActionToPerform action, ScannedFile fileInfo) { switch (action) { case ActionToPerform.FileFailedToDelete: objBaseScannedFile = FilesFailedToDelete.GetInstance(); break; case ActionToPerform.FileForNextIteration: objBaseScannedFile = FilesForNextIteration.GetInstance(); break; case ActionToPerform.FileDeleted: objBaseScannedFile = FilesDeleted.GetInstance(); break; } objBaseScannedFile.AddFile(fileInfo); objBaseScannedFile.DatabaseType = DatabaseType; objBaseScannedFile.SaveToCSVFile = SaveToCSVFile; objBaseScannedFile.SaveFile(); }
public ScannedFiles Get(ActionToPerform action) { FileSystemCleanup objBaseScannedFile = null; ScannedFiles files = null; switch (action) { case ActionToPerform.FileFailedToDelete: objBaseScannedFile = FilesFailedToDelete.GetInstance(); break; case ActionToPerform.FileForNextIteration: objBaseScannedFile = FilesForNextIteration.GetInstance(); break; case ActionToPerform.FileDeleted: objBaseScannedFile = FilesDeleted.GetInstance(); break; } objBaseScannedFile.DatabaseType = DatabaseType; objBaseScannedFile.SaveToCSVFile = SaveToCSVFile; files = objBaseScannedFile.GetFiles(); return(files); }
private void Form1_Load(object sender, EventArgs e) { txtRoamingDir.InvalidForegroundColor = Color.Red; txtRoamingDir.ValidForegroundColor = Color.Green; txtInstallDir.InvalidForegroundColor = Color.Red; txtInstallDir.ValidForegroundColor = Color.Green; using (var notepad = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Notepad++")) { if (notepad != null) { var notepadPath = (string)notepad.GetValue(""); txtInstallDir.Value = notepadPath; try { var versionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(notepadPath, "Notepad++.exe")); txtVersion.Text = String.Format("{0}.{1}.{2}.{3}", versionInfo.FileMajorPart, versionInfo.FileMinorPart, versionInfo.FileBuildPart, versionInfo.FilePrivatePart);; if (versionInfo.FileMajorPart >= 6 && versionInfo.FileMinorPart >= 6) { txtVersion.ForeColor = Color.Green; } else { txtVersion.ForeColor = Color.Goldenrod; } } catch (Exception) { txtVersion.Text = "Unknown"; txtVersion.ForeColor = Color.Red; } } else { txtInstallDir.Value = "Unknown"; } } try { roamingDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); roamingDir = Path.Combine(roamingDir, "Notepad++"); txtRoamingDir.Value = roamingDir; } catch (Exception) { txtRoamingDir.Value = "Unknown"; return; } notepadLanguageFileName = Path.Combine(roamingDir, "userDefineLang.xml"); if (!File.Exists(notepadLanguageFileName)) { installAction = ActionToPerform.CreateNewFile; } else { try { var config = XDocument.Load(notepadLanguageFileName); installAction = LanguageNotDefinedYet(config) ? ActionToPerform.CreateNewEntryInExistingFile : ActionToPerform.UpdateExistingEntryInExistingFile; if (LanguageNodes(config).Count() > 1) { installAction = ActionToPerform.TooManyDefinitions; } } catch (Exception) { installAction = ActionToPerform.InvalidConfigFile; } } switch (installAction) { case ActionToPerform.CreateNewEntryInExistingFile: txtInstallationAction.Text = "Create new definition in existing file"; txtInstallationAction.ForeColor = Color.Green; break; case ActionToPerform.CreateNewFile: txtInstallationAction.Text = "Create new file containing definition"; txtInstallationAction.ForeColor = Color.Green; break; case ActionToPerform.UpdateExistingEntryInExistingFile: txtInstallationAction.Text = "Update existing definition in existing file"; txtInstallationAction.ForeColor = Color.Green; break; case ActionToPerform.TooManyDefinitions: txtInstallationAction.Text = "Too many TaskJuggler definitions in existing file"; txtInstallationAction.ForeColor = Color.Red; btnInstall.Text = "Sorry, I don't know how to recover"; btnInstall.Enabled = false; break; case ActionToPerform.Unknown: txtInstallationAction.Text = "Unknown"; txtInstallationAction.ForeColor = Color.Red; btnInstall.Text = "Sorry, I don't know what to do"; btnInstall.Enabled = false; break; case ActionToPerform.InvalidConfigFile: txtInstallationAction.Text = "Invalid exitsing configuration file"; txtInstallationAction.ForeColor = Color.Red; btnInstall.Text = "Sorry, I don't know how to recover"; btnInstall.Enabled = false; break; } }
public void SetTargetAction(ActionToPerform action) { this.mTargetAction = action; }