예제 #1
0
        public BasicResult SaveProgress(SaveProgressRequest request)
        {
            string jsonFile = request.JsonFile;

            try
            {
                if (!Path.IsPathRooted(jsonFile))
                {
                    jsonFile = Path.Combine(ExePath, jsonFile);
                }
                SavedProgress progress = new SavedProgress();
                progress.DiscoveredElements = _ElementsDiscovered;
                progress.WorkbenchState     = request.WorkbenchState;
                using (JsonTextWriter jsonWriter = new JsonTextWriter(new StreamWriter(jsonFile)))
                {
                    new JsonSerializer().Serialize(jsonWriter, progress);
                }
                ProgressDirty = false;
                return(new BasicResult {
                    Success = true, Exception = null
                });
            }
            catch (Exception ex)
            {
                return(new BasicResult {
                    Success = false, Exception = ex
                });
            }
        }
예제 #2
0
 public BasicResult SaveProgress(SaveProgressRequest request)
 {
     string jsonFile = request.JsonFile;
     try
     {
         if (!Path.IsPathRooted(jsonFile))
         {
             jsonFile = Path.Combine(ExePath, jsonFile);
         }
         SavedProgress progress = new SavedProgress();
         progress.DiscoveredElements = _ElementsDiscovered;
         progress.WorkbenchState = request.WorkbenchState;
         using (JsonTextWriter jsonWriter = new JsonTextWriter(new StreamWriter(jsonFile)))
         {
             new JsonSerializer().Serialize(jsonWriter, progress);
         }
         ProgressDirty = false;
         return new BasicResult { Success = true, Exception = null };
     }
     catch (Exception ex)
     {
         return new BasicResult { Success = false, Exception = ex };
     }
 }