예제 #1
0
 public static void GetAndSetLoliconApiKey()
 {
     if (manifestRequest == null)
     {
         manifestRequest = GetManifest();
     }
     LoliconApi.SetApiKey(manifestRequest?.data?.apikey);
 }
예제 #2
0
        private void customLoliconAPIkeyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var s = Interaction.InputBox("Please enter Lolicon API key string:", "自定义 Lolicon API 密匙");

            if (!(string.IsNullOrEmpty(s) || string.IsNullOrWhiteSpace(s)))
            {
                LoliconApi.SetApiKey(s);
            }
        }
예제 #3
0
        private SetuRequest QuerySetu()
        {
            SetuRequest result = null;

            do
            {
                try
                {
                    result = LoliconApi.QuerySetu(r18 ? LoliconApi.R18_ONLY : LoliconApi.NON_R18, num: SETU_PER_REQUEST,
                                                  size1200: SIZE_1200);
                }
                catch (ArgumentNullException)
                {
                }
            } while (result == null);
            switch (result?.code)
            {
            case LoliconApi.INTERNAL_ERROR:
                MessageBox.Show("遇到 Lolicon API 内部错误,请稍后尝试重载。", "警告");
                break;

            case LoliconApi.API_KEY_INVALID:
                MessageBox.Show("Lolicon API 反馈密匙无效,请稍后尝试自定义密匙。", "警告");
                break;

            case LoliconApi.BANED:
                MessageBox.Show("Lolicon API 拒绝了我们的请求,请稍后尝试自定义密匙。", "警告");
                break;

            case LoliconApi.REACHED_LIMIT:
                MessageBox.Show($"该密匙剩余请求额度为 {result?.quota} ,请稍后尝试自定义密匙。" +
                                $"\n或者等待 {result?.quota_min_ttl / 60 / 60} 小时 {result?.quota_min_ttl / 60 % 60}" +
                                $" 分 {result?.quota_min_ttl % 60 % 60} 秒。", "警告");
                break;
            }
            return(result);
        }