public bool Main(VoiceObject currentObject) { this.currentObject = currentObject; if (!Generate()) { return(false); } ImportToEngine(); return(true); }
static void Main(string[] args) { Config setupConfig = new Config(args[0].Replace("\\", "/"), args[1]); //HttpClient client = new HttpClient(); string json = ""; using (StreamReader r = new StreamReader(Config.jsonSourceFilePath)) { json = r.ReadToEnd(); } dynamic collection = JsonConvert.DeserializeObject(json); List <VoiceObject> voiceObjectList = new List <VoiceObject>(); foreach (var item in collection) { foreach (var topic in item.topics) { foreach (var label in topic.labels) { foreach (var phrase in label.phrases) { VoiceObject vo = new VoiceObject(item.containerID.ToString()); vo.Text = phrase.text; vo.Character = phrase.character; if (phrase.phraseID != null) { vo.FileName = phrase.phraseID; } else { Console.WriteLine($"WARNING: This topic: {item.containerID} doesn't have any phrases!"); continue; } vo.Gender = Helpers.GetCharacterGender(vo.Character); voiceObjectList.Add(vo); } } } } TXTFactory tXTFactory = new TXTFactory(LANG.EN); WAVFactory wAVFactory = new WAVFactory(LANG.EN); FBXFactory fBXFactory = new FBXFactory(LANG.EN); foreach (var voObj in voiceObjectList) { if (tXTFactory.Main(voObj)) { wAVFactory.Main(voObj); fBXFactory.Main(voObj); } } }
private void ParseDialog() { foreach (var item in this.collection) { if (item.topics == null) { continue; } foreach (var topic in item.topics) { if (topic.labels == null) { continue; } foreach (var label in topic.labels) { if (label.phrases == null) { continue; } foreach (var phrase in label.phrases) { VoiceObject vo = new VoiceObject( item.containerID.ToString(), DORC.Dialogs, phrase.character.name.ToString(), phrase.character.gender.ToString(), phrase.text ); if (phrase.phraseID != null) { vo.FileName = phrase.phraseID; } else { Console.WriteLine($"WARNING: This topic: {item.containerID} doesn't have any phrases!"); continue; } this.voiceObjectList.Add(vo); } } } } }
private void ParseComments() { foreach (var item in collection) { if (item.subcontainers == null) { continue; } foreach (var subcontainer in item.subcontainers) { if (subcontainer.comments == null) { continue; } foreach (var comments in subcontainer.comments) { if (comments.characters == null) { continue; } foreach (var character in comments.characters) { VoiceObject vo = new VoiceObject( subcontainer.subcontainerID.ToString(), DORC.Comments, character.name.ToString(), character.gender.ToString(), comments.text ); if (comments.commentID != null) { string temp = comments.commentID.ToString(); vo.FileName = $"{comments.nameID}{temp.Replace("Comment", "")}"; } this.voiceObjectList.Add(vo); } } } } }