Пример #1
0
        private static void GenerateVxml()
        {
            bool bFailure = false;


            // Generate VXML files regardless of whether the Dirty Bit is set in the database.

            VoiceScriptGen voiceXmlTemplateProcessor = new VoiceScriptGen();
            List <VoiceScriptGen.Result> results     = voiceXmlTemplateProcessor.GenerateVxmlsFromTemplates();

            foreach (VoiceScriptGen.Result result in results)
            {
                if (result.Success)
                {
                    Console.WriteLine(String.Format("SUCCESS: {0}", result.Message));
                }
                else
                {
                    bFailure = true;
                    Console.Error.WriteLine(String.Format("FAILURE: {0}", result.Message));
                }
            }


            // If all the files were generated successfully then clear the Dirty Bit in the database.

            if (!bFailure)
            {
                ConfigParams.SetVoicexmlDirty(false);
            }


            // If the files didn't exist prior to executing this command then they will have incorrect owner and permission.
            // This needs to be rectified so that generating the files from the web site can succeed.

            Console.WriteLine();
            Console.WriteLine("IMPORTANT: Ensure that the VXML files generated have appropriate owner and permissions set.");
            Console.WriteLine();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            int iExitCode = 0;

            try
            {
                List <string> nameFiles = GetNameFilesList();
                Users         users     = GetUsers();


                // Remove any files that are still in use from the list of files.

                foreach (Users.User user in users)
                {
                    string fileName = Path.Combine(FileSystemSupport.NameWaveFilePath, String.Format("{0}.wav", VoiceScriptGen.GetFilenameSafeName(user.GetFullName())));

                    if (nameFiles.Contains(fileName))
                    {
                        nameFiles.Remove(fileName);
                    }
                }


                // Any files left over in the list of files are not associated with any entry in the directory and should thus be deleted.

                foreach (string nameFile in nameFiles)
                {
                    File.Delete(nameFile);
                }
            }
            catch (Exception exc)
            {
                iExitCode = 1;
                Console.Error.WriteLine("{0} ERROR: CleanNamesFolder.Main: Caught exception: '{1}' ({2})", DateTime.Now, exc.Message, iExitCode);
            }

            System.Environment.Exit(iExitCode);
        }