本文整理汇总了C#中IStorage.SetPath方法的典型用法代码示例。如果您正苦于以下问题:C# IStorage.SetPath方法的具体用法?C# IStorage.SetPath怎么用?C# IStorage.SetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStorage
的用法示例。
在下文中一共展示了IStorage.SetPath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
var current_dir = Directory.GetCurrentDirectory ();
serverStorageDir = Path.Combine (current_dir, "../../syncserver/");
serverStorage = new DiskStorage ();
serverStorage.SetPath (serverStorageDir);
serverEngine = new Engine (serverStorage);
manifest = new SyncManifest ();
syncServer = new FilesystemSyncServer (serverEngine, manifest);
CreateSomeSampleNotes ();
}
示例2: DirectoryBasedNoteRepository
public DirectoryBasedNoteRepository(string username, string notes_base_path)
{
this.Username = username;
this.notesBasePath = notes_base_path;
lock (userLocks) {
if (!userLocks.ContainsKey (Username))
userLocks [Username] = new Semaphore (1, 10);
}
// if another instance for this user exists, wait until it is freed
userLocks [username].WaitOne ();
storagePath = this.notesBasePath + "/" + Username;
if (!Directory.Exists (storagePath)) {
Directory.CreateDirectory (storagePath);
}
storage = new DiskStorage ();
storage.SetPath (storagePath);
Engine = new Engine (storage);
// read in data from "manifest" file
manifestPath = Path.Combine (storagePath, "manifest.xml");
if (File.Exists (manifestPath)) {
string manifest_xml = File.ReadAllText (manifestPath);
var textreader = new StringReader (manifest_xml);
var xmlreader = new XmlTextReader (textreader);
Manifest = SyncManifest.Read (xmlreader);
} else {
Manifest = new SyncManifest ();
Manifest.ServerId = Guid.NewGuid ().ToString ();
}
}
示例3: InitClientTwo
protected virtual void InitClientTwo()
{
clientManifestTwo = new SyncManifest ();
clientStorageTwo = new DiskStorage ();
clientStorageTwo.SetPath (clientStorageDirTwo);
clientEngineTwo = new Engine (clientStorageTwo);
syncClientTwo = new FilesystemSyncClient (clientEngineTwo, clientManifestTwo);
}
示例4: InitClientOne
protected virtual void InitClientOne()
{
clientStorageOne = new DiskStorage ();
clientStorageOne.SetPath (clientStorageDirOne);
clientEngineOne = new Engine (clientStorageOne);
clientManifestOne = new SyncManifest ();
syncClientOne = new FilesystemSyncClient (clientEngineOne, clientManifestOne);
}
示例5: ClearClientTwo
protected void ClearClientTwo(bool reset = false)
{
if (reset) {
clientManifestTwo = new SyncManifest ();
CleanupClientDirectoryTwo ();
}
clientStorageTwo = new DiskStorage ();
clientStorageTwo.SetPath (clientStorageDirTwo);
clientEngineTwo = new Engine (clientStorageTwo);
syncClientTwo = new FilesystemSyncClient (clientEngineTwo, clientManifestTwo);
}
示例6: ClearClientOne
// forces re-readin from disk, and will make sure a client does not hold
// Notes which are equal by reference as the server when using FilesystemSync
protected void ClearClientOne(bool reset = false)
{
if (reset) {
clientManifestOne = new SyncManifest ();
CleanupClientDirectoryOne ();
}
clientStorageOne = new DiskStorage ();
clientStorageOne.SetPath (clientStorageDirOne);
clientEngineOne = new Engine (clientStorageOne);
syncClientOne = new FilesystemSyncClient (clientEngineOne, clientManifestOne);
}
示例7: InitServer
private void InitServer()
{
serverStorage = new DiskStorage ();
serverStorage.SetPath (serverStorageDir);
serverEngine = new Engine (serverStorage);
serverManifest = new SyncManifest ();
syncServer = new FilesystemSyncServer (serverEngine, serverManifest);
}
示例8: ClearServer
protected override void ClearServer(bool reset = false)
{
if (reset) {
serverManifest = new SyncManifest ();
CleanupServerDirectory ();
}
serverStorage = new DiskStorage ();
serverStorage.SetPath (serverStorageDir);
serverEngine = new Engine (serverStorage);
syncServer = new FilesystemSyncServer (serverEngine, serverManifest);
}