コード例 #1
0
		private SettingStorage()
		{
			Account = new MSharp.Misskey(Config.Appkey, new Uri("http://api.misskey.xyz/"));
			PostTextFormat = "<number>. <title> / <artist> - <album> (played: <playcount>)\r\n<usercomment>";
			TargetPlayer = PlayerType.None;
			IsAutoPost = false;
			AutoPostInterval = 10;
        }
コード例 #2
0
		/// <summary>
		/// 設定を読み込みます
		/// </summary>
		public async Task Load()
		{
			await await Task.Factory.StartNew(async () =>
			{
				if (!System.IO.File.Exists("setting.json"))
				{
					await this.Save();
				}
				using (var sr = new System.IO.StreamReader("setting.json"))
				{
					// Load
					var j = JsonObject.Load(sr).AsDynamic();

					if (j.UserKey != null)
						Account = new MSharp.Misskey(Account.AppKey, j.UserKey.Value, null);

					if (!string.IsNullOrEmpty(j.BaseUrl.Value))
						Account.BaseUrl = new Uri(j.BaseUrl.Value);

					if (j.PostTextFormat != null)
						PostTextFormat = j.PostTextFormat.Value;

					if (j.TargetPlayer.Value != null)
						TargetPlayer = (PlayerType)j.TargetPlayer.Value;

					if (j.IsAutoPost != null)
						IsAutoPost = j.IsAutoPost.Value;

					if (j.AutoPostInterval != null)
						AutoPostInterval = j.AutoPostInterval.Value;
				}
			});
		}