/*========================================================================================================================== | METHOD: SET GROUPS (ASYNCHRONOUS) \-------------------------------------------------------------------------------------------------------------------------*/ /// <summary> /// Saves a list of groups that the current application is configured to use. /// </summary> /// <param name="groups"> /// An optional collection of groups to save. If left empty, the <see cref="ArchiveManager.Groups"/> collection is /// assumed. /// </param> public async override Task SetGroupsAsync(FacebookGroupCollection groups = null) { var groupConfigPath = HttpContext.Current.Server.MapPath(ArchiveManager.Configuration.StorageDirectory + "/Groups.json"); byte[] encodedText = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ArchiveManager.Groups)); using (FileStream sourceStream = new FileStream( groupConfigPath, FileMode.Create, FileAccess.Write, FileShare.None, bufferSize: 4096, useAsync: true )) { await sourceStream.WriteAsync(encodedText, 0, encodedText.Length); } }
/*========================================================================================================================== | METHOD: SET GROUPS \-------------------------------------------------------------------------------------------------------------------------*/ /// <summary> /// Saves a list of groups that the current application is configured to use. /// </summary> /// <param name="groups"> /// An optional collection of groups to save. If left empty, the <see cref="ArchiveManager.Groups"/> collection is /// assumed. /// </param> public abstract Task SetGroupsAsync(FacebookGroupCollection groups = null);