FileStore.FileStore.WriteFile C# (CSharp) Method

WriteFile() public method

Stores the data contained in the given file into the file.
public WriteFile ( StoreFile file, string dataPath, StoreMode storeMode ) : bool
file StoreFile The file in which to store the data.
dataPath string
storeMode StoreMode
return bool
        public bool WriteFile(StoreFile file, string dataPath, StoreMode storeMode)
        {
            if(file == null || dataPath == null) {
                throw new ArgumentNullException("file");
            }

            if(File.Exists(dataPath)) {
                try {
                    byte[] buffer = File.ReadAllBytes(dataPath);
                    SetFileData(file, buffer, storeMode);
                }
                catch {
                    file.ResetData();
                    return false;
                }
            }

            return true;
        }

Same methods

FileStore::WriteFile ( StoreFile file, Stream stream, StoreMode storeMode ) : void
FileStore::WriteFile ( StoreFile file, byte data, StoreMode storeMode ) : void