1
0

Indetation formatting and unnecessary usings cleanup

This commit is contained in:
Michael Gordeev
2020-05-10 13:47:42 +03:00
parent f968c95ab1
commit 1d636120cc
20 changed files with 684 additions and 702 deletions
+43 -43
View File
@@ -6,52 +6,52 @@ using YoutubeExplode;
namespace YouTube.Resources
{
public class CaptionsResource : Google.Apis.YouTube.v3.CaptionsResource
{
IClientService Service { get; }
public CaptionsResource(IClientService service) : base(service) =>
Service = service;
public class CaptionsResource : Google.Apis.YouTube.v3.CaptionsResource
{
IClientService Service { get; }
public CaptionsResource(IClientService service) : base(service) =>
Service = service;
public LoadRequest Load(ClosedCaptionInfo captionInfo) =>
new LoadRequest(Service, captionInfo);
public LoadRequest Load(ClosedCaptionInfo captionInfo) =>
new LoadRequest(Service, captionInfo);
public class LoadRequest
{
public ClosedCaptionInfo CaptionInfo { get; set; }
IClientService Service { get; set; }
public class LoadRequest
{
public ClosedCaptionInfo CaptionInfo { get; set; }
IClientService Service { get; set; }
public LoadRequest(IClientService service, ClosedCaptionInfo captionInfo)
{
CaptionInfo = captionInfo;
Service = service;
}
public LoadRequest(IClientService service, ClosedCaptionInfo captionInfo)
{
CaptionInfo = captionInfo;
Service = service;
}
public async Task<ClosedCaptionTrack> ExecuteAsync()
{
YoutubeClient client = new YoutubeClient(Service.HttpClient);
var response = await client.GetClosedCaptionTrackAsync(CaptionInfo.TrackInfo);
List<ClosedCaptionTrack.ClosedCaption> captions = new List<ClosedCaptionTrack.ClosedCaption>();
foreach (var i in response.Captions)
captions.Add(new ClosedCaptionTrack.ClosedCaption
{
Offset = i.Offset,
Duration = i.Duration,
Content = i.Text
});
public async Task<ClosedCaptionTrack> ExecuteAsync()
{
YoutubeClient client = new YoutubeClient(Service.HttpClient);
var response = await client.GetClosedCaptionTrackAsync(CaptionInfo.TrackInfo);
List<ClosedCaptionTrack.ClosedCaption> captions = new List<ClosedCaptionTrack.ClosedCaption>();
foreach (var i in response.Captions)
captions.Add(new ClosedCaptionTrack.ClosedCaption
{
Offset = i.Offset,
Duration = i.Duration,
Content = i.Text
});
return new ClosedCaptionTrack
{
Info = CaptionInfo,
Captions = captions.AsReadOnly()
};
}
return new ClosedCaptionTrack
{
Info = CaptionInfo,
Captions = captions.AsReadOnly()
};
}
public ClosedCaptionTrack Execute()
{
Task<ClosedCaptionTrack> task = ExecuteAsync();
task.Wait();
return task.Result;
}
}
}
}
public ClosedCaptionTrack Execute()
{
Task<ClosedCaptionTrack> task = ExecuteAsync();
task.Wait();
return task.Result;
}
}
}
}