Handle 'Access Denied' casa on importing Secrets

This commit is contained in:
Jim Norman 2006-09-22 20:29:12 +00:00
parent 818c0796dd
commit 36292f46b7
2 changed files with 28 additions and 19 deletions

View File

@ -258,7 +258,9 @@ namespace Novell.CASA.GUI
DirectoryInfo[] dirs = dirInfo.GetDirectories();
for (int i=0; i<dirs.Length; i++)
{
{
if (dirs[i].Name.StartsWith(".")) continue;
ts.AppendValues(new Gdk.Pixbuf (Common.IMAGE_PATH + "folder.png"), dirs[i].Name, "", "File folder");
}

View File

@ -58,26 +58,33 @@ namespace Novell.CASA.GUI
if (File.Exists(sFile))
{
// let's read it
FileStream fs = new FileStream(sFile, FileMode.Open);
buffer = new byte[fs.Length];
int iBytes = fs.Read(buffer, 0, (int)fs.Length);
string data = System.Text.Encoding.ASCII.GetString(buffer);
fs.Flush();
fs.Close();
// check for clear text secrets
if (data.StartsWith("<?xml"))
try
{
ImportXMLSecrets addSecrets = new ImportXMLSecrets(null, null, sFile);
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_ADD_XML_SECRETS, null, null, null, addSecrets);
CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Import complete");
// let's read it
FileStream fs = new FileStream(sFile, FileMode.Open);
buffer = new byte[fs.Length];
int iBytes = fs.Read(buffer, 0, (int)fs.Length);
string data = System.Text.Encoding.ASCII.GetString(buffer);
fs.Flush();
fs.Close();
// check for clear text secrets
if (data.StartsWith("<?xml"))
{
ImportXMLSecrets addSecrets = new ImportXMLSecrets(null, null, sFile);
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_ADD_XML_SECRETS, null, null, null, addSecrets);
CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Import complete");
}
else
{
GetMasterPasswordUsedForImport();
}
}
else
{
GetMasterPasswordUsedForImport();
catch (Exception e)
{
CommonGUI.DisplayMessage(Gtk.MessageType.Error, e.Message);
}
}
}