protected override void AnalyzeFile(InkFileInfo info) { if (m_Search.IsNullOrEmpty()) { return; } CheckChanges(); for (int i = 0; i < info.Lines.Length; i++) { string line = info.Lines[i]; if (m_SearchRegex.IsMatch(line)) { string[] results = m_SearchRegex.Replace(line, m_Result).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (string result in results) { if (result == null) { Debug.LogWarning($"Missing item found in {m_Bucket.name}.", m_Bucket); continue; } InkTodoCollection collection = GetOrAddCollection(result); collection.Add(new Todo(info, i + 1, line)); } } } }
protected InkTodoCollection Add(string key, InkTodoStatus status = InkTodoStatus.None) { key = key.ToLower(); if (status == InkTodoStatus.None) { // If this is the 'todo' search, then mark them as incomplete. if (m_Name.Contains("todo", StringComparison.OrdinalIgnoreCase)) { status = InkTodoStatus.Incomplete; } // Else if there is no bucket to find items in, then this is informational, so mark it as complete. else if (!m_Bucket) { status = InkTodoStatus.Complete; } // Else if the bucket has the key, then mark it as complete. else if (m_Bucket.HasItem(key)) { status = InkTodoStatus.Complete; } // Else the bucket exists and doesn't have the key, so mark it as incomplete. else { status = InkTodoStatus.Incomplete; } } InkTodoCollection collection = new InkTodoCollection(key, status); m_TodoCollectionKeys.Add(key); m_TodoCollections.Add(collection); return(collection); }