public static VocalIndexObject Deseralize(string Folder) { VocalIndexObject ret = null; if (System.IO.File.Exists(Folder + "\\voicedbi.dat")) { ret = SerializeFrom(Folder + "\\voicedbi.dat"); if (ret != null) { string NewHash = CalcHash(ret.HashFiles, Folder); if (NewHash != ret.HashValue) { ret = null; } } } if (ret == null) { ret = new VocalIndexObject(); ret.BasicData.IntroduceText = "Chorista Voice Index Cache File"; ret.HashFiles.Add("character.txt"); ret.CharacertData = CharacterSerializer.DeSerialize(Folder + "\\character.txt"); ret.SndAtomList = OtoSerializer.DeSerialize(Folder, ret.HashFiles); ret.HashFiles.Add("prefix.map"); if (System.IO.File.Exists(Folder + "\\prefix.map")) { ret.PrefixAtomList = PrefixMapSerialzier.DeSerialize(Folder + "\\prefix.map"); } SplitDictionary sdlib = null; if (System.IO.File.Exists(Folder + "\\splitdic.json")) { sdlib = SplitDictionary.SerializeFrom(Folder + "\\splitdic.json"); if (ret != null) { ret.HashFiles.Add("splitdic.json"); } } if (sdlib == null && System.IO.File.Exists(Folder + "\\presamp.ini")) { sdlib = Presamp2DictSerializer.DeSerialize(Folder + "\\presamp.ini"); if (sdlib != null) { ret.HashFiles.Add("presamp.ini"); } } if (sdlib != null) { ret.SplitDictionary = sdlib; } else { ret.SplitDictionary = new SplitDictionary(); } ret.SplitDictionary.MapSndList(ret.SndAtomList, ret.PrefixAtomList); ret.HashValue = CalcHash(ret.HashFiles, Folder); SerializeTo(ret, Folder + "\\voicedbi.dat"); } return(ret); }
static void Main(string[] args) { SplitDictionary sd = Presamp2DictSerializer.DeSerialize(@"D:\VocalUtau\VocalUtau\bin\Debug\voicedb\YongQi_CVVChinese_Version2\presamp.ini"); List <VocalUtau.Formats.Model.Database.VocalDatabase.SplitDictionary.SplitAtom> sal = sd.GetCurrentNoteAtom("xxxx", "lao", "{R}"); }