MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / Main

Method Main

PathCopyCopySettings/Program.cs:90–177  ·  view source on GitHub ↗

The main entry point for the application.

(string[] args)

Source from the content-addressed store, hash-verified

88 /// The main entry point for the application.
89 /// </summary>
90 [STAThread]
91 static void Main(string[] args)
92 {
93 // Parse arguments.
94 PCCSettingsArgs pccArgs = new PCCSettingsArgs();
95 Parser.ParseArguments(args, pccArgs);
96
97 // Set bitness in PCC environment.
98 switch (pccArgs.bitness) {
99 case Bitness.x86: {
100 PCCEnvironment.Is64Bit = false;
101 break;
102 }
103 case Bitness.x64: {
104 PCCEnvironment.Is64Bit = true;
105 break;
106 }
107 case Bitness.Default: {
108 PCCEnvironment.Is64Bit = PCCEnvironment.Is64BitOS;
109 break;
110 }
111 default: {
112 Debug.Fail($"Unknown Bitness value: {pccArgs.bitness}");
113 PCCEnvironment.Is64Bit = PCCEnvironment.Is64BitOS;
114 break;
115 }
116 }
117
118 // Setup visual styles.
119 Application.EnableVisualStyles();
120 Application.SetCompatibleTextRenderingDefault(false);
121
122 // Set culture info to switch language if needed.
123 using (UserSettings settings = new UserSettings()) {
124 string language = settings.Language;
125 if (!string.IsNullOrWhiteSpace(language)) {
126 CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture(language);
127 Thread.CurrentThread.CurrentUICulture = cultureInfo;
128 Thread.CurrentThread.CurrentCulture = cultureInfo;
129 }
130 }
131
132 // Check if we need to simply check for updates.
133 if (pccArgs.updatecheck) {
134 // Make sure we only do this once.
135 using (new Mutex(true, UpdateCheckMutexName, out bool created)) {
136 if (!created) {
137 return;
138 }
139
140 using (UserSettings settings = new UserSettings()) {
141 try {
142 SoftwareUpdater updater = new SoftwareUpdater(settings);
143 updater.CheckForUpdate(null);
144 } catch (SoftwareUpdateException) {
145 // Silence this. Can't check for updates, too bad.
146 }
147 return;

Callers

nothing calls this directly

Calls 3

ParseArgumentsMethod · 0.80
CheckForUpdateMethod · 0.80
ApplyUserRevisionsMethod · 0.80

Tested by

no test coverage detected