Пример #1
0
        protected void InitFileAttributesStore(string name, string external_fingerprint)
        {
            string storage_path     = Path.Combine(PathFinder.IndexDir, name);
            string fingerprint_file = Path.Combine(storage_path, "fingerprint");
            string internal_fingerprint;

            if (!Directory.Exists(storage_path))
            {
                Directory.CreateDirectory(storage_path);
                internal_fingerprint = GuidFu.ToShortString(Guid.NewGuid());
                StreamWriter writer = new StreamWriter(fingerprint_file);
                writer.WriteLine(internal_fingerprint);
                writer.Close();
            }
            else
            {
                StreamReader reader = new StreamReader(fingerprint_file);
                internal_fingerprint = reader.ReadLine();
                reader.Close();
            }

            string fingerprint;

            if (external_fingerprint != null)
            {
                fingerprint = internal_fingerprint + "-" + external_fingerprint;
            }
            else
            {
                fingerprint = internal_fingerprint;
            }

            IFileAttributesStore ifa_store;

            if (ExtendedAttribute.Supported)
            {
                ifa_store = new FileAttributesStore_ExtendedAttribute(fingerprint);
            }
            else
            {
                ifa_store = new FileAttributesStore_Sqlite(storage_path, fingerprint);
            }

            fa_store = new FileAttributesStore(ifa_store);
        }
 public FileAttributesStore_Mixed(string directory, string index_fingerprint)
 {
     store_ea     = new FileAttributesStore_ExtendedAttribute(index_fingerprint);
     store_sqlite = new FileAttributesStore_Sqlite(directory, index_fingerprint);
 }
		protected void InitFileAttributesStore (string name, string external_fingerprint)
		{
			string storage_path = Path.Combine (PathFinder.IndexDir, name);
			string fingerprint_file = Path.Combine (storage_path, "fingerprint");
			string internal_fingerprint;

			if (! Directory.Exists (storage_path)) {
				Directory.CreateDirectory (storage_path);
				internal_fingerprint = GuidFu.ToShortString (Guid.NewGuid ());
				StreamWriter writer = new StreamWriter (fingerprint_file);
				writer.WriteLine (internal_fingerprint);
				writer.Close ();
			} else {
				StreamReader reader = new StreamReader (fingerprint_file);
				internal_fingerprint = reader.ReadLine ();
				reader.Close ();
			}

			string fingerprint;
			if (external_fingerprint != null)
				fingerprint = internal_fingerprint + "-" + external_fingerprint;
			else
				fingerprint = internal_fingerprint;

			IFileAttributesStore ifa_store;

			if (ExtendedAttribute.Supported)
				ifa_store = new FileAttributesStore_ExtendedAttribute (fingerprint);
			else
				ifa_store = new FileAttributesStore_Sqlite (storage_path, fingerprint);

			fa_store = new FileAttributesStore (ifa_store);
		}
		public FileAttributesStore_Mixed (string directory, string index_fingerprint)
		{
			store_ea = new FileAttributesStore_ExtendedAttribute (index_fingerprint);
			store_sqlite = new FileAttributesStore_Sqlite (directory, index_fingerprint);
		}