我知道我们可以使用 WPConnect 工具从 WP7 设备获取离线日志。但是我忘记了命令,也忘记了我学习它的站点地址。有谁知道这些命令是什么。我有以下代码来记录脱机异常,但我不知道如何检索日志文件。请帮忙。
#region Offline Error Logger
/// <summary>
/// Logs Exception for the app when the device is not connected to the PC.This file can later be retrieved for the purpose of Bug fixing
/// </summary>
/// <param name="strMsg">Exception message</param>
private static void LogOffline(string strMsg)
{
如果 LOG_ENABLED
try
{
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
string dirName = "SOSLog";
string logFileName = "SOSLog.txt";
string fullLogFileName = System.IO.Path.Combine(dirName, logFileName);
// TODO: Synchronize this method with MainPage using Mutex
string directoryName = System.IO.Path.GetDirectoryName(fullLogFileName);
if (!string.IsNullOrEmpty(directoryName) && !myIsolatedStorage.DirectoryExists(directoryName))
{
myIsolatedStorage.CreateDirectory(directoryName);
Debug.WriteLine("Created directory");
}
if (myIsolatedStorage.FileExists(fullLogFileName))
{
using (IsolatedStorageFileStream fileStream =
myIsolatedStorage.OpenFile(fullLogFileName, FileMode.Append, FileAccess.Write))
{
using (StreamWriter writer = new StreamWriter(fileStream))
{
writer.WriteLine(strMsg);
writer.Close();
}
}
}
else
{
using (IsolatedStorageFileStream fileStream =
myIsolatedStorage.OpenFile(fullLogFileName, FileMode.Create, FileAccess.Write))
{
using (StreamWriter writer = new StreamWriter(fileStream))
{
writer.WriteLine(strMsg);
writer.Close();
}
}
}
}
}
catch (Exception ex)
{
Debug.WriteLine("Exception while logging: " + ex.StackTrace);
}
万一
}
#endregion