This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJobApplication.cs
66 lines (61 loc) · 2.49 KB
/
JobApplication.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (C) 2020 Sascha Manns <Sascha.Manns@outlook.de>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Dependencies
using BitlyAPI;
using System.Threading.Tasks;
namespace latex_curriculum_vitae
{
/// <summary>
/// This is a class for instancing the JobApplication object
/// </summary>
internal class JobApplication
{
public string URL { get; set; }
public string Email { get; set; }
public string Jobtitle { get; set; }
public string SubjectPrefix { get; set; }
/// <summary>
/// That Constructor creates the JobApplication object by using the arguments.
/// </summary>
/// <param name="aurl">comes directly from the gui txtUrl.Text</param>
/// <param name="aemail">comes directly from the gui txtEmail.Text</param>
/// <param name="ajobtitle">comes directly from the gui txtJobtitle.Text</param>
public JobApplication(string aurl, string aemail, string ajobtitle)
{
URL = aurl;
Email = aemail;
Jobtitle = FixJobApplication(ajobtitle);
SubjectPrefix = Properties.Resources.Subjectprefix;
}
/// <summary>
/// This method gets the jobtitle and escapes the hash symbol and the ampersand. Otherwise it breaks the LaTEX build.
/// </summary>
/// <param name="ajobtitle">comes from the constructor.</param>
/// <returns></returns>
public string FixJobApplication(string ajobtitle)
{
string _prepare = ajobtitle;
_prepare = _prepare.Replace(@"#", @"\#");
_prepare = _prepare.Replace(@"&", @"\&");
return _prepare;
}
public async Task UseBitLy(string apkikey, string url)
{
var bitly = new Bitly(apkikey);
var linkResponse = await bitly.PostShorten(url);
URL = linkResponse.Link;
}
}
}