guess what I forgot to attach. sorry about that.
diff -ur f-spot-0.0.13/src/PhotoStore.cs f-spot-0.0.13-hasher/src/PhotoStore.cs
--- f-spot-0.0.13/src/PhotoStore.cs 2005-05-09 06:52:29.000000000 +0100
+++ f-spot-0.0.13-hasher/src/PhotoStore.cs 2005-08-08 01:10:37.000000000 +0100
@@ -6,6 +6,7 @@
using System.IO;
using System.Text;
using System;
+using System.Security.Cryptography;
public class Photo : DbItem, IComparable, FSpot.IBrowsableItem {
@@ -468,6 +469,7 @@
" directory_path STRING NOT NULL, " +
" name STRING NOT NULL, " +
" description TEXT NOT NULL, " +
+ " digest STRING NOT NULL, " +
" default_version_id INTEGER NOT NULL " +
")";
@@ -522,11 +524,22 @@
SqliteCommand command = new SqliteCommand ();
command.Connection = Connection;
- command.CommandText = String.Format ("INSERT INTO photos (time, directory_path, name, description, default_version_id) " +
- " VALUES ({0}, '{1}', '{2}', '', {3}) ",
+ HashAlgorithm hash = (HashAlgorithm) SHA1.Create ();
+ FileStream fs = new FileStream (path, FileMode.Open, FileAccess.Read);
+ byte[] digest = hash.ComputeHash ( fs );
+ fs.Close ();
+
+ string digest_string = "";
+ for (int i = 0; i < digest.Length; i++)
+ digest_string += digest[i].ToString("X2");
+ Console.WriteLine("hash: " + digest_string);
+
+ command.CommandText = String.Format ("INSERT INTO photos (time, directory_path, name, description, digest, default_version_id) " +
+ " VALUES ({0}, '{1}', '{2}', '', '{3}', {4}) ",
unix_time,
SqlString (System.IO.Path.GetDirectoryName (path)),
SqlString (System.IO.Path.GetFileName (path)),
+ SqlString(digest_string),
Photo.OriginalVersionId);
command.ExecuteScalar ();
Attachment:
signature.asc
Description: This is a digitally signed message part