/// <summary>
 /// Save the contents of the TextBox into the specified file. If doing the save on the same file, we need to
 /// suspend notifications for file changes during the save operation.
 /// </summary>
 /// <param name="pszFilename">Pointer to the file name. If the pszFilename parameter is a null reference
 /// we need to save using the current file.
 /// </param>
 /// <param name="remember">Boolean value that indicates whether the pszFileName parameter is to be used
 /// as the current working file.
 /// If remember != 0, pszFileName needs to be made the current file and the dirty flag needs to be cleared after the save.
 ///                   Also, file notifications need to be enabled for the new file and disabled for the old file
 /// If remember == 0, this save operation is a Save a Copy As operation. In this case,
 ///                   the current file is unchanged and dirty flag is not cleared.
 /// </param>
 /// <param name="nFormatIndex">Zero based index into the list of formats that indicates the format in which
 /// the file will be saved.</param>
 /// <returns>S_OK if the method succeeds.</returns>
 int IPersistFileFormat.Save(string pszFilename, int fRemember, uint nFormatIndex)
 {
     // switch into the NoScribble mode
     noScribbleMode = true;
     try
     {
         // If file is null or same --> SAVE
         if (pszFilename == null || pszFilename == fileName)
         {
             editorControl.SaveFile(fileName, RichTextBoxStreamType.PlainText);
             isDirty = false;
         }
         else
         {// If remember --> SaveAs
             if (fRemember != 0)
             {
                 fileName = pszFilename;
                 editorControl.SaveFile(fileName, RichTextBoxStreamType.PlainText);
                 isDirty = false;
             }
             else // Else, Save a Copy As
             {
                 editorControl.SaveFile(pszFilename, RichTextBoxStreamType.PlainText);
             }
         }
     }catch (Exception)
     {
         throw;
     }
     finally
     {
         // switch into the Normal mode
         noScribbleMode = false;
     }
     return(VSConstants.S_OK);
 }