Skip to content

Commit 44fdd73

Browse files
authored
First project source code upload
Uploaded the entire project for the first time
1 parent 663bfd3 commit 44fdd73

37 files changed

+7669
-0
lines changed

BLL/shortUrlCreator.cs

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
namespace urlShortner.Bll
2+
{
3+
public class shortUrlCreator
4+
{
5+
public static string shortner(string filePath)
6+
{
7+
string shortUrl;
8+
byte[] byteText;
9+
10+
using (System.IO.StreamReader fileReader = new System.IO.StreamReader(filePath))
11+
{
12+
byteText = System.Text.Encoding.ASCII.GetBytes(fileReader.ReadLine());
13+
14+
if (byteText[2] <= 122 && byteText[1] <= 122 && byteText[0] <= 122)
15+
{
16+
17+
if (byteText[2] < 122)
18+
{
19+
byteText[2] += 1;
20+
}
21+
else
22+
{
23+
24+
if (byteText[1] < 122)
25+
{
26+
byteText[2] = 97;
27+
byteText[1] += 1;
28+
}
29+
else
30+
{
31+
32+
if (byteText[0] < 122)
33+
{
34+
byteText[2] = 97;
35+
byteText[1] = 97;
36+
byteText[0] += 1;
37+
}
38+
else
39+
{
40+
// set letters to out of range!
41+
byteText[2] = 126;
42+
byteText[1] = 126;
43+
byteText[0] = 126;
44+
}
45+
46+
}
47+
48+
}
49+
50+
}
51+
else
52+
{
53+
// letters are out of range!
54+
byteText[2] = 82;
55+
byteText[1] = 82;
56+
byteText[0] = 69;
57+
}
58+
59+
}
60+
61+
using(System.IO.StreamWriter fileWriter = new System.IO.StreamWriter(filePath))
62+
{
63+
shortUrl = System.Text.Encoding.ASCII.GetString(byteText);
64+
fileWriter.WriteLine(shortUrl);
65+
}
66+
67+
return shortUrl;
68+
}
69+
}
70+
}

Program.cs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.Extensions.Configuration;
7+
using Microsoft.Extensions.Hosting;
8+
using Microsoft.Extensions.Logging;
9+
10+
namespace urlShortner
11+
{
12+
public class Program
13+
{
14+
public static void Main(string[] args)
15+
{
16+
CreateHostBuilder(args).Build().Run();
17+
}
18+
19+
public static IHostBuilder CreateHostBuilder(string[] args) =>
20+
Host.CreateDefaultBuilder(args)
21+
.ConfigureWebHostDefaults(webBuilder =>
22+
{
23+
webBuilder.UseStartup<Startup>();
24+
});
25+
}
26+
}

Startup.cs

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Builder;
6+
using Microsoft.AspNetCore.Hosting;
7+
using Microsoft.AspNetCore.Http;
8+
using Microsoft.Extensions.DependencyInjection;
9+
using Microsoft.Extensions.Hosting;
10+
11+
namespace urlShortner
12+
{
13+
public class Startup
14+
{
15+
// This method gets called by the runtime. Use this method to add services to the container.
16+
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
17+
public void ConfigureServices(IServiceCollection services)
18+
{
19+
services.AddRazorPages();
20+
}
21+
22+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
23+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
24+
{
25+
if (env.IsDevelopment())
26+
{
27+
app.UseDeveloperExceptionPage();
28+
}
29+
30+
app.UseRouting();
31+
32+
app.UseEndpoints(endpoints =>
33+
{
34+
endpoints.MapRazorPages();
35+
});
36+
}
37+
}
38+
}

appsettings.Development.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
}
9+
}

appsettings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
"AllowedHosts": "*"
10+
}

bin/Debug/netcoreapp3.1/LiteDB.dll

475 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:30271",
7+
"sslPort": 44393
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"urlShortner": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"applicationUrl": "https://localhost:5001;http://localhost:5000",
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
}
25+
}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
}
9+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
"AllowedHosts": "*"
10+
}
475 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
"AllowedHosts": "*"
10+
}
88.4 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)