/// <summary> /// Create a new filter dialog. /// </summary> /// <param name="parent">The container for this dialog. This probably doesn't need to be the RunHistoryScreen, /// but it seems reasonable to be. Should contain a child named "Content"</param> /// <param name="saveManager">The main game's save manager.</param> /// <param name="filterManager">The filter manager. Should be empty when this constructor is called.</param> public RunFilterDialog(RunHistoryScreen parent, SaveManager saveManager, FilterManager filterManager) { this.saveManager = saveManager; this.filterManager = filterManager; // (a little fail-safe to avoid duplicate filters in the filter manager if the constructor is called again) filterManager.Clear(); Reinit(parent); }
public void AddFolder(string _root) { //ClearList(); // Load filters DirectoryInfo directoryInfo = new DirectoryInfo(Application.StartupPath); FileInfo[] filterFiles = directoryInfo.GetFiles("*.dll"); filterManager__.Clear(); if (filterFiles != null) { foreach (FileInfo fileInfo in filterFiles) { try { filterManager__.Load(fileInfo.FullName); } catch { continue; } } } this.OnBeforeAddFolder(this, null); threadStart__ = new ParameterizedThreadStart(this.ThreadProc); processingThread__ = new Thread(threadStart__); processingThread__.Priority = ThreadPriority.Lowest; shouldStop__ = false; processingThread__.Start(_root); threads__.Add(processingThread__); if (!watchersHash__.Contains(_root)) { FileSystemWatcher watcher = new FileSystemWatcher(_root); watcher.EnableRaisingEvents = true; watcher.IncludeSubdirectories = true; watcher.Deleted += new FileSystemEventHandler(watcher_Deleted); watcher.Renamed += new RenamedEventHandler(watcher_Renamed); watchersHash__.Add(_root, watcher); } this.BringToFront(); }
private void InitializeFilterNodes() { DirectoryInfo directoryInfo = new DirectoryInfo(Directories.ApplicationPath); FileInfo[] filterFiles = directoryInfo.GetFiles("*.dll"); if (filterFiles != null && filterFiles.Length != 0) { filterManager__.Clear(); foreach (FileInfo fileInfo in filterFiles) { try { filterManager__.Load(fileInfo.FullName); } catch { continue; } } filterRoot__.Nodes.Clear(); foreach (FilterBase filter in filterManager__.Items) { TreeNode node = filterRoot__.Nodes.Add(filter.Name, filter.Name, "Leaf", "Leaf"); StringBuilder sb = new StringBuilder(); sb.Append(string.Format("<FONT STYLE=\"Bold\" FACE=\"Arial\" COLOR=\"#34689A\" SIZE=\"5px\">{0}</FONT><BR/><HR/>", filter.Name)); if (filter.Documentation == null || filter.Documentation.Trim().Equals(string.Empty)) { sb.Append(string.Format("<P>{0}</P><BR/><HR/>", Resources.TEXT_NO_DOCUMENT_AVAILABLE)); } else { sb.Append(string.Format("<P>{0}</P><BR/><HR/>", filter.Documentation)); } sb.Append(string.Format("<FONT FACE=\"Tahoma\" SIZE=\"1px\" COLOR=\"GRAY\">{0}</FONT><BR/><BR/>", filter.Copyright.Replace("SunnyChen.ORG", "<A HREF=\"http://www.sunnychen.org\" TARGET=\"_blank\">SunnyChen.ORG</A>"))); node.Tag = sb.ToString(); } } }
//AA: Load the filters according to GUI selections void LoadFilters() { fm.Clear(); m_previousAbsPixelPosition = m_absPixelPosition = Vector2.zero; if (m_bUseSimpleAverage == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.SIMPLE_AVG; f.numHistory = 10; // Number of values to consider in mean fm.AddFilter(f); } if (m_bUseMovingAverage == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.MOVING_AVG; f.numHistory = 10; // Number of values to consider in moving average fm.AddFilter(f); } if (m_bUseSimpleAverage5 == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.SIMPLE_AVG; f.numHistory = 5; // Number of values to consider in mean fm.AddFilter(f); } if (m_bDblMovingAverage == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.DOUBLE_MOVING_AVG; f.numHistory = 5; // Amount of history to keep fm.AddFilter(f); } if (m_bUseExpSmoothing == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.EXP_SMOOTHING; f.numHistory = 5; // Amount of history to keep fm.AddFilter(f); } if (m_bUseDblExpSmoothing == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.DOUBLE_EXP_SMOOTHING; f.numHistory = 10; fm.AddFilter(f); } if (m_bUseAdaptive == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.ADAPTIVE_DOUBLE_EXP_SMOOTHING; fm.AddFilter(f); } if (m_bUseMedian == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.MEDIAN; f.numHistory = 10; // Amount of history to keep fm.AddFilter(f); } if (m_bUseCombination1 == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.COMBINATION1; fm.AddFilter(f); } if (m_bUseCombination2 == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.COMBINATION2; fm.AddFilter(f); } if (m_bUseNone == true) { Filter f = new Filter(); f.name = Filter.FILTER_NAME.NONE; fm.AddFilter(f); } }