12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- using I2.Loc;
- namespace DatabaseModel
- {
- public class VoiceOver
- {
- public string Key { get; private set; }
- public string FilePath { get; private set; }
- public string FileName { get; private set; }
- public string LocalizedSubtitle
- {
- get
- {
- return ScriptLocalization.Get("subtitle/" + this.Key);
- }
- }
- public static VoiceOver[] FindByKey(string key)
- {
- if (DB.VoiceOvers.ContainsKey(key))
- {
- return (from pair in DB.VoiceOvers
- where Regex.IsMatch(pair.Key, string.Format("^{0}(\\.\\d+)?$", key))
- select pair.Value).ToArray<VoiceOver>();
- }
- throw new KeyNotFoundException(key + "不在数据库VoiceOver中");
- }
- public static VoiceOver SetValue(string[] strings)
- {
- return new VoiceOver
- {
- Key = strings[0],
- FilePath = strings[1],
- FileName = strings[2]
- };
- }
- }
- }
|