Improve FileWatcher functionality.

This commit is contained in:
Jim Norman 2006-07-12 15:23:09 +00:00
parent 0408acc206
commit 9fd0d5b8f0
5 changed files with 28 additions and 11 deletions

View File

@ -730,14 +730,26 @@ namespace sscs.cache
byte[] baPasscode = CASACrypto.GetMasterPasscodeUsingMasterPasswd(sCurrentPWD, sMasterFilePath, false);
if (baPasscode != null)
{
mpWatcher.pauseWatcher();
PauseFileWatcher();
CASACrypto.EncryptAndStoreMasterPasscodeUsingString(baPasscode, sNewPWD, sMasterFilePath);
mpWatcher.resumeWatcher();
ResumeFileWatcher();
return true;
}
return false;
}
internal void PauseFileWatcher()
{
if (mpWatcher != null)
mpWatcher.pauseWatcher();
}
internal void ResumeFileWatcher()
{
if (mpWatcher != null)
mpWatcher.resumeWatcher();
}
internal string GetDesktopPasswd()
{
try

View File

@ -432,9 +432,8 @@ namespace sscs.crypto
CryptoStream csEncrypt = null;
try
{
// NOTE: removed the delete call because the MPFileWatcher would replace it.
//if(File.Exists(fileName))
// File.Delete(fileName);
if(File.Exists(fileName))
File.Delete(fileName);
byte[] baKey = Generate16ByteKeyFromString(passwd, null, false);
//Get an encryptor.
@ -668,9 +667,8 @@ namespace sscs.crypto
try
{
// NOTE: removed the delete call because the MPFileWatcher would replace it.
//if (File.Exists(sFileName + ".IV"))
// File.Delete(sFileName + ".IV");
if (File.Exists(sFileName + ".IV"))
File.Delete(sFileName + ".IV");
// now save this
FileStream fs = new FileStream(sFileName + ".IV", FileMode.Create);

View File

@ -122,6 +122,7 @@ namespace sscs.verbs
{
SecretStore ssStore = SessionManager.CreateUserSession(userId);
ssStore.PauseFileWatcher();
try
{
@ -230,7 +231,7 @@ namespace sscs.verbs
wo.SetError(constants.RetCodes.FAILURE, e.ToString());
}
ssStore.ResumeFileWatcher();
return wo;
}

View File

@ -87,10 +87,12 @@ namespace sscs.verbs
{
SecretStore ssStore = null;
ssStore = SessionManager.GetUserSecretStore(userId);
ssStore.PauseFileWatcher();
if(ssStore.SetMasterPasscode(passcode))
retCode = IPCRetCodes.SSCS_REPLY_SUCCESS;
else
retCode = IPCRetCodes.SSCS_E_SETTING_PASSCODE_FAILED;
ssStore.ResumeFileWatcher();
}
catch(UserNotInSessionException)
{

View File

@ -95,10 +95,14 @@ namespace sscs.verbs
{
SecretStore ssStore = null;
ssStore = SessionManager.GetUserSecretStore(userId);
ssStore.PauseFileWatcher();
if(ssStore.SetMasterPassword(passwd))
retCode = IPCRetCodes.SSCS_REPLY_SUCCESS;
else
retCode = IPCRetCodes.SSCS_E_SETTING_PASSCODE_FAILED;
ssStore.ResumeFileWatcher();
}
catch(UserNotInSessionException)
{