' Quick Command Creator Inline-Function for VoiceAttack - Check Edited Command for Existing Phrases already in use ' by SemlerPDX Jun2020 ' VETERANS-GAMING.COM Imports Microsoft.VisualBasic Imports System Imports System.Collections Imports System.Collections.Generic Imports System.Data Imports System.Drawing Imports System.Diagnostics Imports System.Windows.Forms Imports System.Linq Imports System.Xml.Linq Imports System.Threading.Tasks Public Class VAInline dim saveFile as string = "" dim phrase as string dim phrases as string dim commands as string = "" dim phraseArray() as string dim errorCount as integer = 0 dim errorsFinal as new list(of string) () dim phrasesLast as new list(of string) () dim phrasesUnique as new list(of string) () Public Sub Main() if (VA.GetText("~save_file") IsNot nothing) saveFile = VA.GetText("~save_file") end if if (VA.GetText("~avcs_qcc_phrase_last") IsNot nothing) phrases = (VA.GetText("~avcs_qcc_phrase_last")) phraseArray = vaProxy.Utility.ExtractPhrases(phrases, true, true) for each phrase in phraseArray if ((not(phrase = "")) and (not(phrasesLast.Contains(phrase)))) phrasesLast.Add(phrase) end if next end if phrases = nothing phraseArray = nothing if (VA.GetText("AVCS_QCC_COMMANDS") IsNot nothing) commands = VA.GetText("AVCS_QCC_COMMANDS") end if if (VA.GetText("AVCS_QCC_MACROS") IsNot nothing) commands = VA.GetText("AVCS_QCC_MACROS") + ";" + commands end if if (VA.GetText("AVCS_QCC_LISTEN") IsNot nothing) commands = VA.GetText("AVCS_QCC_LISTEN") + ";" + commands end if if (VA.GetText("AVCS_QCC_LISTEN_TOGGLE") IsNot nothing) commands = VA.GetText("AVCS_QCC_LISTEN_TOGGLE") + ";" + commands end if if (VA.GetText("~avcs_qcc_phrase") IsNot nothing) phrases = (VA.GetText("~avcs_qcc_phrase")) phraseArray = vaProxy.Utility.ExtractPhrases(phrases, true, true) for each phrase in phraseArray 'Check only NEW phrases added to this command phrase if ((not(phrase = "")) and (not(errorsFinal.Contains(phrase))) and (not(phrasesLast.Contains(phrase)))) 'If this new phrase is not already in the loaded QCC list of commands/macros phrases if (not(commands.Contains(phrase))) if ((saveFile.Contains(phrase)) or (vaProxy.Command.Exists(phrase))) errorsFinal.Add(phrase) errorCount = errorCount + 1 VA.SetText("~avcs_qcc_error_" + errorCount.ToString(), phrase) end if 'Else add this new phrase to a new list to identify any duplicate phrase variants else if (commands.Contains(phrase)) if (phrasesUnique.Contains(phrase)) errorsFinal.Add(phrase) errorCount = errorCount + 1 VA.SetText("~avcs_qcc_error_" + errorCount.ToString(), phrase) else phrasesUnique.Add(phrase) end if end if end if next end if if(errorCount > 0) VA.SetInt("~avcs_qcc_error_count", errorCount) end if End Sub End Class