public NoteNode(int @string, int fret, InternalNote?note, NoteNode parent) { String = @string; Fret = fret; Note = note; Parent = parent; }
public void ConstructorTest() { var note = new NoteNode("test", "test"); var tree = new NoteTree(note); Assert.IsNotNull(tree); }
public void SearchTagTest() { var note = new NoteNode("testTag", "content"); var tree = new NoteTree(note); Assert.IsTrue(tree.SearchTag("testTag")); }
protected virtual void onSearchBarChanged(object sender, System.EventArgs e) { string text = searchbar.Text.Trim(); if (text == null || text.Length < 1) { loadNotes(); } else if (searchbar.HasFocus) { store.Clear(); string search = searchbar.Text.Trim(); if (search != null && search.Length > 0) { ArrayList notes = notesStore.getNotesMatchingTitle(search); if (notes.Count > 0) { for (int i = 0; i < notes.Count; i++) { Note noteEntry = notes[i] as Note; NoteNode node = new NoteNode(noteEntry); store.AddNode(node); if (i == 0) { noteslist.NodeSelection.SelectNode(node); } } } } else { loadNotes(); } } }
protected virtual void onSearchbarKeyEvent(object o, Gtk.KeyPressEventArgs args) { string key = args.Event.Key.ToString(); Console.WriteLine("searchbar key: " + key); if (key.Equals("Return")) { if (!notesStore.doesNoteExist(searchbar.Text.Trim()) && searchbar.Text != null && searchbar.Text.Length > 0) { Note newNote = new Note(searchbar.Text.Trim(), ""); store.AddNode(new NoteNode(newNote)); currentNote = newNote.title; notesStore.createNote(currentNote); buf = editor.Buffer; buf.Text = ""; editor.GrabFocus(); } } else if (key.Equals("Down")) { noteslist.GrabFocus(); NoteNode node = noteslist.NodeSelection.SelectedNode as NoteNode; loadNoteToBuffer(node); } }
/// <summary> /// 新数据 /// </summary> /// <param name="isu"></param> /// <param name="data"></param> public NoteNode AddNew(ISrcUrl isu, AqiParam ap, byte[] data) { int size = 0; if (data != null) { size = data.Length; } string name = null; if (ap == null) { name = isu.Tag; } else { name = isu.Tag + ap.Name; } NoteNode item = new NoteNode(name, size); lock (this.history) { this.history.Add(item); this.endtime = DateTime.Now; this.size += item.dateSize; this.count += 1L; } return(item); }
public void CreateList() { /* * MusicControl mc=AS.GetComponent<MusicControl>(); * // while (!mc.AS.isPlaying); * Debug.Log((int)(mc.AS.clip.length)); * Debug.Log(mc.AS.clip.length);*/ noteList = new List <NoteNode>(); for (int i = 0; i < beatmap.map.Length; i++) { for (int j = 0; j < beatmap.map [i].notes.Length; j++) { NoteNode _note = new NoteNode(); _note.time = beatmap.map[i].t; _note.type = beatmap.map [i].notes [j].type; _note.pos = new Vector3(beatmap.map [i].notes [j].x, beatmap.map [i].notes [j].y, beatmap.map [i].notes [j].z); _note._alive = false; noteList.Add(_note); //noteBucket [(int)(beatmap.map[i].t)].Add(_note); } } notePointerEnd = noteList.Count; IsCreateBucket = true; }
public void DeleteNote() { if (isEdit == true) { ScrollContentCreate sc = scrollcontentview.GetComponent <ScrollContentCreate> (); NoteNode _node; _node = new NoteNode(); sc.noteList.RemoveAt(NoteNodeIndex); sc.GetComponentsInChildren <Button> () [NoteNodeIndex].onClick.RemoveAllListeners(); // sc.GetComponentsInChildren<Button> () [NoteNodeIndex] Destroy(sc.GetComponentsInChildren <Button> () [NoteNodeIndex].gameObject); sc.gameObject.GetComponent <RectTransform> ().sizeDelta = new Vector2( sc.gameObject.GetComponent <RectTransform> ().sizeDelta.x, sc.gameObject.GetComponent <RectTransform> ().sizeDelta.y - sc.noteButton.GetComponent <LayoutElement> ().minHeight ); if (NoteNow) { Destroy(NoteNow); //DESTROY IT } isEdit = false; } }
public void BareString() { var note = new NoteNode("test", "test"); var result = note.ToBareString(); Assert.AreEqual("test", result); }
/// <summary> /// 保存处理 /// </summary> /// <param name="data">数据</param> /// <param name="isu">数据接口</param> /// <param name="ap">参数</param> public void SaveProcess(byte[] data, ISrcUrl isu, AqiParam ap) { try { //统计信息 NoteNode node = this.an.AddNew(isu, ap, data); //保存 if (ap == null) { node.Saved = this.ias.Save(isu, data); } else { node.Saved = this.ias.Save(isu, ap, data); } if (node.Saved) { AqiManage.Remind.Log_Info("数据保存成功", new string[] { this.name, isu.Name }); } else { node.Data = data; AqiManage.Remind.Log_Error("数据保存失败", new string[] { this.name, isu.Name }); } } catch (Exception exception) { AqiManage.Remind.Log_Error("数据保存失败", exception, new string[] { this.name, isu.Name }); } }
/// <summary> /// Handles the TextChanged event of the tbNote. /// </summary> private void TbNote_TextChanged(object sender, EventArgs e) { if (tvKnownPaths.SelectedNode != null) { NoteNode node = (NoteNode)tvKnownPaths.SelectedNode; node.Note = tbNote.Text; } }
public async Task FindRecursive_NotExists_ReturnsEmpty() { NoteNode noteNode = new NoteNode(Path.Combine(TestFilesDirectory, GeneralNotesDirectoryName)); IEnumerable <string> paths = await noteNode.FindRecursive("NoteExistsNote").ConfigureAwait(false); Assert.Empty(paths); }
protected override void VisitNote(NoteNode node, int index) { CurrentStream = HtmlFragment.Notes; Write("<p class=\"dast-note\" id=\"dast-note-", index.ToString(), "\">", index.ToString(), ". "); JoinChildren(node, " "); Write("</p>"); CurrentStream = HtmlFragment.Body; }
private void loadNoteToBuffer(NoteNode node) { if (node != null && !searchbar.HasFocus) { currentNote = node.Title; searchbar.Text = node.Title; loadNoteToBuffer(node.Title); } }
public void GetTagsTest() { var note = new NoteNode("testTag", "content"); var tree = new NoteTree(note); IEnumerable <string> list = tree.GetTags(); Assert.AreEqual(list.Count(), 1); Assert.AreEqual(list.ElementAt(0), "testTag"); }
public async Task FindRecursive_HasOneExactly_ReturnsOnePath() { NoteNode noteNode = new NoteNode(Path.Combine(TestFilesDirectory, GeneralNotesDirectoryName)); IEnumerable <string> path = await noteNode.FindRecursive("generalNote2").ConfigureAwait(false); Assert.Single(path); Assert.Equal(Path.Combine(TestFilesDirectory, GeneralNotesDirectoryName, "subject1", "generalNote2.txt"), path.First()); }
public void GetNotesByTagTest() { var note = new NoteNode("testTag", "content"); var tree = new NoteTree(note); IEnumerable <NoteNode> result = tree.GetNotesByTag("testTag"); Assert.AreEqual(result.Count(), 1); Assert.AreEqual(result.ElementAt(0), note); }
void OnSelectionChanged(object o, System.EventArgs args) { try { Gtk.NodeSelection selection = (Gtk.NodeSelection)o; NoteNode node = (NoteNode)selection.SelectedNode; loadNoteToBuffer(node); } catch (Exception e) { Console.WriteLine("selection changed ERROR: " + e.Message); } }
public async Task FindRecursive_HasTwoPaths_ReturnsTwoPaths() { NoteNode noteNode = new NoteNode(Path.Combine(TestFilesDirectory, GeneralNotesDirectoryName)); IEnumerable <string> paths = await noteNode.FindRecursive("generalNote1").ConfigureAwait(false); List <string> pathsList = paths.ToList(); Assert.Equal(2, pathsList.Count); Assert.Equal(Path.Combine(TestFilesDirectory, GeneralNotesDirectoryName, "subject1", "generalNote1.txt"), pathsList[0]); Assert.Equal(Path.Combine(TestFilesDirectory, GeneralNotesDirectoryName, "subject2", "generalNote1.txt"), pathsList[1]); }
private static async Task FindAllScalesAsync(ScaleFinderResultSet results, NoteNode noteNode, InternalNote[] targetNotes, int nextNote, int str, IScaleFinderOptions scaleFinderOptions, CancellationToken cancelToken) { if (cancelToken.IsCancellationRequested) { return; } IInstrument instrument = scaleFinderOptions.Instrument; if (nextNote == targetNotes.Length) // Build a scale result { List <MarkPosition> marks = new List <MarkPosition>(); NoteNode nn = noteNode; // Walk back up the tree to set the marks on the result and flag each target note while (null != nn) { if (nn.Fret >= 0) { marks.Add(new MarkPosition(nn.String + 1, nn.Fret)); } nn = nn.Parent; } results.AddResult(marks); } else if (str < instrument.NumStrings) // Keep building the tree { // Look at all the notes on the string int startingFret = scaleFinderOptions.AllowOpenStrings ? 0 : 1; if (null != noteNode && noteNode.String == str) { startingFret = noteNode.Fret + 1; } for (int fret = startingFret; fret <= scaleFinderOptions.MaxFret; fret++) { InternalNote note = NoteUtils.Shift(scaleFinderOptions.Tuning.RootNotes[str].InternalNote, fret); // See if the note is the next target note if (note == targetNotes[nextNote]) { NoteNode child = new NoteNode(str, fret, note, noteNode); // Add found note await FindAllScalesAsync(results, child, targetNotes, nextNote + 1, str, scaleFinderOptions, cancelToken); // Look for the next note on the same string } } await FindAllScalesAsync(results, noteNode, targetNotes, nextNote, str + 1, scaleFinderOptions, cancelToken); // Look for the next note on the next string } }
public void NotesToString() { var note = new NoteNode("test", "test"); var tree = new NoteTree(note); var output = tree.ToString(); var parser = new NoteParser(output); var tree2 = parser.GetTree(); var output2 = tree2.ToString(); Assert.AreEqual(output, output2); }
protected virtual void onListKeyEvent(object o, Gtk.KeyPressEventArgs args) { string key = args.Event.Key.ToString(); Console.WriteLine("noteslist key: " + key); NoteNode node = noteslist.NodeSelection.SelectedNode as NoteNode; if (key.Equals("Return")) { editor.GrabFocus(); } else if (key.Equals("d") || key.Equals("Delete")) { if (node != null) { MessageDialog md = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, "Are you sure you want to delete the note " + node.Title + "" + "?"); ResponseType result = (ResponseType)md.Run(); if (result == ResponseType.Yes) { noteslist.NodeStore.RemoveNode(node); notesStore.deleteNote(node.Title); GoBackToSearch(); } md.Destroy(); } } else if (key.Equals("r")) { if (node != null) { RenameNote renameDialog = new RenameNote(); renameDialog.NoteTitle = node.Title; renameDialog.init(); ResponseType result = (ResponseType)renameDialog.Run(); if (result == ResponseType.Ok) { string newTitle = renameDialog.NoteTitle.Trim(); Console.WriteLine("Response: " + newTitle); if (newTitle != null && newTitle.Length > 0 && !newTitle.Equals(node.Title)) { notesStore.RenameNote(node.Title, newTitle); node.Title = newTitle; } } renameDialog.Destroy(); } } }
protected void onListButtonPress(object sender, ButtonPressEventArgs e) { uint button = e.Event.Button; Console.WriteLine("noteslist button: " + button); noteslist.GrabFocus(); NoteNode node = noteslist.NodeSelection.SelectedNode as NoteNode; loadNoteToBuffer(node); }
/// <summary> /// Handles the AfterSelect event of the tvKnownPaths. /// </summary> private void TvKnownPaths_AfterSelect(object sender, TreeViewEventArgs e) { if (tvKnownPaths.SelectedNode != null) { NoteNode node = (NoteNode)tvKnownPaths.SelectedNode; tbNote.Text = node.Note; tbNote.Enabled = true; } else { tbNote.Text = string.Empty; tbNote.Enabled = false; } }
public async Task GetGeneralNotesPaths_AsExpected() { IOptions <DatabaseConfigurtaion> databaseOptions = Options.Create(new DatabaseConfigurtaion() { NotesDirectoryPath = GeneralNotesDirectoryPath, NotesTasksDirectoryPath = "a" }); INoteService noteService = new NoteService( mNoteFactory, databaseOptions, NullLogger <NoteService> .Instance); NoteNode noteNode = await noteService.GetGeneralNotesStructure().ConfigureAwait(false); Assert.Equal(Path.GetFileName(GeneralNotesDirectoryPath), noteNode.Name); }
public void Ctor_CreatedAsExpected() { NoteNode noteNode = new NoteNode(Path.Combine(TestFilesDirectory, GeneralNotesDirectoryName)); Assert.Equal(GeneralNotesDirectoryName, noteNode.Name); Assert.Equal(3, noteNode.Children.Count); Assert.Equal("subject1", noteNode.Children["subject1"].Name); Assert.Equal(2, noteNode.Children["subject1"].Children.Count); Assert.Equal("generalNote3.txt", noteNode.Children["generalNote3.txt"].Name); Assert.Empty(noteNode.Children["generalNote3.txt"].Children); Assert.Equal("generalNote1.txt", noteNode.Children["subject1"].Children["generalNote1.txt"].Name); Assert.Equal("generalNote2.txt", noteNode.Children["subject1"].Children["generalNote2.txt"].Name); }
public async Task <IResponse <NoteResourceResponse> > GetGeneralNote(string noteIdentifier) { NoteNode generalNotesStructure = await GetGeneralNotesStructure().ConfigureAwait(false); IEnumerable <string> notesPaths = await generalNotesStructure.FindRecursive(noteIdentifier).ConfigureAwait(false); NoteResourceResponse noteResponse = new NoteResourceResponse( mGeneralNotesDirectory, notesPaths, mNoteFactory); if (!noteResponse.IsNoteFound) { return(new FailResponse <NoteResourceResponse>($"No {noteIdentifier} note found")); } return(new SuccessResponse <NoteResourceResponse>(noteResponse)); }
private void CtrlNHandler() { if ((TrVwNotesList.SelectedNode as NoteNode)?.IsSaved ?? true) { TxtTitle.Text = RTxtDesc.Text = string.Empty; TxtTitle.Enabled = RTxtDesc.Enabled = true; TxtTitle.Focus(); TreeNode node = new NoteNode(); node.ForeColor = Color.Yellow; node.BackColor = Color.Red; TrVwNotesList.Nodes.Add(node); TrVwNotesList.SelectedNode = node; } }
public async Task <IResponse <NoteResourceResponse> > GetTaskNote(string noteIdentifier) { mLogger.LogDebug($"Creating notes file system structure from {mTasksNotesDirectory}"); NoteNode tasksNotesStructure = new NoteNode(mTasksNotesDirectory); IEnumerable <string> notesPaths = await tasksNotesStructure.FindRecursive(noteIdentifier).ConfigureAwait(false); NoteResourceResponse noteResponse = new NoteResourceResponse( mTasksNotesDirectory, notesPaths, mNoteFactory); if (!noteResponse.IsNoteFound) { return(new FailResponse <NoteResourceResponse>($"No {noteIdentifier} note found")); } return(new SuccessResponse <NoteResourceResponse>(noteResponse)); }
private void CtrlEHandler() { NoteNode note = TrVwNotesList.SelectedNode as NoteNode; if (note?.IsSaved ?? false) { if (ML.DeleteNoteNode(note)) { TxtTitle.Enabled = RTxtDesc.Enabled = true; note.IsSaved = false; note.ForeColor = Color.Yellow; note.BackColor = Color.Red; } else { MessageBox.Show("failed deletion"); } } }
private void loadNoteToBuffer(NoteNode node) { if (node != null && !searchbar.HasFocus) { currentNote = node.Title; searchbar.Text = node.Title; loadNoteToBuffer (node.Title); } }
protected virtual void onSearchBarChanged(object sender, System.EventArgs e) { string text = searchbar.Text.Trim (); if (text == null || text.Length < 1) { loadNotes (); } else if (searchbar.HasFocus) { store.Clear (); string search = searchbar.Text.Trim (); if (search != null && search.Length > 0) { ArrayList notes = notesStore.getNotesMatchingTitle (search); if (notes.Count > 0) { for (int i = 0; i < notes.Count; i++) { Note noteEntry = notes[i] as Note; NoteNode node = new NoteNode (noteEntry); store.AddNode (node); if (i == 0) noteslist.NodeSelection.SelectNode (node); } } } else { loadNotes (); } } }