Skip to content

Commit 00aa151

Browse files
committed
Changes to the MD project
1 parent 24c055c commit 00aa151

16 files changed

+937
-10
lines changed

Packages.mdproj

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@
88
<Packages>
99
<Packages>
1010
<Package name="Linux Binärdateien">
11-
<Builder targetFile="moNotational Velocity -linux.tar.gz" platform="Linux" configuration="Debug|x86" ctype="BinariesZipPackageBuilder">
11+
<Builder targetFile="moNotationalVelocity-linux.tar.gz" platform="Linux" configuration="Release|x86" ctype="BinariesZipPackageBuilder">
1212
<ChildEntries>
13-
<SolutionItemReference path="moNotational Velocity\moNotational Velocity .csproj" />
13+
<SolutionItemReference path="moNotationalVelocity\moNotationalVelocity.csproj" />
1414
</ChildEntries>
15-
<RootEntry path="moNotational Velocity .sln" id=":root:" />
15+
<RootEntry path="moNotationalVelocity.sln" id=":root:" />
1616
</Builder>
1717
</Package>
1818
<Package name="Microsoft Windows Binärdateien">
19-
<Builder targetFile="moNotational Velocity -windows.tar.gz" platform="Windows" configuration="Debug|x86" ctype="BinariesZipPackageBuilder">
19+
<Builder targetFile="moNotationalVelocity.tar.gz" platform="Windows" configuration="Release|x86" ctype="BinariesZipPackageBuilder">
2020
<ChildEntries>
21-
<SolutionItemReference path="moNotational Velocity\moNotational Velocity .csproj" />
21+
<SolutionItemReference path="moNotationalVelocity\moNotationalVelocity.csproj" />
2222
</ChildEntries>
23-
<RootEntry path="moNotational Velocity .sln" id=":root:" />
23+
<RootEntry path="moNotationalVelocity.sln" id=":root:" />
2424
</Builder>
2525
</Package>
2626
<Package name="Tarball">
27-
<Builder TargetDirectory="moNotational Velocity" DefaultConfiguration="Debug|x86" ctype="TarballDeployTarget">
27+
<Builder TargetDirectory="moNotationalVelocity" DefaultConfiguration="Release|x86" ctype="TarballDeployTarget">
2828
<ChildEntries>
29-
<SolutionItemReference path="moNotational Velocity\moNotational Velocity .csproj" />
29+
<SolutionItemReference path="moNotationalVelocity\moNotationalVelocity.csproj" />
3030
</ChildEntries>
31-
<RootEntry path="moNotational Velocity .sln" id=":root:" />
31+
<RootEntry path="moNotationalVelocity.sln" id=":root:" />
3232
</Builder>
3333
</Package>
3434
</Packages>
3535
</Packages>
3636
</PropertyGroup>
37-
</Project>
37+
</Project>

moNotationalVelocity.sln

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 9.00
3+
# Visual Studio 2005
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "moNotationalVelocity", "moNotationalVelocity\moNotationalVelocity.csproj", "{FE780903-491A-4E18-8917-C5FE0FAD8DFB}"
5+
EndProject
6+
Project("{9344bdbb-3e7f-41fc-a0dd-8665d75ee146}") = "Packages", "Packages.mdproj", "{867018DF-6436-4C1B-A776-1BD1568741CF}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x86 = Debug|x86
11+
Release|x86 = Release|x86
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{867018DF-6436-4C1B-A776-1BD1568741CF}.Debug|x86.ActiveCfg = Debug|Any CPU
15+
{867018DF-6436-4C1B-A776-1BD1568741CF}.Release|x86.ActiveCfg = Release|Any CPU
16+
{FE780903-491A-4E18-8917-C5FE0FAD8DFB}.Debug|x86.ActiveCfg = Debug|x86
17+
{FE780903-491A-4E18-8917-C5FE0FAD8DFB}.Debug|x86.Build.0 = Debug|x86
18+
{FE780903-491A-4E18-8917-C5FE0FAD8DFB}.Release|x86.ActiveCfg = Release|x86
19+
{FE780903-491A-4E18-8917-C5FE0FAD8DFB}.Release|x86.Build.0 = Release|x86
20+
EndGlobalSection
21+
GlobalSection(MonoDevelopProperties) = preSolution
22+
StartupItem = moNotationalVelocity\moNotationalVelocity.csproj
23+
Policies = $0
24+
$0.TextStylePolicy = $1
25+
$1.FileWidth = 120
26+
$1.TabWidth = 4
27+
$1.inheritsSet = Mono
28+
$1.inheritsScope = text/plain
29+
$1.scope = text/plain
30+
$0.TextStylePolicy = $2
31+
$2.inheritsSet = null
32+
$2.scope = text/x-csharp
33+
$0.CSharpFormattingPolicy = $3
34+
$3.inheritsSet = Mono
35+
$3.inheritsScope = text/x-csharp
36+
$3.scope = text/x-csharp
37+
$0.TextStylePolicy = $4
38+
$4.inheritsSet = null
39+
$4.scope = application/x-desktop
40+
$0.StandardHeader = $5
41+
$5.Text =
42+
$5.inheritsSet = Apache2License
43+
$0.VersionControlPolicy = $6
44+
$6.inheritsSet = Mono
45+
$0.ChangeLogPolicy = $7
46+
$7.UpdateMode = None
47+
$7.MessageStyle = $8
48+
$8.LineAlign = 0
49+
$7.inheritsSet = Mono
50+
EndGlobalSection
51+
EndGlobal

