OSDN Git Service

MMFへのアクセスをアンマネージドポインタ経由として高速化
[nmecab/NMeCabRepo2.git] / src / LibNMeCab / MeCabInvalidFileException.cs
1 //  MeCab -- Yet Another Part-of-Speech and Morphological Analyzer
2 //
3 //  Copyright(C) 2001-2006 Taku Kudo <taku@chasen.org>
4 //  Copyright(C) 2004-2006 Nippon Telegraph and Telephone Corporation
5 using System;
6 using System.Runtime.Serialization;
7 using System.Security.Permissions;
8 using System.Text;
9
10 namespace NMeCab
11 {
12     [Serializable]
13     public class MeCabInvalidFileException : MeCabException
14     {
15         public string FileName { get; private set; }
16
17         public override string Message
18         {
19             get
20             {
21                 StringBuilder os = new StringBuilder();
22                 os.Append(base.Message);
23                 if (this.FileName != null) os.AppendFormat("[FileName:{0}]", this.FileName);
24                 return os.ToString();
25             }
26         }
27
28         public MeCabInvalidFileException(string message, string fileName)
29             : base(message)
30         {
31             this.FileName = fileName;
32         }
33
34         public MeCabInvalidFileException(SerializationInfo info, StreamingContext context)
35             : base(info, context)
36         {
37             this.FileName = info.GetString("FileName");
38         }
39
40         [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
41         public override void GetObjectData(SerializationInfo info, StreamingContext context)
42         {
43             base.GetObjectData(info, context);
44             info.AddValue("FileName", this.FileName);
45         }
46     }
47 }