20 namespace Lucene.Net.Store
39 private System.Collections.Generic.HashSet<
string> primaryExtensions;
41 private bool isDisposed;
48 this.primaryExtensions = primaryExtensions;
49 this.primaryDir = primaryDir;
50 this.secondaryDir = secondaryDir;
51 this.doClose = doClose;
58 get {
return primaryDir; }
64 get {
return secondaryDir; }
67 protected override void Dispose(
bool disposing)
69 if (isDisposed)
return;
75 if (secondaryDir != null)
82 if (primaryDir != null)
95 public override System.String[] ListAll()
97 var files =
new System.Collections.Generic.List<
string>();
98 files.AddRange(primaryDir.ListAll());
99 files.AddRange(secondaryDir.ListAll());
100 return files.ToArray();
104 public static System.String GetExtension(System.String name)
106 int i = name.LastIndexOf(
'.');
111 return name.Substring(i + 1, (name.Length) - (i + 1));
114 private Directory GetDirectory(System.String name)
116 System.String ext = GetExtension(name);
117 if (primaryExtensions.Contains(ext))
127 public override bool FileExists(System.String name)
129 return GetDirectory(name).FileExists(name);
132 public override long FileModified(System.String name)
134 return GetDirectory(name).FileModified(name);
137 public override void TouchFile(System.String name)
139 GetDirectory(name).TouchFile(name);
142 public override void DeleteFile(System.String name)
144 GetDirectory(name).DeleteFile(name);
147 public override long FileLength(System.String name)
149 return GetDirectory(name).FileLength(name);
154 return GetDirectory(name).CreateOutput(name);
157 public override void Sync(System.String name)
159 GetDirectory(name).Sync(name);
164 return GetDirectory(name).OpenInput(name);