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

WriteAllBytes() public static méthode

public static WriteAllBytes ( string path, byte bytes ) : void
path string
bytes byte
Résultat void
        public static void WriteAllBytes(string path, byte[] bytes) { }
        public static void WriteAllLines(string path, string[] contents) { }

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