moNotationalVelocity.userprefs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Properties>
2+
<AuthorInfo Name="Michael Zehrer" Email="[email protected]" Copyright="Michael Zehrer" ctype="AuthorInformation" />
3+
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" ctype="Workspace" />
4+
<MonoDevelop.Ide.Workbench ctype="Workbench" />
5+
<MonoDevelop.Ide.DebuggingService.Breakpoints>
6+
<BreakpointStore />
7+
</MonoDevelop.Ide.DebuggingService.Breakpoints>
8+
<MonoDevelop.Ide.DebuggingService.PinnedWatches ctype="PinnedWatchStore" />
9+
</Properties>

moNotationalVelocity/AssemblyInfo.cs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
4+
// Information about this assembly is defined by the following attributes.
5+
// Change them to the values specific to your project.
6+
7+
[assembly: AssemblyTitle("moNotational Velocity ")]
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyProduct("")]
12+
[assembly: AssemblyCopyright("")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19+
20+
[assembly: AssemblyVersion("1.0.*")]
21+
22+
// The following attributes are used to specify the signing key for the assembly,
23+
// if desired. See the Mono documentation for more information about signing.
24+
25+
//[assembly: AssemblyDelaySign(false)]
26+
//[assembly: AssemblyKeyFile("")]
27+

moNotationalVelocity/Configuration.cs

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
using Microsoft.Win32;
3+
4+
namespace moNotationalVelocity
5+
{
6+
public class Configuration
7+
{
8+
9+
public string notesDirPath;
10+
11+
private string defaulNotesDirtPath = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "moNotational Data");
12+
13+
private string platform;
14+
15+
private RegistryKey OurAppRootKey = null;
16+
private RegistryKey ConfigKey = null;
17+
18+
public Configuration ()
19+
{
20+
OperatingSystem os = Environment.OSVersion;
21+
Console.WriteLine ("OS platform: " + os.Platform);
22+
this.platform = os.Platform.ToString ();
23+
24+
if (this.platform.StartsWith ("Win")) {
25+
26+
RegistryKey CurrentUserKey = Microsoft.Win32.Registry.CurrentUser;
27+
28+
string OurAppKeyStr = @"SOFTWARE\moNotationalVelocity";
29+
OurAppRootKey = CurrentUserKey.CreateSubKey (OurAppKeyStr);
30+
ConfigKey = OurAppRootKey.CreateSubKey ("config");
31+
32+
this.notesDirPath = ConfigKey.GetValue ("notesDirPath") as string;
33+
if (this.notesDirPath == null) {
34+
Console.WriteLine ("No configuration");
35+
this.notesDirPath = defaulNotesDirtPath;
36+
ConfigKey.SetValue ("notesDirPath", this.notesDirPath, RegistryValueKind.String);
37+
}
38+
39+
ConfigKey.Flush ();
40+
41+
} else {
42+
43+
44+
45+
this.notesDirPath = defaulNotesDirtPath;
46+
}
47+
48+
}
49+
}
50+
}
51+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
using System;
2+
using System.Collections;
3+
using System.IO;
4+
using Lucene.Net.Analysis;
5+
using Lucene.Net.Index;
6+
using Lucene.Net.Documents;
7+
using Lucene.Net.QueryParsers;
8+
using Lucene.Net.Search;
9+
using System.Runtime.CompilerServices;
10+
11+
namespace moNotationalVelocity
12+
{
13+
public class FilesystemNotesStore : NotesStore
14+
{
15+
16+
ArrayList notes = new ArrayList ();
17+
string noteStorePath;
18+
Lucene.Net.Store.Directory lucIdx;
19+
Analyzer analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer ();
20+
21+
public FilesystemNotesStore (string path)
22+
{
23+
this.noteStorePath = path;
24+
25+
26+
lucIdx = new Lucene.Net.Store.RAMDirectory ();
27+
IndexWriter writer = new IndexWriter (lucIdx, analyzer, true);
28+
29+
30+
DirectoryInfo di = new DirectoryInfo (noteStorePath);
31+
FileInfo[] rgFiles = di.GetFiles ("*.txt");
32+
foreach (FileInfo fi in rgFiles) {
33+
34+
string noteTitle = Path.GetFileNameWithoutExtension (fi.FullName);
35+
string noteLastMod = fi.LastAccessTime.ToShortDateString ();
36+
37+
notes.Add (new Note (noteTitle, noteLastMod));
38+
Document doc = new Document ();
39+
doc.Add (new Field ("title", noteTitle, true, true, true));
40+
doc.Add (new Field ("lastmod", noteLastMod, true, true, true));
41+
string content = getNoteContent (noteTitle);
42+
if (content != null && content.Length > 0)
43+
doc.Add (new Field ("content", content, false, true, true, true));
44+
writer.AddDocument (doc);
45+
}
46+
47+
writer.Optimize ();
48+
writer.Close ();
49+
50+
}
51+
52+
public ArrayList getAllNotes ()
53+
{
54+
return notes;
55+
}
56+
57+
public ArrayList getNotesMatchingTitle (string search)
58+
{
59+
60+
ArrayList snotes = new ArrayList ();
61+
62+
try {
63+
QueryParser parser = new QueryParser ("title", analyzer);
64+
65+
string lucsearch = search + "*^4" + " content:" + search + "*";
66+
67+
Query query = parser.Parse (lucsearch);
68+
IndexSearcher searcher = new IndexSearcher (lucIdx);
69+
Hits hits = searcher.Search (query);
70+
71+
int results = hits.Length ();
72+
Console.WriteLine ("Found {0} results", results);
73+
for (int i = 0; i < results; i++) {
74+
Document doc = hits.Doc (i);
75+
//float score = hits.Score (i);
76+
snotes.Add (new Note (doc.Get ("title"), doc.Get ("lastmod")));
77+
}
78+
} catch (Exception e) {
79+
Console.WriteLine ("ERROR Search: " + e.Message);
80+
}
81+
82+
return snotes;
83+
}
84+
85+
public bool doesNoteExist (string title)
86+
{
87+
if (new FileInfo (noteStorePath + "/" + title + ".txt").Exists)
88+
return true;
89+
90+
return false;
91+
92+
}
93+
94+
public void createNote (string title)
95+
{
96+
TextWriter textWriter = new StreamWriter (noteStorePath + "/" + title + ".txt");
97+
textWriter.Write ("");
98+
textWriter.Close ();
99+
getAllNotes ();
100+
}
101+
102+
public string getNoteContent (string title)
103+
{
104+
StreamReader streamReader = new StreamReader (noteStorePath + "/" + title + ".txt");
105+
string text = streamReader.ReadToEnd ();
106+
streamReader.Close ();
107+
return text;
108+
109+
}
110+
111+
[MethodImpl(MethodImplOptions.Synchronized)]
112+
public void storeNoteContent (string title, string content)
113+
{
114+
TextWriter textWriter = new StreamWriter (noteStorePath + "/" + title + ".txt");
115+
textWriter.Write (content);
116+
textWriter.Close ();
117+
}
118+
119+
}
120+
}
121+

moNotationalVelocity/Main.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using Gtk;
3+
4+
namespace moNotationalVelocity
5+
{
6+
class MainClass
7+
{
8+
public static void Main (string[] args)
9+
{
10+
Application.Init ();
11+
MainWindow win = new MainWindow ();
12+
win.Show ();
13+
Application.Run ();
14+
}
15+
}
16+
}
17+

0 commit comments

Comments
 (0)