Permalink
Browse files

-change: new query string format used

-change: moved to SQLite x86 for .NET framework 4.0
  • Loading branch information...
1 parent ad76da1 commit 24d19865b708a50ae9882ef63b014b41366c2133 unknown committed May 23, 2012
View
4 DataRepository/SQLiteRepository.cs
@@ -57,9 +57,11 @@ public class SQLiteRepository : IRepository
/// </summary>
public SQLiteRepository()
{
+ cLogger.DebugFormat("reference db connection string: {0}", string.Format("Data Source={0}", REFERENCE_DB_PATH));
+
referenceConnection = new SQLiteConnection(string.Format("Data Source={0}", REFERENCE_DB_PATH));
archiveConnection = new SQLiteConnection(string.Format("Data Source={0}", ARCHIVE_DB_PATH));
- cLogger.Debug("creating SQLiteRepository");
+ cLogger.Debug("SQLiteRepository.ctor()");
if (!Directory.Exists(REPOSITORY_PATH))
{
cLogger.DebugFormat("directory '{0}' does not exist", REPOSITORY_PATH);
View
1 GSTAppLogic/app/AppLogicImpl.cs
@@ -33,6 +33,7 @@ public void Start(string student, string assignment, string source)
{
cLogger.DebugFormat("starting with threshold {0}", Threshold);
var tokens = LexerHelper.CreateLexerFromSource(source).GetTokenWrappers().ToList();
+ cLogger.Debug("tokenized source... loading Data Repository");
var repo = Repository.GetRepository();
var comparisonModel = new ComparisonModel(tokens, repo.LoadByAssignment(assignment));
View
23 GSTConsole/GeneralHelper.cs
@@ -16,9 +16,12 @@ static class GeneralHelper
/// <returns></returns>
internal static string GetStudentIdentifier(string queryString)
{
+ return GetValueFromQueryString("pin", queryString);
+ /*
var firstPart = queryString.Substring(0, queryString.IndexOf('&'));
var afterSecondSlash = firstPart.Substring(firstPart.IndexOf('/', firstPart.IndexOf('/') + 1) + 1);
return afterSecondSlash.Substring(0, afterSecondSlash.IndexOf('/'));
+ /* */
}
/// <summary>
@@ -28,10 +31,13 @@ internal static string GetStudentIdentifier(string queryString)
/// <returns></returns>
internal static string GetAssignmentIdentifier(string queryString)
{
+ return GetValueFromQueryString("repository", queryString);
+ /*
var middlePart = queryString.Substring(queryString.IndexOf('&') + 1);
middlePart = middlePart.Substring(0, middlePart.IndexOf('&'));
return middlePart.Substring(middlePart.LastIndexOf('/') + 1);
+ /* */
}
/// <summary>
@@ -41,7 +47,8 @@ internal static string GetAssignmentIdentifier(string queryString)
/// <returns></returns>
internal static string GetPath(string queryString)
{
- return queryString.Substring(0, queryString.IndexOf('&'));
+ return GetValueFromQueryString("path", queryString);
+ //return queryString.Substring(0, queryString.IndexOf('&'));
}
/// <summary>
@@ -51,15 +58,21 @@ internal static string GetPath(string queryString)
/// <returns></returns>
internal static Int32 GetThreshold(string queryString)
{
- var parts = queryString.Split(new[] {'&'});
-
- var first = parts.Where(part => part.StartsWith("thres=")).Select(part => part.Substring(part.IndexOf("=") + 1)).
- FirstOrDefault();
+ var first = GetValueFromQueryString("thres", queryString);
int result;
return Int32.TryParse(first, out result) ? result : DEFAULT_THRESHOLD;
}
+ internal static string GetValueFromQueryString(string key, string queryString)
+ {
+ var parts = queryString.Split(new[] { '&' });
+ var first = parts.Where(part => part.StartsWith(key)).Select(part => part.Substring(part.IndexOf("=") + 1)).
+ FirstOrDefault();
+
+ return first;
+ }
+
/// <summary>
/// returns the student identifier from args
View
BIN ThirdPartyLibs/System.Data.SQLite.Linq.dll
Binary file not shown.
View
BIN ThirdPartyLibs/System.Data.SQLite.dll
Binary file not shown.

0 comments on commit 24d1986

Please sign in to comment.