1 // OpenTween - Client of Twitter
2 // Copyright (c) 2017 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3 // All rights reserved.
5 // This file is part of OpenTween.
7 // This program is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by the Free
9 // Software Foundation; either version 3 of the License, or (at your option)
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 // You should have received a copy of the GNU General Public License along
18 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20 // Boston, MA 02110-1301, USA.
22 using System.Runtime.Serialization;
24 namespace OpenTween.Api.DataModel
27 public class TwitterTextConfiguration
29 [DataMember(Name = "version")]
30 public int Version { get; set; }
32 [DataMember(Name = "maxWeightedTweetLength")]
33 public int MaxWeightedTweetLength { get; set; }
35 [DataMember(Name = "scale")]
36 public int Scale { get; set; }
38 [DataMember(Name = "defaultWeight")]
39 public int DefaultWeight { get; set; }
41 [DataMember(Name = "transformedURLLength")]
42 public int TransformedURLLength { get; set; }
45 public class CodepointRange
47 [DataMember(Name = "start")]
48 public int Start { get; set; }
50 [DataMember(Name = "end")]
51 public int End { get; set; }
53 [DataMember(Name = "weight")]
54 public int Weight { get; set; }
57 [DataMember(Name = "ranges")]
58 public CodepointRange[] Ranges { get; set; }
60 /// <exception cref="SerializationException"/>
61 public static TwitterTextConfiguration ParseJson(string json)
63 return MyCommon.CreateDataFromJson<TwitterTextConfiguration>(json);
66 public static TwitterTextConfiguration DefaultConfiguration()
68 // 参照: https://github.com/twitter/twitter-text/blob/v2.0.5/config/v2.json
69 return new TwitterTextConfiguration
72 MaxWeightedTweetLength = 280,
75 TransformedURLLength = 23,
78 new CodepointRange { Start = 0, End = 4351, Weight = 100 },
79 new CodepointRange { Start = 8192, End = 8205, Weight = 100 },
80 new CodepointRange { Start = 8208, End = 8223, Weight = 100 },
81 new CodepointRange { Start = 8242, End = 8247, Weight = 100 },