mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Show copyright strings only once.
This commit is contained in:
@@ -48,20 +48,10 @@ namespace DiscImageChef
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
object [] attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
|
||||
string AssemblyTitle = ((AssemblyTitleAttribute)attributes [0]).Title;
|
||||
attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
||||
Version AssemblyVersion = typeof(MainClass).Assembly.GetName().Version;
|
||||
string AssemblyCopyright = ((AssemblyCopyrightAttribute)attributes [0]).Copyright;
|
||||
|
||||
DicConsole.WriteLineEvent += System.Console.WriteLine;
|
||||
DicConsole.WriteEvent += System.Console.Write;
|
||||
DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine;
|
||||
|
||||
DicConsole.WriteLine("{0} {1}", AssemblyTitle, AssemblyVersion);
|
||||
DicConsole.WriteLine("{0}", AssemblyCopyright);
|
||||
DicConsole.WriteLine();
|
||||
|
||||
Settings.Settings.LoadSettings();
|
||||
Core.Statistics.LoadStats();
|
||||
|
||||
@@ -74,6 +64,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.Analyze.doAnalyze(opts);
|
||||
})
|
||||
.WithParsed<CompareOptions>(opts =>
|
||||
@@ -82,6 +73,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.Compare.doCompare(opts);
|
||||
})
|
||||
.WithParsed<ChecksumOptions>(opts =>
|
||||
@@ -90,6 +82,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.Checksum.doChecksum(opts);
|
||||
})
|
||||
|
||||
@@ -99,6 +92,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.Entropy.doEntropy(opts);
|
||||
})
|
||||
|
||||
@@ -108,6 +102,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.Verify.doVerify(opts);
|
||||
})
|
||||
|
||||
@@ -117,6 +112,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.PrintHex.doPrintHex(opts);
|
||||
})
|
||||
|
||||
@@ -126,6 +122,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.Decode.doDecode(opts);
|
||||
})
|
||||
|
||||
@@ -135,6 +132,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.DeviceInfo.doDeviceInfo(opts);
|
||||
})
|
||||
|
||||
@@ -144,6 +142,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.MediaInfo.doMediaInfo(opts);
|
||||
})
|
||||
|
||||
@@ -153,6 +152,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.MediaScan.doMediaScan(opts);
|
||||
})
|
||||
|
||||
@@ -162,6 +162,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.Formats.ListFormats(opts);
|
||||
})
|
||||
|
||||
@@ -171,6 +172,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.Benchmark.doBenchmark(opts);
|
||||
})
|
||||
|
||||
@@ -180,6 +182,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.CreateSidecar.doSidecar(opts);
|
||||
})
|
||||
|
||||
@@ -189,6 +192,7 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.DumpMedia.doDumpMedia(opts);
|
||||
})
|
||||
|
||||
@@ -198,15 +202,29 @@ namespace DiscImageChef
|
||||
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
|
||||
if(opts.Verbose)
|
||||
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
|
||||
PrintCopyright();
|
||||
Commands.DeviceReport.doDeviceReport(opts);
|
||||
})
|
||||
|
||||
.WithParsed<ConfigureOptions>(opts => { Commands.Configure.doConfigure();})
|
||||
.WithParsed<StatsOptions>(opts => { Commands.Statistics.showStats(); })
|
||||
.WithParsed<ConfigureOptions>(opts => { PrintCopyright(); Commands.Configure.doConfigure(); })
|
||||
.WithParsed<StatsOptions>(opts => { PrintCopyright(); Commands.Statistics.showStats(); })
|
||||
.WithNotParsed(errs => Environment.Exit(1));
|
||||
|
||||
Core.Statistics.SaveStats();
|
||||
}
|
||||
|
||||
static void PrintCopyright()
|
||||
{
|
||||
object[] attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
|
||||
string AssemblyTitle = ((AssemblyTitleAttribute)attributes[0]).Title;
|
||||
attributes = typeof(MainClass).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
||||
Version AssemblyVersion = typeof(MainClass).Assembly.GetName().Version;
|
||||
string AssemblyCopyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
||||
|
||||
DicConsole.WriteLine("{0} {1}", AssemblyTitle, AssemblyVersion);
|
||||
DicConsole.WriteLine("{0}", AssemblyCopyright);
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user