get webserver

This commit is contained in:
Demetria Lovato 2021-06-25 01:30:45 -07:00
parent 15340aab60
commit db8519d2ec
377 changed files with 921426 additions and 25556 deletions

Binary file not shown.

View File

@ -21,6 +21,10 @@
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -1,4 +1,5 @@
using CommandLine;
using System.Linq;
using SimpleHttp;
using System;
using System.Collections.Generic;
using System.IO;
@ -8,301 +9,116 @@ using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading;
using TessesYoutubeDownloader.Server.Models;
using Newtonsoft.Json;
namespace youtube_downloader
{
class Program
{
public static string[] ArgsFromString(string s)
{
List<string> s2 = new List<string>();
StringBuilder b = new StringBuilder();
bool inQuote=false;
foreach(var c in s)
{
if(c == '\"')
{
inQuote = !inQuote;
continue;
}
if(c == ' ')
{
if (!inQuote)
{
if (b.Length > 0)
{
s2.Add(b.ToString());
b.Clear();
}
continue;
}
}
b.Append(c);
}
if (b.Length > 0)
{
s2.Add(b.ToString());
b.Clear();
}
return s2.ToArray();
}
static void Main(string[] args)
static void Main()
{
Thread t = new Thread(new ThreadStart(() => {
Server.Functions.Downloader.DL.DownloadThread().GetAwaiter().GetResult();
}));
t.Start();
Thread t2 = new Thread(new ThreadStart(() => {
Server.Functions.Downloader.DL.ListenForQueueItem().GetAwaiter().GetResult();
}));
t2.Start();
// we need to get our app name so that
// we can create unique names for our mutex and our pipe
do
string webSitePath = Server.Functions.Downloader.DL.GetPath(true, "WebSite");
Route.Add("/", (rq, rp,args) =>
{
Console.Write("> ");
var a2 = ArgsFromString(Console.ReadLine());
_ProcessCommandLine(a2);
} while (true);
rp.AsFile(rq, Path.Combine(webSitePath, "index.html"));
});
Route.Add("/api/Storage/GetDirectories/{Path}", (rq, rp, args) =>
{
string path = Server.Functions.Downloader.DL.GetPath(true, args["Path"]);
if (Directory.Exists(path))
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(Directory.EnumerateDirectories(path).Select<string, string>((o) => { return Path.GetFileName(o); }));
rp.AsText(json, "application/json");
}
else
{
rp.AsText("[]", "application/json");
}
});
Route.Add("/api/Storage/GetFiles/{Path}", (rq, rp, args) =>
{
string path = Server.Functions.Downloader.DL.GetPath(true, args["Path"]);
if (Directory.Exists(path))
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(Directory.EnumerateFiles(path).Select<string, string>((o) => { return Path.GetFileName(o); }));
rp.AsText(json, "application/json");
}
else
{
rp.AsText("[]", "application/json");
}
});
Route.Add("/api/Storage/FileExists/{Path}", (rq, rp, args) =>
{
string path = Server.Functions.Downloader.DL.GetPath(true, args["Path"]);
string json = File.Exists(path) ? "true" : "false";
rp.AsText(json, "text/plain");
});
Route.Add("/api/Storage/DirectoryExists/{Path}", (rq, rp, args) =>
{
string path = Server.Functions.Downloader.DL.GetPath(true, args["Path"]);
string json = Directory.Exists(path) ? "true" : "false";
rp.AsText(json, "text/plain");
});
Route.Add("/api/Storage/File/{Path}", (rq, rp, args) =>
{
string path = Server.Functions.Downloader.DL.GetPath(true, args["Path"]);
rp.AsFile(rq, path);
});
Route.Add("/api/Add/{Id}", (rq, rp, args) =>
{
Server.Functions.Downloader.Download(System.Web.HttpUtility.UrlDecode(args["Id"]));
rp.AsRedirect("/");
});
Route.Add("/api/AddRes/{R}/{Id}", (rq, rp, args) =>
{
Server.Functions.Downloader.Download(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"]));
rp.AsRedirect("/");
});
Route.Add("/api/QueueMove/{From}/{To}", (rq, rp, args) =>
{
Server.Functions.Downloader.ModQueue(args["To"],args["From"]);
rp.AsRedirect("/");
});
Route.Add("/api/QueueList", (rq, rp, args) =>
{
string json = Server.Functions.Downloader.GetQueue();
rp.AsText(json, "application/json");
});
Route.Add("/api/Progress", (rq, rp, args) =>
{
string json = JsonConvert.SerializeObject(Server.Functions.Downloader.GetProgress());
rp.AsText(json, "application/json");
});
Route.Add("/{Path}", (rq, rp, args) =>
{
string path = Path.Combine(webSitePath, args["Path"]);
rp.AsFile(rq, path);
});
HttpServer.ListenAsync(80, CancellationToken.None, Route.OnHttpRequestAsync).Wait();
}
[Verb("exit", HelpText = "Download Video")]
public class ExitApp
{
}
[Verb("video", true, HelpText = "Download Video")]
public class DownloadVideo
{
[Value(0, Required = true, HelpText = "The id or url of video")]
public string Id { get; set; }
[Option('f', "format", Default = Resolution.NoConvert, HelpText = "possible values are (NoConvert,Convert,Audio)")]
public Resolution Format { get; set; }
}
[Verb("playlist", HelpText = "Download entire Playlist")]
public class DownloadPlaylist
{
[Value(0, Required = true, HelpText = "The id or url of playlist")]
public string Id { get; set; }
[Option('f', "format", Default = Resolution.NoConvert, HelpText = "possible values are (NoConvert,Convert,Audio)")]
public Resolution Format { get; set; }
}
[Verb("channel", HelpText = "Download entire Channel (using channel id)")]
public class DownloadChannel
{
[Value(0, Required = true, HelpText = "The id or url of channel")]
public string Id { get; set; }
[Option('f', "format", Default = Resolution.NoConvert, HelpText = "possible values are (NoConvert,Convert,Audio)")]
public Resolution Format { get; set; }
}
[Verb("redownload",HelpText = "Redownload all incomplete videos")]
public class DownloadAll
{
[Option('f', "format", Default = Resolution.NoConvert, HelpText = "possible values are (NoConvert,Convert,Audio)")]
public Resolution Resolution { get; set; }
}
[Verb("user", HelpText = "Download entire Channel (using username)")]
public class DownloadUser
{
[Value(0, Required = true, HelpText = "The name or url of the user")]
public string Id { get; set; }
[Option('f', "format", Default = Resolution.NoConvert, HelpText = "possible values are (NoConvert,Convert,Audio)")]
public Resolution Format { get; set; }
}
[Verb("move", HelpText = "Move item in queue")]
public class MoveQueue
{
[Option('d', "moveto", HelpText = "can be (up,down,top,bottom,remove)")]
public string MoveTo { get; set; }
[Option('s', "movefrom", HelpText = "Can be number (index) or \"last\"")]
public string MoveFrom { get; set; }
}
[Verb("info", HelpText = "Get info")]
public class Info
{
[Option('m', "machine", Default = false, HelpText = "In json")]
public bool ForMachine { get; set; }
[Option('p', "page", Required = true, HelpText = "can be (progress,queue,location)")]
public string Page { get; set; }
}
static void _ProcessCommandLine(string[] args)
{
CommandLine.Parser.Default.ParseArguments<DownloadVideo, DownloadPlaylist, DownloadChannel, DownloadUser, MoveQueue, Info, DownloadAll, ExitApp>(args)
.MapResult(
(DownloadVideo opts) => RunDownloadVideo(opts),
(DownloadPlaylist opts) => RunDownloadPlaylist(opts),
(DownloadChannel opts) => RunDownloadChannel(opts),
(DownloadUser opts) => RunDownloadUser(opts),
(MoveQueue opts) => RunMoveQueue(opts),
(Info opts) => RunInfo(opts),
(DownloadAll opts) => RunDownloadAll(opts),
(ExitApp opts) => RunExitApp(opts),
errs => 1); ;
}
private static int RunDownloadAll(DownloadAll opts)
{
foreach(var item in Directory.GetFiles(Server.Functions.Downloader.DL.GetPath(true, "Info"),"*.json"))
{
string id = System.IO.Path.GetFileNameWithoutExtension(item);
Server.Functions.Downloader.DownloadVideo(id, opts.Resolution);
}
return 1;
}
static void WriteVideoInfo(StringBuilder b,SavedVideo v,bool description)
{
if (v != null)
{
//v.AuthorChannelId
//v.AuthorTitle
//v.Dislikes
//v.Duration
//v.Id
//v.Keywords
//v.Likes
//v.Title
//v.UploadDate
//v.Views
//v.Description
b.AppendLine($"Title: {v.Title}");
b.AppendLine($"AuthorName: {v.AuthorTitle}");
b.AppendLine($"AuthorID: {v.AuthorChannelId}");
b.AppendLine($"Duration: {TimeSpan.FromSeconds(v.Duration).ToString()}");
b.AppendLine($"Id: {v.Id}");
b.AppendLine($"UploadDate: {v.UploadDate}");
b.AppendLine($"Views: {v.Views}, Likes: {v.Likes}, Dislikes: {v.Dislikes}");
b.AppendLine("Keywords:");
foreach (var kw in v.Keywords)
{
b.AppendLine($"\t{kw}");
}
if (description)
{
b.AppendLine("Description:");
b.AppendLine(v.Description);
}
}
}
private static int RunInfo(Info opts)
{
//if ( != null)
switch (opts.Page)
{
case "progress":
if (opts.ForMachine)
{
string jsonData = Newtonsoft.Json.JsonConvert.SerializeObject(Server.Functions.Downloader.GetProgress());
Console.WriteLine(jsonData);
}
else
{
var s=Server.Functions.Downloader.GetProgress();
if (s != null)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("=======Progress=======");
sb.AppendLine($"Progress: {s.Progress}%");
sb.AppendLine($"Size: {Math.Round((double)s.Length / (double)(1000 * 1000), 2)} MB");
sb.AppendLine();
sb.AppendLine("=======Video Info=======");
WriteVideoInfo(sb, s.Saved, false);
Console.WriteLine(sb.ToString());
}
}
break;
case "queue":
if (opts.ForMachine)
{
string jsonData = Server.Functions.Downloader.GetQueue();
Console.WriteLine(jsonData);
}
else
{
try
{
var s = Server.Functions.Downloader.GetQueueItems();
StringBuilder sb = new StringBuilder();
foreach (var item in s)
{
WriteVideoInfo(sb, item.Video, false);
sb.AppendLine();
}
Console.WriteLine(sb.ToString());
} catch (Exception ex)
{
_ = ex;
}
}
break;
case "location":
Console.WriteLine(Server.Functions.Downloader.DL.StorageLocation);
break;
}
return 1;
}
private static int RunMoveQueue(MoveQueue opts)
{
Server.Functions.Downloader.ModQueue(opts.MoveTo, opts.MoveFrom);
return 1;
}
private static int RunDownloadUser(DownloadUser opts)
{
Server.Functions.Downloader.DownloadUser(opts.Id, opts.Format);
return 1;
}
private static int RunExitApp(ExitApp opts)
{
Environment.Exit(0);
return 1;
}
private static int RunDownloadVideo(DownloadVideo opts)
{
Server.Functions.Downloader.DownloadVideo(opts.Id, opts.Format);
return 1;
}
private static int RunDownloadPlaylist(DownloadPlaylist opts)
{
Server.Functions.Downloader.DownloadPlaylist(opts.Id, opts.Format);
return 1;
}
private static int RunDownloadChannel(DownloadChannel opts)
{
Server.Functions.Downloader.DownloadChannel(opts.Id, opts.Format);
return 1;
}
}
}

