Steamworks.SteamRemoteStorage.FileWrite C# (CSharp) Method

FileWrite() public static method

NOTE

Filenames are case-insensitive, and will be converted to lowercase automatically.

So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then

iterate the files, the filename returned will be "foo.bar".

file operations

public static FileWrite ( string pchFile, byte pvData, int cubData ) : bool
pchFile string
pvData byte
cubData int
return bool
		public static bool FileWrite(string pchFile, byte[] pvData, int cubData) {
			InteropHelp.TestIfAvailableClient();
			using (var pchFile2 = new InteropHelp.UTF8StringHandle(pchFile)) {
				return NativeMethods.ISteamRemoteStorage_FileWrite(pchFile2, pvData, cubData);
			}
		}

Usage Example

        public void FileWrite()
        {
            var rand     = new Random();
            var testFile = new byte[1024 * 1024 * 100];

            for (int i = 0; i < testFile.Length; i++)
            {
                testFile[i] = (byte)i;
            }

            var written = SteamRemoteStorage.FileWrite("testfile", testFile);

            Assert.IsTrue(written);
            Assert.IsTrue(SteamRemoteStorage.FileExists("testfile"));
            Assert.AreEqual(SteamRemoteStorage.FileSize("testfile"), testFile.Length);
        }