static Items() { foreach (var item in ItemsList) { ItemsDict.Add(item.Id, item); } }
/* @brief: 注册视窗道具表数据监听对象 * @param: record 监听对象 * @return void */ public static void RegistViewObjRecordCallback(string strViewID, string strItemIndex, string strRecordName, IRecord record) { Dictionary <string, Dictionary <string, List <IRecord> > > ViewDict = null; if (!mViewObjRecords.ContainsKey(strViewID)) { ViewDict = new Dictionary <string, Dictionary <string, List <IRecord> > >(); mViewObjRecords[strViewID] = ViewDict; } else { ViewDict = mViewObjRecords[strViewID]; } Dictionary <string, List <IRecord> > ItemsDict = null; if (!ViewDict.ContainsKey(strItemIndex)) { ItemsDict = new Dictionary <string, List <IRecord> >(); ViewDict[strItemIndex] = ItemsDict; } else { ItemsDict = ViewDict[strItemIndex]; } List <IRecord> records = null; if (!ItemsDict.ContainsKey(strRecordName)) { records = new List <IRecord>(); ItemsDict[strRecordName] = records; } else { records = ItemsDict[strRecordName]; } if (!records.Contains(record)) { records.Add(record); } }
protected void LoadRepository() { Log.Info("Deserializing XML file"); XmlSerializer ser = new XmlSerializer(typeof(Repository)); FileStream repo_stream = new FileStream( this.LocalRepo, FileMode.Open ); /* NameTable nt = new NameTable(); XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt); XmlParserContext context = new XmlParserContext(null, nsmgr, "de", XmlSpace.None); XmlTextReader reader = new XmlTextReader(repo_stream, XmlNodeType.Document, context); */ XmlTextReader reader = new XmlTextReader(repo_stream); Repository repo = (Repository)ser.Deserialize( reader ); reader.Close(); this.RepoItems = repo.items; this.InstallPath = ExpandPath(repo.installpath); this.ApplicationName = repo.application; this.fillTagToPlugins (); }
public void Dispose() { if (!this.disposed) { // Forward DownloadStatus event Globals.DLM.DownloadStatus -= new DownloadManagerStatusHandler( this.OnDownloadStatus ); Globals.DLM.DownloadFinished -= new DownloadManagerFinishedHandler( this.OnDownloadFinished ); this.RepoItems = null; this.DownloadToPluginId = null; this.disposed = true; GC.SuppressFinalize(this); } }