public static void Save()
        {
            var sb = new StringBuilder();

            sb.AppendFormat("{{\n\t\"name\" : \"{0}\",\n\t\"serverurl\" : \"{1}\",\n\t\"processid\" : {2},\n\t", Name, ServerURL, ProcessId);
            sb.AppendFormat("\"opendocuments\" : [{0}]\n}}", string.Join(",", OpenDocuments.Select(d => "\"" + d + "\"").ToArray()));
            File.WriteAllText(FilePath, sb.ToString());
        }
Esempio n. 2
0
 /// <summary>
 /// Closes all opened files but the specified one.
 /// </summary>
 /// <param name="filePath">File, which should remain opened.</param>
 private void CloseAllFilesButThis(string filePath)
 {
     if (CanCloseAllFilesButThis(filePath))
     {
         foreach (var filePathOfDocumentToClose in OpenDocuments.Select(openDocument => openDocument.FilePath).Where(openDocumentFilePath => !openDocumentFilePath.Equals(filePath, StringComparison.OrdinalIgnoreCase)).ToArray())
         {
             CloseDocument(filePathOfDocumentToClose);
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Closes all opened files.
 /// </summary>
 /// <param name="filePath"></param>
 private void CloseAllFiles(string filePath)
 {
     if (CanCloseAllFiles(filePath))
     {
         foreach (var filePathOfDocumentToClose in OpenDocuments.Select(openDocument => openDocument.FilePath).ToArray())
         {
             CloseDocument(filePathOfDocumentToClose);
         }
     }
 }
Esempio n. 4
0
 private async Task SaveFileTokensAsync()
 {
     await Settings.SaveFileTokensAsync(OpenDocuments.Select(i => i.Token));
 }