/// <summary>
        /// Convert the given csv file under csvDir to json and store in jsonDir folder.
        /// </summary>
        /// <param name="csvFileName"> csv file to convert, with naming format "voiceover_animal.csv" </param>
        public static bool ConvertCSVToJSON(string csvFileName)
        {
            string jsonFileNameToSave = csvFileName.Substring(0, (csvFileName.Length - 3)) + "json";

            // create ouput directory
            try
            {
                if (!Directory.Exists(jsonDir))
                {
                    Directory.CreateDirectory(jsonDir);
                }
            }
            catch (IOException ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }

            var enumValues = Enum.GetValues(typeof(Language));

            // read in csv data
            List <Dictionary <string, object> > data = CSVReader.Read(csvDir + "/" + csvFileName);
            // build voJObjectList
            List <VoiceoverLine> voLineList = new List <VoiceoverLine>();

            for (int i = 0; i < data.Count; ++i)
            {
                string       key           = (string)data[i]["key"];
                string       audioFileName = (string)data[i]["audiofilename"];
                LangObject[] langObjects   = new LangObject[enumValues.Length];

                // populate langObject array
                foreach (var lang in enumValues)
                {
                    string timestampsKey = "timestamps" + "_" + lang.ToString().ToLower();
                    string linesKey      = "lines" + "_" + lang.ToString().ToLower();

                    // obtain arrays from csv string and feed to LangObject's fields
                    LangObject langObject = new LangObject(ConvertToFloatArray(data[i][timestampsKey]),
                                                           ConvertToStringArray(data[i][linesKey]));
                    langObjects[(int)lang] = langObject;
                }

                voLineList.Add(new VoiceoverLine(key, audioFileName, langObjects));
            }

            VoiceoverLine[]     voLines      = voLineList.ToArray();
            VoiceoverCollection voCollection = new VoiceoverCollection()
            {
                voiceoverLines = voLines
            };

            // save to json file
            SaveToJson(voCollection, jsonFileNameToSave);
            return(true);
        }
        /// <summary>
        ///  serialze the voCollection to a single json file; currently not assigning json files to the corresponding asset bundle.
        /// </summary>
        private static void SaveToJson(VoiceoverCollection voCollection, string jsonFileName)
        {
            // save to json file
            string jsonResult = JsonUtility.ToJson(voCollection);

            File.WriteAllText(jsonDir + "/" + jsonFileName, jsonResult);
            AssetDatabase.Refresh();

            //assign text asset to correct asset bundle
            //TextAsset jsonAsset = (TextAsset)Resources.Load(jsonDir + "/" + jsonFileName);
            //string assetPath = AssetDatabase.GetAssetPath(jsonAsset);
            //AssetImporter.GetAtPath(assetPath).SetAssetBundleNameAndVariant(bundleName, "");
            //AssetDatabase.Refresh();
        }
        /// <summary>
        /// Populate the dictionary for voiceovers in this scene
        /// The key is audio clip file name and the value is corresponding VoiceoverLine object
        /// </summary>
        private void InitializeVoiceoverManager()
        {
            string data = ReadSceneJSONFile();

            if (data == null)
            {
                missingFileErr = true;
            }
            else
            {
                VoiceoverCollection collection = VoiceoverCollection.CreateFromJSON(data);
                VoiceoverLine[]     voLines    = collection.voiceoverLines;
                for (int i = 0; i < voLines.Length; ++i)
                {
                    VoiceoverID crc = new VoiceoverID(voLines[i].key);
                    dict.Add(crc, voLines[i]);
                }
            }
        }