コード例 #1
0
ファイル: ClientTraceListener.cs プロジェクト: afrog33k/eAd
    /// <summary>
    /// Capture the XMDS call and see if it went well
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    void XmdsSubmitLogCompleted(object sender, SubmitLogCompletedEventArgs e)
    {
        _xmdsProcessing = false;

        // Test if we succeeded or not
        if (e.Error != null)
        {
            // We had an error, log it.
            System.Diagnostics.Trace.WriteLine(new LogMessage("_xmds_SubmitLogCompleted", String.Format("Error during Submit to XMDS {0}", e.Error.Message)), LogType.Error.ToString());

            // Dump the stats to a file instead
            if (!String.IsNullOrEmpty(_lastSubmit))
            {
                try
                {
                    // Open the Text Writer
                    StreamWriter tw = new StreamWriter(File.Open(_logPath, FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8);

                    try
                    {
                        tw.Write(_lastSubmit);
                    }
                    catch {}
                    finally
                    {
                        tw.Close();
                        tw.Dispose();
                    }
                }
                catch (Exception)
                {}
            }
        }

        // Clear the last sumbit
        _lastSubmit = "";
    }
コード例 #2
0
ファイル: ClientTraceListener.cs プロジェクト: afrog33k/eAd
 private void XmdsSubmitLogCompleted(object sender, SubmitLogCompletedEventArgs e)
 {
     this._xmdsProcessing = false;
     if (e.Error != null)
     {
         Trace.WriteLine(new LogMessage("_xmds_SubmitLogCompleted", string.Format("Error during Submit to XMDS {0}", e.Error.Message)), LogType.Error.ToString());
         if (!string.IsNullOrEmpty(this._lastSubmit))
         {
             try
             {
                 StreamWriter writer = new StreamWriter(File.Open(this._logPath, FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8);
                 try
                 {
                     writer.Write(this._lastSubmit);
                 }
                 catch
                 {
                 }
                 finally
                 {
                     writer.Close();
                     writer.Dispose();
                 }
             }
             catch (Exception)
             {
             }
         }
     }
     this._lastSubmit = "";
 }