Exemple #1
0
        /// <summary>
        /// Saves the project to the current file
        /// </summary>
        /// <param name="provider">Instance of the current IO provider</param>
        public Task Save(IFileSystem provider)
        {
            var file = new ProjectFile
            {
                FileFormat = ProjectFile.CurrentVersion,
                AssemblyQualifiedTypeName = GetType().AssemblyQualifiedName,
                Name             = this.Name,
                InternalSettings = this.Settings.Serialize(),
                Items            = new Dictionary <string, ItemValue>()
            };

            // Create the item dictionary for the file
            foreach (var item in Items)
            {
                if (item.Value == null)
                {
                    // Directory
                    file.Items.Add(FixPath(item.Key), null);
                }
                else
                {
                    // Item
                    file.Items.Add(FixPath(item.Key), GetSaveItemValue(item.Key));
                }
            }

            Json.SerializeToFile(this.Filename, file, provider);
            FileSaved?.Invoke(this, new EventArgs());
            return(Task.CompletedTask);
        }
Exemple #2
0
 protected void OnFileSaved(EventArgs e)
 {
     if (FileSaved != null)
     {
         FileSaved.Invoke(this, e);
     }
 }
Exemple #3
0
 public virtual Task Save(string filename, IFileSystem provider)
 {
     provider.WriteAllText(filename, Contents);
     this.Filename = filename;
     FileSaved?.Invoke(this, new EventArgs());
     return(Task.CompletedTask);
 }
Exemple #4
0
 public void OnFileSaved(string contents, string currentFileName)
 {
     FileSaved?.Invoke(this, new FileSavedEventArgs
     {
         Contents = contents,
         FilePath = currentFileName
     });
 }
Exemple #5
0
        private async Task SaveInnerAsync()
        {
            SavingFile?.Invoke(this, new EventArgs());
            await JsonFile.SaveAsync(Filename, Document, UpdateSerializerSettingsOnSave);

            Controls.IsDirty = false;
            FileSaved?.Invoke(this, new EventArgs());
        }
Exemple #6
0
 public void SafeFileAs(string fileType, string filePath)
 {
     m_LogService.Debug("SafeFileAs fileType:" + fileType + " filePath:" + filePath);
     if (IniFiles.ContainsKey(fileType))
     {
         IniFiles[fileType].Save(filePath);
     }
     if (FileSaved != null)
     {
         FileSaved.Invoke(this, new SettingChangedEventArgs(fileType, filePath));
     }
 }
        public async Task Save(string filename, IFileSystem provider)
        {
            var toSave = new BitBlockFile();

            // matix2267's convention adds 6 bits to the beginning of a file so that the name will be byte-aligned
            for (int i = 1; i <= 8 - (BitLength % 8); i++)
            {
                toSave.Bits.Bits.Add(false);
            }

            toSave.Bits.Bits.AddRange(GetQuicksavePokemonBits());
            await toSave.Save(filename, provider);

            FileSaved?.Invoke(this, new EventArgs());
        }
Exemple #8
0
        public virtual async Task Save(string filename, IFileSystem provider)
        {
            PreSave();
            var buffer = new byte[(int)Math.Ceiling(Bits.Count / (decimal)8) - 1];

            using (var f = new GenericFile())
            {
                f.CreateFile(buffer);
                for (int i = 0; i < buffer.Length; i++)
                {
                    await f.WriteAsync(i, (byte)Bits.GetInt(i, 0, 8));
                }
                await f.Save(filename, provider);
            }
            FileSaved?.Invoke(this, new EventArgs());
        }
Exemple #9
0
 public static void SaveFile()
 {
     FileSaved?.Invoke();
 }
Exemple #10
0
 /// <summary>
 /// Saves the settings to the original settings file
 /// </summary>
 public Task Save(IFileSystem provider)
 {
     provider.WriteAllText(Filename, Serialize());
     FileSaved?.Invoke(this, new EventArgs());
     return(Task.CompletedTask);
 }
Exemple #11
0
 /// <summary>
 /// The OnFileSaved
 /// </summary>
 /// <param name="e">The e<see cref="EventArgs"/></param>
 protected virtual void OnFileSaved(EventArgs e)
 {
     FileSaved?.Invoke(this, e);
 }
Exemple #12
0
        public async Task SaveFileAsync(string contents, bool isDirty, string path = null)
        {
            await filePersistence.SaveAsync(contents, path);

            FileSaved?.Invoke(this, new FileOperationEventArgs(path, contents, isDirty));
        }
Exemple #13
0
 public static void ReturnSaveResult(StorageFile file, string content)
 {
     FileSaved?.Invoke(null, new KeyValuePair <StorageFile, string>(file, content));
 }
 private void OnFileSaved(object sender, FileSavedArgs e)
 {
     FileSaved?.Invoke(this, e);
 }
 private void OnFileSaved()
 {
     Log.Info("File saved successfully.");
     FileSaved?.Invoke(this, EventArgs.Empty);
 }