ACAT.Extensions.Default.FunctionalAgents.NewFile.NewFileAgent.createFileAndLaunchApp C# (CSharp) Méthode

createFileAndLaunchApp() private méthode

Creates the indicated file and launches the app with the file so the user can start working on it
private createFileAndLaunchApp ( String fileName ) : bool
fileName String name of the file to create
Résultat bool
        private bool createFileAndLaunchApp(String fileName)
        {
            fileName = fileName.Trim();
            if (String.IsNullOrEmpty(fileName) ||
                File.Exists(fileName) ||
                fileName.IndexOfAny(Path.GetInvalidFileNameChars()) < 0)
            {
                return false;
            }

            String extension = Path.GetExtension(fileName);
            bool retVal = false;
            if (extension.ToLower().Contains("txt"))
            {
                retVal = createAndLaunchNotepad(fileName);
            }
            else if (extension.ToLower().Contains("docx"))
            {
                retVal = createAndLaunchWordDoc(fileName);
            }

            return retVal;
        }