public bool AddModelToRecent(string fileName, string icon) { var splitFileName = new SplitFileName(fileName); var recentRecord = new RecentModelHistory.RecentRecord(fileName, splitFileName.name + "." + splitFileName.ext, icon); for (var index = 0; index < m_thedatabaseRecent.Count; ++index) { if (m_thedatabaseRecent[index].cachefilename != null && m_thedatabaseRecent[index].cachefilename.Equals(recentRecord.cachefilename, StringComparison.OrdinalIgnoreCase)) { if (string.IsNullOrEmpty(icon) && !string.IsNullOrEmpty(m_thedatabaseRecent[index].iconfilename)) { recentRecord.iconfilename = m_thedatabaseRecent[index].iconfilename; } else if (!string.IsNullOrEmpty(m_thedatabaseRecent[index].iconfilename) && !m_thedatabaseRecent[index].iconfilename.Equals(recentRecord.iconfilename)) { if (File.Exists(m_thedatabaseRecent[index].iconfilename)) { try { File.Delete(m_thedatabaseRecent[index].iconfilename); } catch (IOException ex) { } } } m_thedatabaseRecent.RemoveAt(index); break; } } m_thedatabaseRecent.Insert(0, recentRecord); SaveRecentData(); return(true); }
public RecentRecord(RecentModelHistory.RecentRecord other) : base(other) { cachefilename = other.cachefilename; _3dmodelfilename = other._3dmodelfilename; iconfilename = other.iconfilename; }
public QueryResults <RecentModelHistory.RecentRecord> QuereyRecords(string filter) { if (m_thedatabaseRecent.Count < 1) { return(null); } var queryResults = new QueryResults <RecentModelHistory.RecentRecord>(); foreach (RecentModelHistory.RecentRecord other in m_thedatabaseRecent) { if (string.IsNullOrEmpty(filter) || Matches(other._3dmodelfilename, filter)) { var recentRecord = new RecentModelHistory.RecentRecord(other); queryResults.records.Add(recentRecord); } } return(queryResults); }
public void GenerateIconForLibrary(ModelTransformPair model_transform) { var zipFileName = model_transform.modelNode.zipFileName; if (!string.IsNullOrEmpty(zipFileName)) { if (zipFileName == "313a13a6-9edf-44c7-a81d-50b914e423cc-6bb0e036-df11-4d66-82b3-8b7f0de03d2c") { return; } RecentModelHistory.RecentRecord record = libraryData.GetRecord(zipFileName); if (record != null && !string.IsNullOrEmpty(record.iconfilename)) { ImageGenerated(zipFileName, record.iconfilename); return; } } var iconFileName = GenerateIconFileName(model_transform.modelNode.fileName); ImageCapture.GenerateAndSaveIcon(model_transform, iconFileName, new Vector2(400f, 400f), new Color4(0.8431373f, 0.8901961f, 0.9921569f, 1f), glControl, new ImageCapture.PreviewImageCallback(ImageGenerated)); }