コード例 #1
0
    //  btnTestAPI.Text = ServiceType;


    protected void btnAddService_Click(object sender, EventArgs e)
    {
        database db = new database();
        // Get data:
        string ServiceType = dropServiceType.Text.ToString();

        if (ServiceType == "Sonarr")
        {
            // Pull a system status and return to label for now. -- Eventually do something with the data to prove its working.
            sonarr Sonar    = new sonarr();
            string rtnValue = Sonar.status(tbUrl.Text.ToString(), tbApiKey.Text.ToString());
            testJson.Text      = rtnValue;
            downloadQueue.Text = Sonar.queue(tbUrl.Text.ToString(), tbApiKey.Text.ToString());
            db.addUserDefinedServices(ServiceType, tbUrl.Text.ToString(), tbApiKey.Text.ToString());
        }
        if (ServiceType == "Plex")
        {
            db.addUserDefinedServices(ServiceType, tbUrl.Text.ToString(), tbApiKey.Text.ToString());
        }
        if (ServiceType == "Radarr")
        {
            db.addUserDefinedServices(ServiceType, tbUrl.Text.ToString(), tbApiKey.Text.ToString());
        }
        if (ServiceType == "Sabnzbd")
        {
            db.addUserDefinedServices(ServiceType, tbUrl.Text.ToString(), tbApiKey.Text.ToString());
        }
        // TODO: Switch this to a switch statement.
    }
コード例 #2
0
    protected void btnTestAPI_Click(object sender, EventArgs e)
    {
        // Create connection to database:
        database databaseObject = new database();



        // Determine what drop down value is selected:
        string ServiceType = dropServiceType.Text.ToString();

        if (ServiceType == "Sonarr")
        {
            // Pull a system status and return to label for now. -- Eventually do something with the data to prove its working.
            sonarr Sonar    = new sonarr();
            string rtnValue = Sonar.status(tbUrl.Text.ToString(), tbApiKey.Text.ToString());
            testJson.Text = rtnValue;
            // So far the following possibilities have returned:
            // 401 - unauthorized -- correct API key?
            // Dead host -- Couldn't work with the client.
            // Got back a JSON output of the system status.  -- Parse this for success?
            downloadQueue.Text = Sonar.queue(tbUrl.Text.ToString(), tbApiKey.Text.ToString());
        }
    }