public static void Register(Type luFileInfoType) { LUFileInfo luFileInfo = Activator.CreateInstance(luFileInfoType) as LUFileInfo; if (luFileInfo == null) { throw (new ArgumentException("Is not LUFileInfo type.", "luFileInfoType")); } try { _LUFileInfos.Add(luFileInfo.Id, luFileInfo); string[] sa = luFileInfo.Extensions.Replace(" ", "").Split(','); if (sa.Length == 0) { sa = new string[] { "" }; } foreach (string ext in sa) { LUFileExtension lufExt = new LUFileExtension(ext, luFileInfo); if (_Extensions.ContainsKey(lufExt.Key)) { throw (new Exception(string.Format("Extension \"{0}\" is already exist in base.", lufExt.Extension))); } _Extensions.Add(lufExt.Key, lufExt); } } catch { throw (new Exception(string.Format("LUFileInfo.Id={0} already exist", luFileInfo.Id))); } }
public LUFileExtension(string extension, LUFileInfo luFileInfo) { _extension = extension; _luFileInfo = luFileInfo; _key = new LUFileExtensionKey(extension); }