System.IO.File.WriteAllBytes C# (CSharp) Méthode

WriteAllBytes() private méthode

private WriteAllBytes ( String path, byte bytes ) : void
path String
bytes byte
Résultat void
        public static void WriteAllBytes(String path, byte[] bytes)
        {
            if (path == null)
                throw new ArgumentNullException(nameof(path), SR.ArgumentNull_Path);
            if (path.Length == 0)
                throw new ArgumentException(SR.Argument_EmptyPath, nameof(path));
            if (bytes == null)
                throw new ArgumentNullException(nameof(bytes));
            Contract.EndContractBlock();

            InternalWriteAllBytes(path, bytes);
        }

Same methods

File::WriteAllBytes ( string path, byte bytes ) : void

Usage Example

    void OnValidate()
    {
        if (!import)
        {
            return;
        }
        import = false;

        var liveRemotePath = RemotePath + @"\lives\" + liveName;
        var liveLocalPath  = LocalPath + @"\lives\" + liveName + ".json";

        string liveJson = File.ReadAllText(liveRemotePath);

        Debug.Log(liveJson);
        File.WriteAllText(liveLocalPath, liveJson);

        var live = JsonUtility.FromJson <ApiLiveResponse>(liveJson).content;

        Debug.Log(live.live_name);

        var    mapRemotePath = RemotePath + @"\maps\" + live.map_path;
        var    mapLocalPath  = LocalPath + @"\maps\" + live.map_path;
        string mapJson       = ApiLiveMap.Transform(File.ReadAllText(mapRemotePath));

        File.WriteAllText(mapLocalPath, mapJson);

        var bgmRemotePath = RemotePath + @"\bgms\" + live.bgm_path;
        var bgmLocalPath  = LocalPath + @"\bgms\" + live.bgm_path;

        byte[] bgmBytes = File.ReadAllBytes(bgmRemotePath);
        File.WriteAllBytes(bgmLocalPath, bgmBytes);
    }
All Usage Examples Of System.IO.File::WriteAllBytes