EasyVoiceSettings.BuildFileNameFromTemplate C# (CSharp) Method

BuildFileNameFromTemplate() private method

Make a file name from the default file name template and the specified repalcement speaker name and entry index
private BuildFileNameFromTemplate ( string speakerName, int index ) : string
speakerName string
index int
return string
    private string BuildFileNameFromTemplate(string speakerName, int index)
    {
        string defaultFileName = GetDefaultFileName();

        // We want to replace ### with 003
        // (GetDefaultFileName always returns at least 1 #)

        int firstHashIndex = defaultFileName.IndexOf('#');
        int lastHashIndex = defaultFileName.LastIndexOf('#');

        return
            (defaultFileName.Substring(0, firstHashIndex) + index.ToString("D" + (lastHashIndex - firstHashIndex + 1)) + defaultFileName.Substring(lastHashIndex + 1))
            .Replace("$", speakerName);
    }