forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
51 lines (45 loc) · 1.38 KB
/
Copy pathProgram.cs
File metadata and controls
51 lines (45 loc) · 1.38 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
48
49
50
51
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace IndexCreationTool
{
using Microsoft.WinGetSourceCreator;
using System;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using WinGetSourceCreator.Model;
class Program
{
private static void PrintUsage()
{
Console.WriteLine("Usage: IndexCreationTool.exe -f <local source input json file>");
}
static int Main(string[] args)
{
try
{
string inputFile = string.Empty;
for (int i = 0; i < args.Length; i++)
{
if (args[i] == "-f" && ++i < args.Length)
{
inputFile = args[i];
}
}
if (string.IsNullOrEmpty(inputFile) || !File.Exists(inputFile))
{
PrintUsage();
throw new ArgumentException("Missing input file");
}
WinGetLocalSource.CreateFromLocalSourceFile(inputFile);
}
catch (Exception e)
{
PrintUsage();
Console.WriteLine(e.Message);
return -1;
}
return 0;
}
}
}