View File

@ -14,6 +14,7 @@ using Newtonsoft.Json;
using YoutubeExplode.Videos.Streams;
using YoutubeExplode.Channels;
using YoutubeExplode.Playlists;
using youtube_downloader.Server.Models;
namespace youtube_downloader.Server.Functions
{
@ -24,6 +25,7 @@ namespace youtube_downloader.Server.Functions
// TessesYoutubeDownloader.Server.Functions.Downloader.DL.DownloadThread().GetAwaiter().GetResult();
}
public List<InfomationQueueItem> infoQueue = new List<InfomationQueueItem>();
public static YoutubeClient CreateYoutubeClient()
{
@ -42,12 +44,13 @@ namespace youtube_downloader.Server.Functions
return P;
}
static HttpClient Http;
YoutubeClient ytc = CreateYoutubeClient();
internal YoutubeClient ytc = CreateYoutubeClient();
static VideoDownloadProgress P=new VideoDownloadProgress();
Progress<double> DownloadP =new Progress<double>( (e)=> { P.Progress = (int)(e * 100.0); });
List<SavedVideoObject> Queue = new List<SavedVideoObject>();
public List<SavedVideoObject> Queue = new List<SavedVideoObject>();
internal static string GetQueue()
{
@ -58,7 +61,35 @@ namespace youtube_downloader.Server.Functions
}
return q;
}
public async Task ListenForQueueItem()
{
do
{
InfomationQueueItem item;
bool canAdd = false;
lock (infoQueue)
{
canAdd = infoQueue.Count > 0;
if (canAdd)
{
item = infoQueue[0];
infoQueue.RemoveAt(0);
}
else
{
item = null;
}
}
if (canAdd)
{
var items = await item.DownloadData();
if(item.DownloadActualDataAfterwards)
{
_DownloadVideos(items);
}
}
} while (true);
}
internal static void ModQueue(string mvto, string index)
{
try
@ -177,32 +208,16 @@ namespace youtube_downloader.Server.Functions
return Environment.CurrentDirectory;
}
public string StorageLocation { get { return gStorageLocation(); } }
private async Task _DownloadVideo(VideoId videoId,Resolution res)
{ string infpath= GetPath(true, "Info", videoId + ".json");
SavedVideoObject sv;
bool exist = File.Exists(videoId);
if (exist)
{
sv = new SavedVideoObject();
sv.Resolution = res;
sv.Video = Newtonsoft.Json.JsonConvert.DeserializeObject<SavedVideo>(File.ReadAllText(infpath));
}
else
{
var vinfo = await ytc.Videos.GetAsync(videoId);
sv = SavedVideo.CreateFrom(res, vinfo, _DownloadThumbnail);
}
if (!exist)
{
File.WriteAllText(infpath, JsonConvert.SerializeObject(sv.Video));
}
private void _DownloadVideos(SavedVideoObject[] items)
{
lock (Queue)
{
Queue.Insert(0,sv); //new elements get added to begining
foreach (var item in items)
{
Queue.Insert(0, item);
//new elements get added to begining
}
}
}
public async Task DownloadThread()
@ -299,7 +314,7 @@ namespace youtube_downloader.Server.Functions
}
while (true);
}
private void _DownloadThumbnail(int w,int h,string id,string tnail)
internal void _DownloadThumbnail(int w,int h,string id,string tnail)
{
try
{
@ -320,65 +335,17 @@ namespace youtube_downloader.Server.Functions
return DL.Queue;
}
private async Task _DownloadChannel(ChannelId id,Resolution res)
{
try
{
var c = await ytc.Channels.GetAsync(id);
SavedChannel c2 = SavedChannel.FromChannel(c, _DownloadThumbnail);
string infpath = GetPath(true, "Channel", id + ".json");
File.WriteAllText(infpath, JsonConvert.SerializeObject(c2));
try
{
await ytc.Channels.GetUploadsAsync(c.Id).ForEachAsync(async (v) =>
{
await _DownloadVideo(v.Id, res);
});
}
catch (Exception ex)
{
_ = ex;
}
}catch(Exception ex2)
{
_ = ex2;
}
}
private async Task _DownloadPlaylist(PlaylistId id,Resolution res)
{
SavedPlaylist pl =await SavedPlaylist.FromPlaylistId(res, ytc, id, DownloadVideo, _DownloadThumbnail);
string infpath = GetPath(true, "Playlist", id + ".json");
File.WriteAllText(infpath, JsonConvert.SerializeObject(pl));
}
private async Task _DownloadUser(UserName name, Resolution res)
{
try {
var c = await ytc.Channels.GetByUserAsync(name);
SavedChannel c2 = SavedChannel.FromChannel(c, _DownloadThumbnail);
string infpath = GetPath(true, "Channel", c.Id + ".json");
File.WriteAllText(infpath, JsonConvert.SerializeObject(c2));
try
{
await ytc.Channels.GetUploadsAsync(c.Id).ForEachAsync(async(v) =>
{
await _DownloadVideo(v.Id, res);
});
}catch(Exception ex)
{
_ = ex;
}
}catch(Exception ex2)
{
_ = ex2;
}
}
public static void DownloadVideo(string id,Resolution res)
{
VideoId? v = VideoId.TryParse(id);
if (v.HasValue)
{
DL._DownloadVideo(v.Value, res).GetAwaiter().GetResult();
InfomationQueueItem item = new InfomationQueueItem(v.Value, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
}
public static void DownloadVideo(string v)
@ -390,7 +357,11 @@ namespace youtube_downloader.Server.Functions
PlaylistId? v = PlaylistId.TryParse(id);
if (v.HasValue)
{
DL._DownloadPlaylist(v.Value, res).GetAwaiter().GetResult();
InfomationQueueItem item = new InfomationQueueItem(v.Value, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
}
public static void DownloadPlaylist(string id)
@ -402,7 +373,11 @@ namespace youtube_downloader.Server.Functions
ChannelId? v = ChannelId.TryParse(id);
if (v.HasValue)
{
DL._DownloadChannel(v.Value, res).GetAwaiter().GetResult();
InfomationQueueItem item = new InfomationQueueItem(v.Value, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
}
public static void DownloadChannel(string id)
@ -414,7 +389,59 @@ namespace youtube_downloader.Server.Functions
UserName? v=UserName.TryParse(name);
if (v.HasValue)
{
DL._DownloadUser(v.Value, res).GetAwaiter().GetResult();
InfomationQueueItem item = new InfomationQueueItem(v.Value, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
}
public static void Download(string id)
{
Download(id, Resolution.NoConvert);
}
public static void Download(string id,Resolution res)
{
VideoId? vid= VideoId.TryParse(id);
ChannelId? cid = ChannelId.Parse(id);
UserName? uid = UserName.TryParse(id);
PlaylistId? pid = PlaylistId.Parse(id);
if (pid.HasValue)
{
//Is Playlist
var v = pid.Value;
InfomationQueueItem item = new InfomationQueueItem(v, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
else if (cid.HasValue)
{
var v = cid.Value;
InfomationQueueItem item = new InfomationQueueItem(v, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
else if (vid.HasValue)
{
var v = vid.Value;
InfomationQueueItem item = new InfomationQueueItem(v, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
else
{
var v = uid.Value;
InfomationQueueItem item = new InfomationQueueItem(v, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
}
public static void DownloadUser(string name)

11
Server/Models/InfoType.cs Normal file
View File

@ -0,0 +1,11 @@
namespace youtube_downloader.Server.Models
{
public enum InfoType
{
Video=0,
Playlist=1,
Channel=2,
User=3,
ClosedCaptions=4
}
}

View File

@ -0,0 +1,244 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TessesYoutubeDownloader.Server.Models;
using YoutubeExplode.Channels;
using YoutubeExplode.Playlists;
using YoutubeExplode.Videos;
namespace youtube_downloader.Server.Models
{
public class InfomationQueueItem
{
public InfomationQueueItem(VideoId id,Resolution res,bool download = true)
{
Data = id.Value;
DownloadActualDataAfterwards = download;
Type = InfoType.Video;
this.res = res;
}
public InfomationQueueItem(PlaylistId id,Resolution res,bool download = true)
{
Data = id.Value;
DownloadActualDataAfterwards = download;
Type = InfoType.Playlist;
this.res = res;
}
public InfomationQueueItem(ChannelId id, Resolution res, bool download = true)
{
Data = id.Value;
DownloadActualDataAfterwards = download;
Type = InfoType.Channel;
this.res = res;
}
public InfomationQueueItem(UserName id, Resolution res, bool download = true)
{
Data = id.Value;
DownloadActualDataAfterwards = download;
Type = InfoType.User;
this.res = res;
}
Resolution res;
/// <summary>
/// Download it afterwards
/// </summary>
public bool DownloadActualDataAfterwards { get; set; }
/// <summary>
/// Kind
/// </summary>
public InfoType Type { get; set; }
/// <summary>
/// ID for item
/// </summary>
public string Data { get; set; }
public async Task<SavedVideoObject[]> DownloadData()
{
switch (Type)
{
case InfoType.Video:
{
string infPath = Functions.Downloader.DL.GetPath(true, "Info", Data + ".json");
SavedVideoObject sv;
bool exist = File.Exists(infPath);
if (exist)
{
sv = new SavedVideoObject();
sv.Resolution = res;
sv.Video = JsonConvert.DeserializeObject<SavedVideo>(File.ReadAllText(infPath));
}
else
{
var vinfo = await Functions.Downloader.DL.ytc.Videos.GetAsync(Data);
sv = SavedVideo.CreateFrom(res, vinfo, Functions.Downloader.DL._DownloadThumbnail);
}
if (!exist)
{
File.WriteAllText(infPath, JsonConvert.SerializeObject(sv.Video));
}
return new SavedVideoObject[] { sv };
}
case InfoType.Playlist:
{
List<string> vo = new List<string>();
SavedPlaylist pl = await SavedPlaylist.FromPlaylistId(res, Functions.Downloader.DL.ytc, Data, (e,f) => { vo.Add(e); }, Functions.Downloader.DL._DownloadThumbnail);
string infpath = Functions.Downloader.DL.GetPath(true, "Playlist", Data + ".json");
File.WriteAllText(infpath, JsonConvert.SerializeObject(pl));
List<SavedVideoObject> video2 = new List<SavedVideoObject>();
foreach(var str in vo)
{
string infPath = Functions.Downloader.DL.GetPath(true, "Info", str + ".json");
SavedVideoObject sv;
bool exist = File.Exists(infPath);
if (exist)
{
sv = new SavedVideoObject();
sv.Resolution = res;
sv.Video = JsonConvert.DeserializeObject<SavedVideo>(File.ReadAllText(infPath));
}
else
{
try
{
var vinfo = await Functions.Downloader.DL.ytc.Videos.GetAsync(str);
sv = SavedVideo.CreateFrom(res, vinfo, Functions.Downloader.DL._DownloadThumbnail);
}catch(Exception ex)
{
sv = null;
_ = ex;
}
}
if (!exist)
{
File.WriteAllText(infPath, JsonConvert.SerializeObject(sv.Video));
}
if(sv != null)
{
video2.Add(sv);
}
}
return video2.ToArray();
}
case InfoType.Channel:
{
List<SavedVideoObject> video = new List<SavedVideoObject>();
try
{
var c = Functions.Downloader.DL.ytc.Channels.GetAsync(Data).GetAwaiter().GetResult();
SavedChannel c2 = SavedChannel.FromChannel(c, Functions.Downloader.DL._DownloadThumbnail);
string infpath = Functions.Downloader.DL.GetPath(true, "Channel", Data + ".json");
File.WriteAllText(infpath, JsonConvert.SerializeObject(c2));
try
{
Functions.Downloader.DL.ytc.Channels.GetUploadsAsync(c.Id).ForEachAsync(async (v) =>
{
string infPath = Functions.Downloader.DL.GetPath(true, "Info", v.Id + ".json");
bool exist = File.Exists(infPath);
if (exist)
{
SavedVideoObject sv = new SavedVideoObject();
sv.Resolution = res;
sv.Video = JsonConvert.DeserializeObject<SavedVideo>(File.ReadAllText(infPath));
video.Add(sv);
}
else
{
try
{
var vinfo = await Functions.Downloader.DL.ytc.Videos.GetAsync(v.Id);
SavedVideoObject sv = SavedVideo.CreateFrom(res, vinfo, Functions.Downloader.DL._DownloadThumbnail);
video.Add(sv);
}
catch (Exception ex)
{
_ = ex;
}
}
}).Wait();
}
catch (Exception ex)
{
_ = ex;
}
}
catch (Exception ex2)
{
_ = ex2;
}
return video.ToArray();
}
case InfoType.User:
{
List<SavedVideoObject> video = new List<SavedVideoObject>();
try
{
var c = Functions.Downloader.DL.ytc.Channels.GetByUserAsync(Data).GetAwaiter().GetResult();
SavedChannel c2 = SavedChannel.FromChannel(c, Functions.Downloader.DL._DownloadThumbnail);
string infpath = Functions.Downloader.DL.GetPath(true, "Channel", Data + ".json");
File.WriteAllText(infpath, JsonConvert.SerializeObject(c2));
try
{
Functions.Downloader.DL.ytc.Channels.GetUploadsAsync(c.Id).ForEachAsync(async (v) =>
{
string infPath = Functions.Downloader.DL.GetPath(true, "Info", v.Id + ".json");
bool exist = File.Exists(infPath);
if (exist)
{
SavedVideoObject sv = new SavedVideoObject();
sv.Resolution = res;
sv.Video = JsonConvert.DeserializeObject<SavedVideo>(File.ReadAllText(infPath));
video.Add(sv);
}
else
{
try
{
var vinfo = await Functions.Downloader.DL.ytc.Videos.GetAsync(v.Id);
SavedVideoObject sv = SavedVideo.CreateFrom(res, vinfo, Functions.Downloader.DL._DownloadThumbnail);
video.Add(sv);
}
catch (Exception ex)
{
_ = ex;
}
}
}).Wait();
}
catch (Exception ex)
{
_ = ex;
}
}
catch (Exception ex2)
{
_ = ex2;
}
return video.ToArray();
}
}
return new SavedVideoObject[0];
}
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
bin/Debug/MimeTypesMap.dll Normal file

Binary file not shown.

BIN
bin/Debug/SimpleHTTP.dll Normal file

Binary file not shown.

415
bin/Debug/SimpleHTTP.xml Normal file
View File

@ -0,0 +1,415 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>SimpleHTTP</name>
</assembly>
<members>
<member name="T:SimpleHttp.RequestExtensions">
<summary>
Class containing <see cref="T:System.Net.HttpListenerRequest"/> extensions.
</summary>
</member>
<member name="M:SimpleHttp.RequestExtensions.ParseBody(System.Net.HttpListenerRequest,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Parses body of the request including form and multi-part form data.
</summary>
<param name="request">HTTP request.</param>
<param name="args">Key-value pairs populated by the form data by this function.</param>
<returns>Name-file pair collection.</returns>
</member>
<member name="M:SimpleHttp.RequestExtensions.ParseBody(System.Net.HttpListenerRequest,System.Collections.Generic.Dictionary{System.String,System.String},SimpleHttp.OnFile)">
<summary>
Parses body of the request including form and multi-part form data.
</summary>
<param name="request">HTTP request.</param>
<param name="args">Key-value pairs populated by the form data by this function.</param>
<param name="onFile">
Function called if a file is about to be parsed. The stream is attached to a corresponding <see cref="T:SimpleHttp.HttpFile"/>.
<para>By default, <see cref="T:System.IO.MemoryStream"/> is used, but for large files, it is recommended to open <see cref="T:System.IO.FileStream"/> directly.</para>
</param>
<returns>Name-file pair collection.</returns>
</member>
<member name="T:SimpleHttp.OnFile">
<summary>
Delegate executed when a file is about to be read from a body stream.
</summary>
<param name="fieldName">Field name.</param>
<param name="fileName">name of the file.</param>
<param name="contentType">Content type.</param>
<returns>Stream to be populated.</returns>
</member>
<member name="T:SimpleHttp.HttpFile">
<summary>
HTTP file data container.
</summary>
</member>
<member name="M:SimpleHttp.HttpFile.#ctor(System.String,System.IO.Stream,System.String)">
<summary>
Creates new HTTP file data container.
</summary>
<param name="fileName">File name.</param>
<param name="value">Data.</param>
<param name="contentType">Content type.</param>
</member>
<member name="P:SimpleHttp.HttpFile.FileName">
<summary>
Gets the name of the file.
</summary>
</member>
<member name="P:SimpleHttp.HttpFile.Value">
<summary>
Gets the data.
<para>If a stream is created <see cref="T:SimpleHttp.OnFile"/> it will be closed when this HttpFile object is disposed.</para>
</summary>
</member>
<member name="P:SimpleHttp.HttpFile.ContentType">
<summary>
Content type.
</summary>
</member>
<member name="M:SimpleHttp.HttpFile.Save(System.String,System.Boolean)">
<summary>
Saves the data into a file.
<para>Directory path will be auto created if does not exists.</para>
</summary>
<param name="fileName">File path with name.</param>
<param name="overwrite">True to overwrite the existing file, false otherwise.</param>
<returns>True if the file is saved/overwritten, false otherwise.</returns>
</member>
<member name="M:SimpleHttp.HttpFile.Dispose">
<summary>
Disposes the current instance.
</summary>
</member>
<member name="M:SimpleHttp.HttpFile.Finalize">
<summary>
Disposes the current instance.
</summary>
</member>
<member name="T:SimpleHttp.ResponseExtensions">
<summary>
Class containing HTTP response extensions.
</summary>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCORS(System.Net.HttpListenerResponse)">
<summary>
Sets response headers to enable CORS.
</summary>
<param name="response">HTTP response.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithContentType(System.Net.HttpListenerResponse,System.String)">
<summary>
Sets the content-type for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="contentType">HTTP content-type.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithHeader(System.Net.HttpListenerResponse,System.String,System.String)">
<summary>
Sets the specified header for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="name">Header name.</param>
<param name="value">Header value.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCode(System.Net.HttpListenerResponse,System.Net.HttpStatusCode)">
<summary>
Sets the status code for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="statusCode">HTTP status code.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCookie(System.Net.HttpListenerResponse,System.String,System.String)">
<summary>
Sets the cookie for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="name">Cookie name.</param>
<param name="value">Cookie value.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCookie(System.Net.HttpListenerResponse,System.String,System.String,System.DateTime)">
<summary>
Sets the cookie for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="name">Cookie name.</param>
<param name="value">Cookie value.</param>
<param name="expires">Cookie expiration date (UTC).</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCookie(System.Net.HttpListenerResponse,System.Net.Cookie)">
<summary>
Sets the cookie for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="cookie">Cookie.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsText(System.Net.HttpListenerResponse,System.String,System.String)">
<summary>
Writes the specified data to the response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="txt">Text data to write.</param>
<param name="mime">Mime type.</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsRedirect(System.Net.HttpListenerResponse,System.String)">
<summary>
Builds a redirect response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="url">A new location (URL).</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsFile(System.Net.HttpListenerResponse,System.Net.HttpListenerRequest,System.String)">
<summary>
Writes the specified file content to the response.
<para>Response is closed and can not be longer modified.</para>
<para>Built-in support for 'byte-range' response, 'ETag' and 'Last-Modified'.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="request">HTTP request used to determine 'Range' header</param>
<param name="fileName">File path with name.</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsBytes(System.Net.HttpListenerResponse,System.Net.HttpListenerRequest,System.Byte[],System.String)">
<summary>
Writes the specified data to the response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="request">HTTP request used to determine 'Range' header</param>
<param name="data">Data to write.</param>
<param name="mime">Mime type.</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsStream(System.Net.HttpListenerResponse,System.Net.HttpListenerRequest,System.IO.Stream,System.String)">
<summary>
Writes the specified data to the response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="request">HTTP request used to determine 'Range' header</param>
<param name="stream">
Data to write.
<para>Stream must support seek operation due to 'byte-range' functionality.</para>
</param>
<param name="mime">Mime type.</param>
</member>
<member name="T:SimpleHttp.StringExtensions">
<summary>
Class containing extensions for <see cref="T:System.String"/>.
</summary>
</member>
<member name="M:SimpleHttp.StringExtensions.TryMatch(System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Matches all the expressions inside '{ }' defined in <paramref name="pattern"/> for the <paramref name="query"/> and populates the <paramref name="args"/>.
<para>Example: query: "Hello world", pattern: "{first} world" => args["first"] is "Hello".</para>
</summary>
<param name="query">Query string.</param>
<param name="pattern">Pattern string defining the expressions to match inside '{ }'.</param>
<param name="args">Key-value pair collection populated by <paramref name="pattern"/> keys and matches in <paramref name="query"/> if found.</param>
<returns>True is all defined keys in <paramref name="pattern"/> are matched, false otherwise.</returns>
</member>
<member name="T:SimpleHttp.OnBefore">
<summary>
Delegate which runs before all route-methods and returns if the processing should finish (true) or continue (false).
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<returns>True if the request is handled, false otherwise.</returns>
</member>
<member name="T:SimpleHttp.ShouldProcessFunc">
<summary>
Delegate which runs before any route-action is invoked to determine which route should be executed.
</summary>
<param name="request">HTTP request.</param>
<param name="arguments">
Empty collection of key-value pairs populated by this function.
<para>If <see cref="T:SimpleHttp.OnBefore"/> is run it may contain some data.</para>
</param>
<returns>True if the route action should be executed, false otherwise.</returns>
</member>
<member name="T:SimpleHttp.HttpActionAsync">
<summary>
Delegate which runs when a route is matched.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<param name="arguments">Collection of key-value pairs populated by the <see cref="T:SimpleHttp.ShouldProcessFunc"/>.</param>
<returns>Action task.</returns>
</member>
<member name="T:SimpleHttp.HttpAction">
<summary>
Delegate which runs when a route is matched.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<param name="arguments">Collection of key-value pairs populated by the <see cref="T:SimpleHttp.ShouldProcessFunc"/>.</param>
</member>
<member name="T:SimpleHttp.OnError">
<summary>
Delegate which runs if an error occurs.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<param name="exception">Thrown exception.</param>
</member>
<member name="T:SimpleHttp.RouteNotFoundException">
<summary>
Represents error that occur when a route is not found.
</summary>
</member>
<member name="M:SimpleHttp.RouteNotFoundException.#ctor(System.String)">
<summary>
Creates a new instance of the route not found exception.
</summary>
<param name="route"></param>
</member>
<member name="T:SimpleHttp.Route">
<summary>
Class defining all the required actions for route-processing and error handling.
/// </summary>
</member>
<member name="P:SimpleHttp.Route.Before">
<summary>
Action executed before all route-methods.
<para>It may be null.</para>
</summary>
</member>
<member name="P:SimpleHttp.Route.Error">
<summary>
Action executed if an error occurs.
<para>By default it outputs exception message as text with an existing status code. In case of 200-299, 'BadRequest' is used.</para>
</summary>
</member>
<member name="F:SimpleHttp.Route.Methods">
<summary>
Gets or sets the route methods.
</summary>
</member>
<member name="M:SimpleHttp.Route.OnHttpRequestAsync(System.Net.HttpListenerRequest,System.Net.HttpListenerResponse)">
<summary>
Entry function executed on the incoming HTTP request.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<returns>Request processing task.</returns>
</member>
<member name="M:SimpleHttp.Route.Add(System.String,SimpleHttp.HttpAction,System.String)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="pattern">
String pattern optionally containing named arguments in {}.
<para>
Example: "/page-{pageNumber}/". 'pageNumber' will be parsed and added to 'arguments' key-value pair collection.
The last argument is parsed as greedy one.
</para>
</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
<param name="method">HTTP method (GET, POST, DELETE, HEAD).</param>
</member>
<member name="M:SimpleHttp.Route.Add(System.String,SimpleHttp.HttpActionAsync,System.String)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="pattern">
String pattern optionally containing named arguments in {}.
<para>
Example: "/page-{pageNumber}/". 'pageNumber' will be parsed and added to 'arguments' key-value pair collection.
The last argument is parsed as greedy one.
</para>
</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
<param name="method">HTTP method (GET, POST, DELETE, HEAD).</param>
</member>
<member name="M:SimpleHttp.Route.Add(SimpleHttp.ShouldProcessFunc,SimpleHttp.HttpActionAsync)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="shouldProcess">Function defining whether the specified action should be executed or not.</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
</member>
<member name="M:SimpleHttp.Route.Add(SimpleHttp.ShouldProcessFunc,SimpleHttp.HttpAction)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="shouldProcess">Function defining whether the specified action should be executed or not.</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
</member>
<member name="T:SimpleHttp.HttpServer">
<summary>
HTTP server listener class.
</summary>
</member>
<member name="M:SimpleHttp.HttpServer.ListenAsync(System.Int32,System.Threading.CancellationToken,System.Func{System.Net.HttpListenerRequest,System.Net.HttpListenerResponse,System.Threading.Tasks.Task},System.Boolean,System.Byte)">
<summary>
Creates and starts a new instance of the http(s) server.
</summary>
<param name="port">The http/https URI listening port.</param>
<param name="token">Cancellation token.</param>
<param name="onHttpRequestAsync">Action executed on HTTP request.</param>
<param name="useHttps">True to add 'https://' prefix insteaad of 'http://'.</param>
<param name="maxHttpConnectionCount">Maximum HTTP connection count, after which the incoming requests will wait (sockets are not included).</param>
<returns>Server listening task.</returns>
</member>
<member name="M:SimpleHttp.HttpServer.ListenAsync(System.String,System.Threading.CancellationToken,System.Func{System.Net.HttpListenerRequest,System.Net.HttpListenerResponse,System.Threading.Tasks.Task},System.Byte)">
<summary>
Creates and starts a new instance of the http(s) / websocket server.
</summary>
<param name="httpListenerPrefix">The http/https URI listening prefix.</param>
<param name="token">Cancellation token.</param>
<param name="onHttpRequestAsync">Action executed on HTTP request.</param>
<param name="maxHttpConnectionCount">Maximum HTTP connection count, after which the incoming requests will wait (sockets are not included).</param>
<returns>Server listening task.</returns>
</member>
<member name="T:SimpleHttp.Templating">
<summary>
Class defining methods for string or file pattern replacements.
</summary>
</member>
<member name="M:SimpleHttp.Templating.RenderFile(System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are specified in the replacements.
</summary>
<param name="fileName">File path with name.</param>
<param name="replacements">Key-value pair collection for replacements.</param>
<returns>Processed file content.</returns>
</member>
<member name="M:SimpleHttp.Templating.RenderString(System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are specified in the replacements.
</summary>
<param name="template">Template string.</param>
<param name="replacements">Key-value pair collection for replacements.</param>
<returns>Processed template.</returns>
</member>
<member name="M:SimpleHttp.Templating.RenderFile``1(System.String,``0)">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are defined as object property names and values.
</summary>
<typeparam name="T">Object type.</typeparam>
<param name="fileName">File path with name.</param>
<param name="obj">Object to use for replacements.</param>
<returns>Processed file content.</returns>
</member>
<member name="M:SimpleHttp.Templating.RenderString``1(System.String,``0)">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are defined as object property names and values.
</summary>
<typeparam name="T">Object type.</typeparam>
<param name="template">Template string.</param>
<param name="obj">Object to use for replacements.</param>
<returns>Processed file content.</returns>
</member>
</members>
</doc>

Binary file not shown.

Binary file not shown.

View File

@ -21,6 +21,10 @@
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Binary file not shown.

View File

@ -1 +1 @@
b4ca8c584923940929f3de1b0f73baa4a23e2ad6
d24c4380a60b7d95eb6c0794042e9b1bb52b78fb

View File

@ -2,7 +2,6 @@ C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\youtube-downloader.exe.con
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\youtube-downloader.exe
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\youtube-downloader.pdb
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\AngleSharp.dll
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\CommandLine.dll
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\Microsoft.Bcl.AsyncInterfaces.dll
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\Newtonsoft.Json.dll
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\System.Buffers.dll
@ -16,7 +15,6 @@ C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\System.Threading.Tasks.Ext
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\System.ValueTuple.dll
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\YoutubeExplode.dll
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\AngleSharp.xml
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\CommandLine.xml
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\Microsoft.Bcl.AsyncInterfaces.xml
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\Newtonsoft.Json.xml
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\System.Buffers.xml
@ -35,3 +33,6 @@ C:\Users\Demetria Lovato\youtube-downloader\obj\Debug\youtube-downloader.exe
C:\Users\Demetria Lovato\youtube-downloader\obj\Debug\youtube-downloader.pdb
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\System.Linq.Async.dll
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\System.Linq.Async.xml
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\MimeTypesMap.dll
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\SimpleHTTP.dll
C:\Users\Demetria Lovato\youtube-downloader\bin\Debug\SimpleHTTP.xml

Binary file not shown.

Binary file not shown.

View File

@ -1,18 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AngleSharp" version="0.14.0" targetFramework="net48" />
<package id="CommandLineParser" version="2.8.0" targetFramework="net48" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.1" targetFramework="net48" />
<package id="MimeTypesMap" version="1.0.2" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
<package id="Simple-HTTP" version="1.0.6" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.IO" version="4.3.0" targetFramework="net48" />
<package id="System.Linq.Async" version="5.0.0" targetFramework="net48" />
<package id="System.Memory" version="4.5.4" targetFramework="net48" />
<package id="System.Net.Http" version="4.3.3" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net48" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net48" />
<package id="System.Text.Encoding.CodePages" version="4.5.0" targetFramework="net48" />
<package id="System.Text.Encodings.Web" version="4.7.1" targetFramework="net48" />
<package id="System.Text.Json" version="4.7.2" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
<package id="YoutubeExplode" version="6.0.3" targetFramework="net48" />
</packages>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

View File

@ -1,351 +0,0 @@
[![Build status](https://ci.appveyor.com/api/projects/status/p61dj8udxs2aocmo/branch/master?svg=true)](https://ci.appveyor.com/project/commandlineparser/commandline/branch/master)
[![NuGet](https://img.shields.io/nuget/dt/commandlineparser.svg)](http://nuget.org/packages/commandlineparser)
[![NuGet](https://img.shields.io/nuget/v/commandlineparser.svg)](https://www.nuget.org/packages/CommandLineParser/)
[![NuGet](https://img.shields.io/nuget/vpre/commandlineparser.svg)](https://www.nuget.org/packages/CommandLineParser/)
[![Join the Gitter chat!](https://badges.gitter.im/gsscoder/commandline.svg)](https://gitter.im/gsscoder/commandline?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
# Command Line Parser Library for CLR and NetStandard
**Note:** the API surface has changed since v1.9.x and earlier. If you are looking for documentation on v1.9.x, please see [stable-1.9.71.2](https://github.com/gsscoder/commandline/tree/stable-1.9.71.2)
The Command Line Parser Library offers CLR applications a clean and concise API for manipulating command line arguments and related tasks, such as defining switches, options and verb commands. It allows you to display a help screen with a high degree of customization and a simple way to report syntax errors to the end user.
```
C:\Project> NuGet Install CommandLineParser
```
# Nightly Build
Nightly version of the CommandLineParser can be downloaded from github [Releases](https://github.com/commandlineparser/commandline/releases).
The Last new features and fixes, read [changelog](https://github.com/commandlineparser/commandline/blob/master/CHANGELOG.md)
_NOTE: Mentioned F# Support is provided via ```CommandLineParser.FSharp``` package with FSharp dependencies._
__This library provides _hassle free_ command line parsing with a constantly updated API since 2005.__
# At a glance:
- Compatible with __.NET Framework 4.0+__, __Mono 2.1+ Profile__, __.NET Standard__ and __.NET Core__
- Doesn't depend on other packages (No dependencies beyond standard base libraries)
- One line parsing using default singleton: `CommandLine.Parser.Default.ParseArguments(...)` and three overload methods.
- Automatic or one line help screen generator: `HelpText.AutoBuild(...)`.
- Supports `--help`, `--version`, `version` and `help [verb]` by default with customization.
- Map to sequences (via `IEnumerable<T>` and similar) and scalar types, including Enums and `Nullable<T>`.
- You can also map to every type with a constructor that accepts a string (like `System.Uri`) for reference and value types.
- Verbs can be array of types collected from Plugins or IoC container.
- Define [verb commands](https://github.com/commandlineparser/commandline/wiki/Verbs) similar to `git commit -a`.
- Support default verb.
- Support Mutable and Immutable types.
- Support HelpText localization.
- Support ordering of options in HelpText.
- Support [Mutually Exclusive Options](https://github.com/commandlineparser/commandline/wiki/Mutually-Exclusive-Options) and Options groups.
- Support named and value options.
- Support Asynchronous programming with async and await.
- Unparsing support: `CommandLine.Parser.Default.FormatCommandLine<T>(T options)`.
- CommandLineParser.FSharp package is F#-friendly with support for `option<'a>`, see [demo](https://github.com/commandlineparser/commandline/blob/master/demo/fsharp-demo.fsx). _NOTE: This is a separate NuGet package._
- Include wiki documentation with lot of examples ready to run online.
- Support Source Link and symbolic nuget package snupkg.
- Tested in Windows, Linux Ubuntu 18.04 and Mac OS.
- Most of features applies with a [CoC](http://en.wikipedia.org/wiki/Convention_over_configuration) philosophy.
- C# demo: source [here](https://github.com/commandlineparser/commandline/tree/master/demo/ReadText.Demo).
# Getting Started with the Command Line Parser Library
You can utilize the parser library in several ways:
- Install via NuGet/Paket: [https://www.nuget.org/packages/CommandLineParser/](https://www.nuget.org/packages/CommandLineParser/)
- Integrate directly into your project by copying the .cs files into your project.
- ILMerge during your build process.
## Quick Start Examples
1. Create a class to define valid options, and to receive the parsed options.
2. Call ParseArguments with the args string array.
C# Quick Start:
```cs
using System;
using CommandLine;
namespace QuickStart
{
class Program
{
public class Options
{
[Option('v', "verbose", Required = false, HelpText = "Set output to verbose messages.")]
public bool Verbose { get; set; }
}
static void Main(string[] args)
{
Parser.Default.ParseArguments<Options>(args)
.WithParsed<Options>(o =>
{
if (o.Verbose)
{
Console.WriteLine($"Verbose output enabled. Current Arguments: -v {o.Verbose}");
Console.WriteLine("Quick Start Example! App is in Verbose mode!");
}
else
{
Console.WriteLine($"Current Arguments: -v {o.Verbose}");
Console.WriteLine("Quick Start Example!");
}
});
}
}
}
```
## C# Examples:
<details>
<summary>Click to expand!</summary>
```cs
class Options
{
[Option('r', "read", Required = true, HelpText = "Input files to be processed.")]
public IEnumerable<string> InputFiles { get; set; }
// Omitting long name, defaults to name of property, ie "--verbose"
[Option(
Default = false,
HelpText = "Prints all messages to standard output.")]
public bool Verbose { get; set; }
[Option("stdin",
Default = false,
HelpText = "Read from stdin")]
public bool stdin { get; set; }
[Value(0, MetaName = "offset", HelpText = "File offset.")]
public long? Offset { get; set; }
}
static void Main(string[] args)
{
CommandLine.Parser.Default.ParseArguments<Options>(args)
.WithParsed(RunOptions)
.WithNotParsed(HandleParseError);
}
static void RunOptions(Options opts)
{
//handle options
}
static void HandleParseError(IEnumerable<Error> errs)
{
//handle errors
}
```
</details>
Demo to show IEnumerable options and other usage: [Online Demo](https://dotnetfiddle.net/wrcAxr)
## F# Examples:
<details>
<summary>Click to expand!</summary>
```fsharp
type options = {
[<Option('r', "read", Required = true, HelpText = "Input files.")>] files : seq<string>;
[<Option(HelpText = "Prints all messages to standard output.")>] verbose : bool;
[<Option(Default = "русский", HelpText = "Content language.")>] language : string;
[<Value(0, MetaName="offset", HelpText = "File offset.")>] offset : int64 option;
}
let main argv =
let result = CommandLine.Parser.Default.ParseArguments<options>(argv)
match result with
| :? Parsed<options> as parsed -> run parsed.Value
| :? NotParsed<options> as notParsed -> fail notParsed.Errors
```
</details>
## VB.NET Example:
<details>
<summary>Click to expand!</summary>
```vb
Class Options
<CommandLine.Option('r', "read", Required := true,
HelpText:="Input files to be processed.")>
Public Property InputFiles As IEnumerable(Of String)
' Omitting long name, defaults to name of property, ie "--verbose"
<CommandLine.Option(
HelpText:="Prints all messages to standard output.")>
Public Property Verbose As Boolean
<CommandLine.Option(Default:="中文",
HelpText:="Content language.")>
Public Property Language As String
<CommandLine.Value(0, MetaName:="offset",
HelpText:="File offset.")>
Public Property Offset As Long?
End Class
Sub Main(ByVal args As String())
CommandLine.Parser.Default.ParseArguments(Of Options)(args) _
.WithParsed(Function(opts As Options) RunOptionsAndReturnExitCode(opts)) _
.WithNotParsed(Function(errs As IEnumerable(Of [Error])) 1)
End Sub
```
</details>
## For verbs:
1. Create separate option classes for each verb. An options base class is supported.
2. Call ParseArguments with all the verb attribute decorated options classes.
3. Use MapResult to direct program flow to the verb that was parsed.
### C# example:
<details>
<summary>Click to expand!</summary>
```csharp
[Verb("add", HelpText = "Add file contents to the index.")]
class AddOptions {
//normal options here
}
[Verb("commit", HelpText = "Record changes to the repository.")]
class CommitOptions {
//commit options here
}
[Verb("clone", HelpText = "Clone a repository into a new directory.")]
class CloneOptions {
//clone options here
}
int Main(string[] args) {
return CommandLine.Parser.Default.ParseArguments<AddOptions, CommitOptions, CloneOptions>(args)
.MapResult(
(AddOptions opts) => RunAddAndReturnExitCode(opts),
(CommitOptions opts) => RunCommitAndReturnExitCode(opts),
(CloneOptions opts) => RunCloneAndReturnExitCode(opts),
errs => 1);
}
```
</details>
### VB.NET example:
<details>
<summary>Click to expand!</summary>
```vb
<CommandLine.Verb("add", HelpText:="Add file contents to the index.")>
Public Class AddOptions
'Normal options here
End Class
<CommandLine.Verb("commit", HelpText:="Record changes to the repository.")>
Public Class CommitOptions
'Normal options here
End Class
<CommandLine.Verb("clone", HelpText:="Clone a repository into a new directory.")>
Public Class CloneOptions
'Normal options here
End Class
Function Main(ByVal args As String()) As Integer
Return CommandLine.Parser.Default.ParseArguments(Of AddOptions, CommitOptions, CloneOptions)(args) _
.MapResult(
(Function(opts As AddOptions) RunAddAndReturnExitCode(opts)),
(Function(opts As CommitOptions) RunCommitAndReturnExitCode(opts)),
(Function(opts As CloneOptions) RunCloneAndReturnExitCode(opts)),
(Function(errs As IEnumerable(Of [Error])) 1)
)
End Function
```
</details>
### F# Example:
<details>
<summary>Click to expand!</summary>
```fs
open CommandLine
[<Verb("add", HelpText = "Add file contents to the index.")>]
type AddOptions = {
// normal options here
}
[<Verb("commit", HelpText = "Record changes to the repository.")>]
type CommitOptions = {
// normal options here
}
[<Verb("clone", HelpText = "Clone a repository into a new directory.")>]
type CloneOptions = {
// normal options here
}
[<EntryPoint>]
let main args =
let result = Parser.Default.ParseArguments<AddOptions, CommitOptions, CloneOptions> args
match result with
| :? CommandLine.Parsed<obj> as command ->
match command.Value with
| :? AddOptions as opts -> RunAddAndReturnExitCode opts
| :? CommitOptions as opts -> RunCommitAndReturnExitCode opts
| :? CloneOptions as opts -> RunCloneAndReturnExitCode opts
| :? CommandLine.NotParsed<obj> -> 1
```
</details>
# Release History
See the [changelog](CHANGELOG.md)
# Contributors
First off, _Thank you!_ All contributions are welcome.
Please consider sticking with the GNU getopt standard for command line parsing.
Additionally, for easiest diff compares, please follow the project's tabs settings. Utilizing the EditorConfig extension for Visual Studio/your favorite IDE is recommended.
__And most importantly, please target the ```develop``` branch in your pull requests!__
## Main Contributors (alphabetical order):
- Alexander Fast (@mizipzor)
- Dan Nemec (@nemec)
- Eric Newton (@ericnewton76)
- Kevin Moore (@gimmemoore)
- Moh-Hassan (@moh-hassan)
- Steven Evans
- Thomas Démoulins (@Thilas)
## Resources for newcomers:
- [Wiki](https://github.com/commandlineparser/commandline/wiki)
- [GNU getopt](http://www.gnu.org/software/libc/manual/html_node/Getopt.html)
# Contacts:
- Giacomo Stelluti Scala
- gsscoder AT gmail DOT com (_use this for everything that is not available via GitHub features_)
- GitHub: [gsscoder](https://github.com/gsscoder)
- [Blog](http://gsscoder.blogspot.it)
- [Twitter](http://twitter.com/gsscoder)
- Dan Nemec
- Eric Newton
- ericnewton76+commandlineparser AT gmail DOT com
- GitHub: [ericnewton76](https://github.com/ericnewton76)
- Blog:
- Twitter: [enorl76](http://twitter.com/enorl76)
- Moh-Hassan

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,415 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>SimpleHTTP</name>
</assembly>
<members>
<member name="T:SimpleHttp.RequestExtensions">
<summary>
Class containing <see cref="T:System.Net.HttpListenerRequest"/> extensions.
</summary>
</member>
<member name="M:SimpleHttp.RequestExtensions.ParseBody(System.Net.HttpListenerRequest,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Parses body of the request including form and multi-part form data.
</summary>
<param name="request">HTTP request.</param>
<param name="args">Key-value pairs populated by the form data by this function.</param>
<returns>Name-file pair collection.</returns>
</member>
<member name="M:SimpleHttp.RequestExtensions.ParseBody(System.Net.HttpListenerRequest,System.Collections.Generic.Dictionary{System.String,System.String},SimpleHttp.OnFile)">
<summary>
Parses body of the request including form and multi-part form data.
</summary>
<param name="request">HTTP request.</param>
<param name="args">Key-value pairs populated by the form data by this function.</param>
<param name="onFile">
Function called if a file is about to be parsed. The stream is attached to a corresponding <see cref="T:SimpleHttp.HttpFile"/>.
<para>By default, <see cref="T:System.IO.MemoryStream"/> is used, but for large files, it is recommended to open <see cref="T:System.IO.FileStream"/> directly.</para>
</param>
<returns>Name-file pair collection.</returns>
</member>
<member name="T:SimpleHttp.OnFile">
<summary>
Delegate executed when a file is about to be read from a body stream.
</summary>
<param name="fieldName">Field name.</param>
<param name="fileName">name of the file.</param>
<param name="contentType">Content type.</param>
<returns>Stream to be populated.</returns>
</member>
<member name="T:SimpleHttp.HttpFile">
<summary>
HTTP file data container.
</summary>
</member>
<member name="M:SimpleHttp.HttpFile.#ctor(System.String,System.IO.Stream,System.String)">
<summary>
Creates new HTTP file data container.
</summary>
<param name="fileName">File name.</param>
<param name="value">Data.</param>
<param name="contentType">Content type.</param>
</member>
<member name="P:SimpleHttp.HttpFile.FileName">
<summary>
Gets the name of the file.
</summary>
</member>
<member name="P:SimpleHttp.HttpFile.Value">
<summary>
Gets the data.
<para>If a stream is created <see cref="T:SimpleHttp.OnFile"/> it will be closed when this HttpFile object is disposed.</para>
</summary>
</member>
<member name="P:SimpleHttp.HttpFile.ContentType">
<summary>
Content type.
</summary>
</member>
<member name="M:SimpleHttp.HttpFile.Save(System.String,System.Boolean)">
<summary>
Saves the data into a file.
<para>Directory path will be auto created if does not exists.</para>
</summary>
<param name="fileName">File path with name.</param>
<param name="overwrite">True to overwrite the existing file, false otherwise.</param>
<returns>True if the file is saved/overwritten, false otherwise.</returns>
</member>
<member name="M:SimpleHttp.HttpFile.Dispose">
<summary>
Disposes the current instance.
</summary>
</member>
<member name="M:SimpleHttp.HttpFile.Finalize">
<summary>
Disposes the current instance.
</summary>
</member>
<member name="T:SimpleHttp.ResponseExtensions">
<summary>
Class containing HTTP response extensions.
</summary>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCORS(System.Net.HttpListenerResponse)">
<summary>
Sets response headers to enable CORS.
</summary>
<param name="response">HTTP response.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithContentType(System.Net.HttpListenerResponse,System.String)">
<summary>
Sets the content-type for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="contentType">HTTP content-type.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithHeader(System.Net.HttpListenerResponse,System.String,System.String)">
<summary>
Sets the specified header for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="name">Header name.</param>
<param name="value">Header value.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCode(System.Net.HttpListenerResponse,System.Net.HttpStatusCode)">
<summary>
Sets the status code for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="statusCode">HTTP status code.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCookie(System.Net.HttpListenerResponse,System.String,System.String)">
<summary>
Sets the cookie for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="name">Cookie name.</param>
<param name="value">Cookie value.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCookie(System.Net.HttpListenerResponse,System.String,System.String,System.DateTime)">
<summary>
Sets the cookie for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="name">Cookie name.</param>
<param name="value">Cookie value.</param>
<param name="expires">Cookie expiration date (UTC).</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCookie(System.Net.HttpListenerResponse,System.Net.Cookie)">
<summary>
Sets the cookie for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="cookie">Cookie.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsText(System.Net.HttpListenerResponse,System.String,System.String)">
<summary>
Writes the specified data to the response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="txt">Text data to write.</param>
<param name="mime">Mime type.</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsRedirect(System.Net.HttpListenerResponse,System.String)">
<summary>
Builds a redirect response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="url">A new location (URL).</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsFile(System.Net.HttpListenerResponse,System.Net.HttpListenerRequest,System.String)">
<summary>
Writes the specified file content to the response.
<para>Response is closed and can not be longer modified.</para>
<para>Built-in support for 'byte-range' response, 'ETag' and 'Last-Modified'.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="request">HTTP request used to determine 'Range' header</param>
<param name="fileName">File path with name.</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsBytes(System.Net.HttpListenerResponse,System.Net.HttpListenerRequest,System.Byte[],System.String)">
<summary>
Writes the specified data to the response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="request">HTTP request used to determine 'Range' header</param>
<param name="data">Data to write.</param>
<param name="mime">Mime type.</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsStream(System.Net.HttpListenerResponse,System.Net.HttpListenerRequest,System.IO.Stream,System.String)">
<summary>
Writes the specified data to the response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="request">HTTP request used to determine 'Range' header</param>
<param name="stream">
Data to write.
<para>Stream must support seek operation due to 'byte-range' functionality.</para>
</param>
<param name="mime">Mime type.</param>
</member>
<member name="T:SimpleHttp.StringExtensions">
<summary>
Class containing extensions for <see cref="T:System.String"/>.
</summary>
</member>
<member name="M:SimpleHttp.StringExtensions.TryMatch(System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Matches all the expressions inside '{ }' defined in <paramref name="pattern"/> for the <paramref name="query"/> and populates the <paramref name="args"/>.
<para>Example: query: "Hello world", pattern: "{first} world" => args["first"] is "Hello".</para>
</summary>
<param name="query">Query string.</param>
<param name="pattern">Pattern string defining the expressions to match inside '{ }'.</param>
<param name="args">Key-value pair collection populated by <paramref name="pattern"/> keys and matches in <paramref name="query"/> if found.</param>
<returns>True is all defined keys in <paramref name="pattern"/> are matched, false otherwise.</returns>
</member>
<member name="T:SimpleHttp.OnBefore">
<summary>
Delegate which runs before all route-methods and returns if the processing should finish (true) or continue (false).
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<returns>True if the request is handled, false otherwise.</returns>
</member>
<member name="T:SimpleHttp.ShouldProcessFunc">
<summary>
Delegate which runs before any route-action is invoked to determine which route should be executed.
</summary>
<param name="request">HTTP request.</param>
<param name="arguments">
Empty collection of key-value pairs populated by this function.
<para>If <see cref="T:SimpleHttp.OnBefore"/> is run it may contain some data.</para>
</param>
<returns>True if the route action should be executed, false otherwise.</returns>
</member>
<member name="T:SimpleHttp.HttpActionAsync">
<summary>
Delegate which runs when a route is matched.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<param name="arguments">Collection of key-value pairs populated by the <see cref="T:SimpleHttp.ShouldProcessFunc"/>.</param>
<returns>Action task.</returns>
</member>
<member name="T:SimpleHttp.HttpAction">
<summary>
Delegate which runs when a route is matched.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<param name="arguments">Collection of key-value pairs populated by the <see cref="T:SimpleHttp.ShouldProcessFunc"/>.</param>
</member>
<member name="T:SimpleHttp.OnError">
<summary>
Delegate which runs if an error occurs.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<param name="exception">Thrown exception.</param>
</member>
<member name="T:SimpleHttp.RouteNotFoundException">
<summary>
Represents error that occur when a route is not found.
</summary>
</member>
<member name="M:SimpleHttp.RouteNotFoundException.#ctor(System.String)">
<summary>
Creates a new instance of the route not found exception.
</summary>
<param name="route"></param>
</member>
<member name="T:SimpleHttp.Route">
<summary>
Class defining all the required actions for route-processing and error handling.
/// </summary>
</member>
<member name="P:SimpleHttp.Route.Before">
<summary>
Action executed before all route-methods.
<para>It may be null.</para>
</summary>
</member>
<member name="P:SimpleHttp.Route.Error">
<summary>
Action executed if an error occurs.
<para>By default it outputs exception message as text with an existing status code. In case of 200-299, 'BadRequest' is used.</para>
</summary>
</member>
<member name="F:SimpleHttp.Route.Methods">
<summary>
Gets or sets the route methods.
</summary>
</member>
<member name="M:SimpleHttp.Route.OnHttpRequestAsync(System.Net.HttpListenerRequest,System.Net.HttpListenerResponse)">
<summary>
Entry function executed on the incoming HTTP request.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<returns>Request processing task.</returns>
</member>
<member name="M:SimpleHttp.Route.Add(System.String,SimpleHttp.HttpAction,System.String)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="pattern">
String pattern optionally containing named arguments in {}.
<para>
Example: "/page-{pageNumber}/". 'pageNumber' will be parsed and added to 'arguments' key-value pair collection.
The last argument is parsed as greedy one.
</para>
</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
<param name="method">HTTP method (GET, POST, DELETE, HEAD).</param>
</member>
<member name="M:SimpleHttp.Route.Add(System.String,SimpleHttp.HttpActionAsync,System.String)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="pattern">
String pattern optionally containing named arguments in {}.
<para>
Example: "/page-{pageNumber}/". 'pageNumber' will be parsed and added to 'arguments' key-value pair collection.
The last argument is parsed as greedy one.
</para>
</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
<param name="method">HTTP method (GET, POST, DELETE, HEAD).</param>
</member>
<member name="M:SimpleHttp.Route.Add(SimpleHttp.ShouldProcessFunc,SimpleHttp.HttpActionAsync)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="shouldProcess">Function defining whether the specified action should be executed or not.</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
</member>
<member name="M:SimpleHttp.Route.Add(SimpleHttp.ShouldProcessFunc,SimpleHttp.HttpAction)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="shouldProcess">Function defining whether the specified action should be executed or not.</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
</member>
<member name="T:SimpleHttp.HttpServer">
<summary>
HTTP server listener class.
</summary>
</member>
<member name="M:SimpleHttp.HttpServer.ListenAsync(System.Int32,System.Threading.CancellationToken,System.Func{System.Net.HttpListenerRequest,System.Net.HttpListenerResponse,System.Threading.Tasks.Task},System.Boolean,System.Byte)">
<summary>
Creates and starts a new instance of the http(s) server.
</summary>
<param name="port">The http/https URI listening port.</param>
<param name="token">Cancellation token.</param>
<param name="onHttpRequestAsync">Action executed on HTTP request.</param>
<param name="useHttps">True to add 'https://' prefix insteaad of 'http://'.</param>
<param name="maxHttpConnectionCount">Maximum HTTP connection count, after which the incoming requests will wait (sockets are not included).</param>
<returns>Server listening task.</returns>
</member>
<member name="M:SimpleHttp.HttpServer.ListenAsync(System.String,System.Threading.CancellationToken,System.Func{System.Net.HttpListenerRequest,System.Net.HttpListenerResponse,System.Threading.Tasks.Task},System.Byte)">
<summary>
Creates and starts a new instance of the http(s) / websocket server.
</summary>
<param name="httpListenerPrefix">The http/https URI listening prefix.</param>
<param name="token">Cancellation token.</param>
<param name="onHttpRequestAsync">Action executed on HTTP request.</param>
<param name="maxHttpConnectionCount">Maximum HTTP connection count, after which the incoming requests will wait (sockets are not included).</param>
<returns>Server listening task.</returns>
</member>
<member name="T:SimpleHttp.Templating">
<summary>
Class defining methods for string or file pattern replacements.
</summary>
</member>
<member name="M:SimpleHttp.Templating.RenderFile(System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are specified in the replacements.
</summary>
<param name="fileName">File path with name.</param>
<param name="replacements">Key-value pair collection for replacements.</param>
<returns>Processed file content.</returns>
</member>
<member name="M:SimpleHttp.Templating.RenderString(System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are specified in the replacements.
</summary>
<param name="template">Template string.</param>
<param name="replacements">Key-value pair collection for replacements.</param>
<returns>Processed template.</returns>
</member>
<member name="M:SimpleHttp.Templating.RenderFile``1(System.String,``0)">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are defined as object property names and values.
</summary>
<typeparam name="T">Object type.</typeparam>
<param name="fileName">File path with name.</param>
<param name="obj">Object to use for replacements.</param>
<returns>Processed file content.</returns>
</member>
<member name="M:SimpleHttp.Templating.RenderString``1(System.String,``0)">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are defined as object property names and values.
</summary>
<typeparam name="T">Object type.</typeparam>
<param name="template">Template string.</param>
<param name="obj">Object to use for replacements.</param>
<returns>Processed file content.</returns>
</member>
</members>
</doc>

Binary file not shown.

View File

@ -0,0 +1,415 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>SimpleHTTP</name>
</assembly>
<members>
<member name="T:SimpleHttp.RequestExtensions">
<summary>
Class containing <see cref="T:System.Net.HttpListenerRequest"/> extensions.
</summary>
</member>
<member name="M:SimpleHttp.RequestExtensions.ParseBody(System.Net.HttpListenerRequest,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Parses body of the request including form and multi-part form data.
</summary>
<param name="request">HTTP request.</param>
<param name="args">Key-value pairs populated by the form data by this function.</param>
<returns>Name-file pair collection.</returns>
</member>
<member name="M:SimpleHttp.RequestExtensions.ParseBody(System.Net.HttpListenerRequest,System.Collections.Generic.Dictionary{System.String,System.String},SimpleHttp.OnFile)">
<summary>
Parses body of the request including form and multi-part form data.
</summary>
<param name="request">HTTP request.</param>
<param name="args">Key-value pairs populated by the form data by this function.</param>
<param name="onFile">
Function called if a file is about to be parsed. The stream is attached to a corresponding <see cref="T:SimpleHttp.HttpFile"/>.
<para>By default, <see cref="T:System.IO.MemoryStream"/> is used, but for large files, it is recommended to open <see cref="T:System.IO.FileStream"/> directly.</para>
</param>
<returns>Name-file pair collection.</returns>
</member>
<member name="T:SimpleHttp.OnFile">
<summary>
Delegate executed when a file is about to be read from a body stream.
</summary>
<param name="fieldName">Field name.</param>
<param name="fileName">name of the file.</param>
<param name="contentType">Content type.</param>
<returns>Stream to be populated.</returns>
</member>
<member name="T:SimpleHttp.HttpFile">
<summary>
HTTP file data container.
</summary>
</member>
<member name="M:SimpleHttp.HttpFile.#ctor(System.String,System.IO.Stream,System.String)">
<summary>
Creates new HTTP file data container.
</summary>
<param name="fileName">File name.</param>
<param name="value">Data.</param>
<param name="contentType">Content type.</param>
</member>
<member name="P:SimpleHttp.HttpFile.FileName">
<summary>
Gets the name of the file.
</summary>
</member>
<member name="P:SimpleHttp.HttpFile.Value">
<summary>
Gets the data.
<para>If a stream is created <see cref="T:SimpleHttp.OnFile"/> it will be closed when this HttpFile object is disposed.</para>
</summary>
</member>
<member name="P:SimpleHttp.HttpFile.ContentType">
<summary>
Content type.
</summary>
</member>
<member name="M:SimpleHttp.HttpFile.Save(System.String,System.Boolean)">
<summary>
Saves the data into a file.
<para>Directory path will be auto created if does not exists.</para>
</summary>
<param name="fileName">File path with name.</param>
<param name="overwrite">True to overwrite the existing file, false otherwise.</param>
<returns>True if the file is saved/overwritten, false otherwise.</returns>
</member>
<member name="M:SimpleHttp.HttpFile.Dispose">
<summary>
Disposes the current instance.
</summary>
</member>
<member name="M:SimpleHttp.HttpFile.Finalize">
<summary>
Disposes the current instance.
</summary>
</member>
<member name="T:SimpleHttp.ResponseExtensions">
<summary>
Class containing HTTP response extensions.
</summary>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCORS(System.Net.HttpListenerResponse)">
<summary>
Sets response headers to enable CORS.
</summary>
<param name="response">HTTP response.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithContentType(System.Net.HttpListenerResponse,System.String)">
<summary>
Sets the content-type for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="contentType">HTTP content-type.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithHeader(System.Net.HttpListenerResponse,System.String,System.String)">
<summary>
Sets the specified header for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="name">Header name.</param>
<param name="value">Header value.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCode(System.Net.HttpListenerResponse,System.Net.HttpStatusCode)">
<summary>
Sets the status code for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="statusCode">HTTP status code.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCookie(System.Net.HttpListenerResponse,System.String,System.String)">
<summary>
Sets the cookie for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="name">Cookie name.</param>
<param name="value">Cookie value.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCookie(System.Net.HttpListenerResponse,System.String,System.String,System.DateTime)">
<summary>
Sets the cookie for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="name">Cookie name.</param>
<param name="value">Cookie value.</param>
<param name="expires">Cookie expiration date (UTC).</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.WithCookie(System.Net.HttpListenerResponse,System.Net.Cookie)">
<summary>
Sets the cookie for the response.
</summary>
<param name="response">HTTP response.</param>
<param name="cookie">Cookie.</param>
<returns>Modified HTTP response.</returns>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsText(System.Net.HttpListenerResponse,System.String,System.String)">
<summary>
Writes the specified data to the response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="txt">Text data to write.</param>
<param name="mime">Mime type.</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsRedirect(System.Net.HttpListenerResponse,System.String)">
<summary>
Builds a redirect response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="url">A new location (URL).</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsFile(System.Net.HttpListenerResponse,System.Net.HttpListenerRequest,System.String)">
<summary>
Writes the specified file content to the response.
<para>Response is closed and can not be longer modified.</para>
<para>Built-in support for 'byte-range' response, 'ETag' and 'Last-Modified'.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="request">HTTP request used to determine 'Range' header</param>
<param name="fileName">File path with name.</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsBytes(System.Net.HttpListenerResponse,System.Net.HttpListenerRequest,System.Byte[],System.String)">
<summary>
Writes the specified data to the response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="request">HTTP request used to determine 'Range' header</param>
<param name="data">Data to write.</param>
<param name="mime">Mime type.</param>
</member>
<member name="M:SimpleHttp.ResponseExtensions.AsStream(System.Net.HttpListenerResponse,System.Net.HttpListenerRequest,System.IO.Stream,System.String)">
<summary>
Writes the specified data to the response.
<para>Response is closed and can not be longer modified.</para>
</summary>
<param name="response">HTTP response.</param>
<param name="request">HTTP request used to determine 'Range' header</param>
<param name="stream">
Data to write.
<para>Stream must support seek operation due to 'byte-range' functionality.</para>
</param>
<param name="mime">Mime type.</param>
</member>
<member name="T:SimpleHttp.StringExtensions">
<summary>
Class containing extensions for <see cref="T:System.String"/>.
</summary>
</member>
<member name="M:SimpleHttp.StringExtensions.TryMatch(System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Matches all the expressions inside '{ }' defined in <paramref name="pattern"/> for the <paramref name="query"/> and populates the <paramref name="args"/>.
<para>Example: query: "Hello world", pattern: "{first} world" => args["first"] is "Hello".</para>
</summary>
<param name="query">Query string.</param>
<param name="pattern">Pattern string defining the expressions to match inside '{ }'.</param>
<param name="args">Key-value pair collection populated by <paramref name="pattern"/> keys and matches in <paramref name="query"/> if found.</param>
<returns>True is all defined keys in <paramref name="pattern"/> are matched, false otherwise.</returns>
</member>
<member name="T:SimpleHttp.OnBefore">
<summary>
Delegate which runs before all route-methods and returns if the processing should finish (true) or continue (false).
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<returns>True if the request is handled, false otherwise.</returns>
</member>
<member name="T:SimpleHttp.ShouldProcessFunc">
<summary>
Delegate which runs before any route-action is invoked to determine which route should be executed.
</summary>
<param name="request">HTTP request.</param>
<param name="arguments">
Empty collection of key-value pairs populated by this function.
<para>If <see cref="T:SimpleHttp.OnBefore"/> is run it may contain some data.</para>
</param>
<returns>True if the route action should be executed, false otherwise.</returns>
</member>
<member name="T:SimpleHttp.HttpActionAsync">
<summary>
Delegate which runs when a route is matched.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<param name="arguments">Collection of key-value pairs populated by the <see cref="T:SimpleHttp.ShouldProcessFunc"/>.</param>
<returns>Action task.</returns>
</member>
<member name="T:SimpleHttp.HttpAction">
<summary>
Delegate which runs when a route is matched.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<param name="arguments">Collection of key-value pairs populated by the <see cref="T:SimpleHttp.ShouldProcessFunc"/>.</param>
</member>
<member name="T:SimpleHttp.OnError">
<summary>
Delegate which runs if an error occurs.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<param name="exception">Thrown exception.</param>
</member>
<member name="T:SimpleHttp.RouteNotFoundException">
<summary>
Represents error that occur when a route is not found.
</summary>
</member>
<member name="M:SimpleHttp.RouteNotFoundException.#ctor(System.String)">
<summary>
Creates a new instance of the route not found exception.
</summary>
<param name="route"></param>
</member>
<member name="T:SimpleHttp.Route">
<summary>
Class defining all the required actions for route-processing and error handling.
/// </summary>
</member>
<member name="P:SimpleHttp.Route.Before">
<summary>
Action executed before all route-methods.
<para>It may be null.</para>
</summary>
</member>
<member name="P:SimpleHttp.Route.Error">
<summary>
Action executed if an error occurs.
<para>By default it outputs exception message as text with an existing status code. In case of 200-299, 'BadRequest' is used.</para>
</summary>
</member>
<member name="F:SimpleHttp.Route.Methods">
<summary>
Gets or sets the route methods.
</summary>
</member>
<member name="M:SimpleHttp.Route.OnHttpRequestAsync(System.Net.HttpListenerRequest,System.Net.HttpListenerResponse)">
<summary>
Entry function executed on the incoming HTTP request.
</summary>
<param name="request">HTTP request.</param>
<param name="response">HTTP response.</param>
<returns>Request processing task.</returns>
</member>
<member name="M:SimpleHttp.Route.Add(System.String,SimpleHttp.HttpAction,System.String)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="pattern">
String pattern optionally containing named arguments in {}.
<para>
Example: "/page-{pageNumber}/". 'pageNumber' will be parsed and added to 'arguments' key-value pair collection.
The last argument is parsed as greedy one.
</para>
</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
<param name="method">HTTP method (GET, POST, DELETE, HEAD).</param>
</member>
<member name="M:SimpleHttp.Route.Add(System.String,SimpleHttp.HttpActionAsync,System.String)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="pattern">
String pattern optionally containing named arguments in {}.
<para>
Example: "/page-{pageNumber}/". 'pageNumber' will be parsed and added to 'arguments' key-value pair collection.
The last argument is parsed as greedy one.
</para>
</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
<param name="method">HTTP method (GET, POST, DELETE, HEAD).</param>
</member>
<member name="M:SimpleHttp.Route.Add(SimpleHttp.ShouldProcessFunc,SimpleHttp.HttpActionAsync)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="shouldProcess">Function defining whether the specified action should be executed or not.</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
</member>
<member name="M:SimpleHttp.Route.Add(SimpleHttp.ShouldProcessFunc,SimpleHttp.HttpAction)">
<summary>
Adds the specified action to the route collection.
<para>The order of actions defines the priority.</para>
</summary>
<param name="shouldProcess">Function defining whether the specified action should be executed or not.</param>
<param name="action">Action executed if the specified pattern matches the URL path.</param>
</member>
<member name="T:SimpleHttp.HttpServer">
<summary>
HTTP server listener class.
</summary>
</member>
<member name="M:SimpleHttp.HttpServer.ListenAsync(System.Int32,System.Threading.CancellationToken,System.Func{System.Net.HttpListenerRequest,System.Net.HttpListenerResponse,System.Threading.Tasks.Task},System.Boolean,System.Byte)">
<summary>
Creates and starts a new instance of the http(s) server.
</summary>
<param name="port">The http/https URI listening port.</param>
<param name="token">Cancellation token.</param>
<param name="onHttpRequestAsync">Action executed on HTTP request.</param>
<param name="useHttps">True to add 'https://' prefix insteaad of 'http://'.</param>
<param name="maxHttpConnectionCount">Maximum HTTP connection count, after which the incoming requests will wait (sockets are not included).</param>
<returns>Server listening task.</returns>
</member>
<member name="M:SimpleHttp.HttpServer.ListenAsync(System.String,System.Threading.CancellationToken,System.Func{System.Net.HttpListenerRequest,System.Net.HttpListenerResponse,System.Threading.Tasks.Task},System.Byte)">
<summary>
Creates and starts a new instance of the http(s) / websocket server.
</summary>
<param name="httpListenerPrefix">The http/https URI listening prefix.</param>
<param name="token">Cancellation token.</param>
<param name="onHttpRequestAsync">Action executed on HTTP request.</param>
<param name="maxHttpConnectionCount">Maximum HTTP connection count, after which the incoming requests will wait (sockets are not included).</param>
<returns>Server listening task.</returns>
</member>
<member name="T:SimpleHttp.Templating">
<summary>
Class defining methods for string or file pattern replacements.
</summary>
</member>
<member name="M:SimpleHttp.Templating.RenderFile(System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are specified in the replacements.
</summary>
<param name="fileName">File path with name.</param>
<param name="replacements">Key-value pair collection for replacements.</param>
<returns>Processed file content.</returns>
</member>
<member name="M:SimpleHttp.Templating.RenderString(System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are specified in the replacements.
</summary>
<param name="template">Template string.</param>
<param name="replacements">Key-value pair collection for replacements.</param>
<returns>Processed template.</returns>
</member>
<member name="M:SimpleHttp.Templating.RenderFile``1(System.String,``0)">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are defined as object property names and values.
</summary>
<typeparam name="T">Object type.</typeparam>
<param name="fileName">File path with name.</param>
<param name="obj">Object to use for replacements.</param>
<returns>Processed file content.</returns>
</member>
<member name="M:SimpleHttp.Templating.RenderString``1(System.String,``0)">
<summary>
Replaces all occurrences defined inside each {key} expression with values. Keys and values are defined as object property names and values.
</summary>
<typeparam name="T">Object type.</typeparam>
<param name="template">Template string.</param>
<param name="obj">Object to use for replacements.</param>
<returns>Processed file content.</returns>
</member>
</members>
</doc>

Binary file not shown.

View File

@ -1,6 +1,16 @@
The MIT License (MIT)
This Microsoft .NET Library may incorporate components from the projects listed
below. Microsoft licenses these components under the Microsoft .NET Library
software license terms. The original copyright notices and the licenses under
which Microsoft received such components are set forth below for informational
purposes only. Microsoft reserves all rights not expressly granted herein,
whether by implication, estoppel or otherwise.
Copyright (c) 2005 - 2015 Giacomo Stelluti Scala & Contributors
1. .NET Core (https://github.com/dotnet/core/)
.NET Core
Copyright (c) .NET Foundation and Contributors
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -9,13 +19,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,128 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT .NET LIBRARY
These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft
· updates,
· supplements,
· Internet-based services, and
· support services
for this software, unless other terms accompany those items. If so, those terms apply.
BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.
IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.
1. INSTALLATION AND USE RIGHTS.
a. Installation and Use. You may install and use any number of copies of the software to design, develop and test your programs.
b. Third Party Programs. The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.
2. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.
a. DISTRIBUTABLE CODE. The software is comprised of Distributable Code. “Distributable Code” is code that you are permitted to distribute in programs you develop if you comply with the terms below.
i. Right to Use and Distribute.
· You may copy and distribute the object code form of the software.
· Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.
ii. Distribution Requirements. For any Distributable Code you distribute, you must
· add significant primary functionality to it in your programs;
· require distributors and external end users to agree to terms that protect it at least as much as this agreement;
· display your valid copyright notice on your programs; and
· indemnify, defend, and hold harmless Microsoft from any claims, including attorneys fees, related to the distribution or use of your programs.
iii. Distribution Restrictions. You may not
· alter any copyright, trademark or patent notice in the Distributable Code;
· use Microsofts trademarks in your programs names or in a way that suggests your programs come from or are endorsed by Microsoft;
· include Distributable Code in malicious, deceptive or unlawful programs; or
· modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that
· the code be disclosed or distributed in source code form; or
· others have the right to modify it.
3. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
· work around any technical limitations in the software;
· reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;
· publish the software for others to copy;
· rent, lease or lend the software;
· transfer the software or this agreement to any third party; or
· use the software for commercial software hosting services.
4. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall the software.
5. DOCUMENTATION. Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.
6. EXPORT RESTRICTIONS. The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting.
7. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
8. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
9. APPLICABLE LAW.
a. United States. If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.
b. Outside the United States. If you acquired the software in any other country, the laws of that country apply.
10. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
11. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
FOR AUSTRALIA YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.
12. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
This limitation applies to
· anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and
· claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.
Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.
Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français.
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft naccorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, dadéquation à un usage particulier et dabsence de contrefaçon sont exclues.
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
Cette limitation concerne :
· tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et
· les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou dune autre faute dans la limite autorisée par la loi en vigueur.
Elle sapplique également, même si Microsoft connaissait ou devrait connaître léventualité dun tel dommage. Si votre pays nautorise pas lexclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou lexclusion ci-dessus ne sappliquera pas à votre égard.
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir dautres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.

View File

View File

View File

Binary file not shown.

0
packages/System.IO.4.3.0/lib/win8/_._ vendored Normal file
View File

0
packages/System.IO.4.3.0/lib/wp80/_._ vendored Normal file
View File

View File

View File

View File

View File

View File

View File

View File

View File

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More