14
|
1 // This file (FileLoadFailure.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard.
|
|
2 //
|
15
|
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
|
14
|
4
|
|
5 using System;
|
|
6 using System.IO;
|
|
7 using IBBoard.Lang;
|
|
8 using IBBoard.WarFoundry.API.Factories;
|
|
9
|
|
10 namespace IBBoard.WarFoundry.API
|
|
11 {
|
|
12 public class FileLoadFailure
|
|
13 {
|
|
14 private FileInfo failedFile;
|
|
15 private IWarFoundryFactory loadingFactory;
|
|
16 private string defaultMessage;
|
|
17 private string messageTranslationID;
|
|
18 private string message;
|
|
19
|
|
20 public FileLoadFailure(FileInfo file, string message) : this (file, message, "")
|
|
21 {
|
|
22 }
|
|
23
|
|
24 public FileLoadFailure(FileInfo file, string message, string translationID) : this (file, null, message, "")
|
|
25 {
|
|
26 }
|
|
27
|
|
28 public FileLoadFailure(FileInfo file, IWarFoundryFactory factory, string message) : this (file, factory, message, "")
|
|
29 {
|
|
30 }
|
|
31
|
|
32 public FileLoadFailure(FileInfo file,IWarFoundryFactory factory, string message, string translationID)
|
|
33 {
|
|
34 failedFile = file;
|
|
35 loadingFactory = factory;
|
|
36 defaultMessage = message;
|
|
37 messageTranslationID = translationID;
|
|
38 }
|
|
39
|
|
40 public FileInfo FailedFile
|
|
41 {
|
|
42 get
|
|
43 {
|
|
44 return failedFile;
|
|
45 }
|
|
46 }
|
|
47
|
|
48 public string Message
|
|
49 {
|
|
50 get
|
|
51 {
|
|
52 if (message == null)
|
|
53 {
|
|
54 if (messageTranslationID == "")
|
|
55 {
|
|
56 message = String.Format(defaultMessage, FailedFile, loadingFactory);
|
|
57 }
|
|
58 else
|
|
59 {
|
|
60 message = Translation.GetTranslation(messageTranslationID, defaultMessage, failedFile, loadingFactory);
|
|
61 }
|
|
62 }
|
|
63
|
|
64 return message;
|
|
65 }
|
|
66 }
|
|
67 }
|
|
68 }
|