-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
47 lines (42 loc) · 1.18 KB
/
Program.cs
File metadata and controls
47 lines (42 loc) · 1.18 KB
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
using System.Text;
namespace Merger
{
class Programm
{
public static void Main(String[] args)
{
Console.WriteLine("Absolute path:");
var path = Console.ReadLine();
Console.WriteLine("Main class name (optional):");
var mainClass = Console.ReadLine();
Console.WriteLine("New file name:");
var name = Console.ReadLine();
var merger = new Merger(new DirectoryInfo(path), mainClass);
merger.Read();
var file = merger.Merge(name);
file.Write();
}
}
static class StringExtention
{
public static int Count(this string line, char charToCount)
{
if (line == null) return 0;
var cnt = 0;
foreach (var e in line)
{
if (e == charToCount) cnt++;
}
return cnt;
}
public static string Multyply(this string line, int times)
{
var sb = new StringBuilder("");
for (var i = 0; i < times; i++)
{
sb.Append(line);
}
return sb.ToString();
}
}
}