Browse files


  • Loading branch information...
Copyleaks committed Dec 28, 2016
1 parent d1fadff commit 042819804951c1c1ba7e1f87f4627fe1b4bc4e2f
Showing with 50 additions and 17 deletions.
  1. +50 −17
@@ -26,53 +26,84 @@ Install-Package CopyleaksAPI
<p><a href="">Signup</a> to Copyleaks and confirm your account by clicking the link on the confirmation email. Generate your personal API key on your dashboard (<a href="">Businesses dashboard/</a><a href="">Academic dashboard/</a><a href="">Websites dashboard</a>) under 'Access Keys'. </p>
<p>For more information check out our <a href="">API guide</a>.</p>
<p>This code will show you where the textual content in the parameter ‘url’ has been used online:</p>
<p>This code will show you how to scan files or URLs for plagiarism:</p>
using System;
using System.Threading;
using Copyleaks.SDK.API;
using Copyleaks.SDK.API.Exceptions;
using Copyleaks.SDK.API.Models;
private static void Scan(string email, string apiKey, string url)
private static void Scan(string email, string apiKey)
CopyleaksCloud copyleaks = new CopyleaksCloud();
CopyleaksCloud copyleaks = new CopyleaksCloud(eProduct.Businesses);
CopyleaksProcess createdProcess;
ProcessOptions scanOptions = new ProcessOptions()
// SandboxMode = true // -------------------> Read more
ProcessOptions scanOptions = new ProcessOptions();
scanOptions.SandboxMode = true; // Sandbox mode --> Read more
ResultRecord[] results;
#region Login to Copyleaks cloud
Console.Write("Login to Copyleaks cloud...");
copyleaks.Login(email, apiKey);
#region Checking account balance
Console.Write("Checking account balance...");
uint creditsBalance = copyleaks.Credits;
Console.WriteLine("Done ({0} credits)!", creditsBalance);
if (creditsBalance == 0)
if (!scanOptions.SandboxMode && creditsBalance == 0)
Console.WriteLine("ERROR: You do not have enough credits to complete this scan. Your current credit balance is {0}).", creditsBalance);
Console.WriteLine("ERROR: You do not have enough credits to complete this scan. Your balance is {0}).", creditsBalance);
#region callbacks
// Add a URL address to get notified, using callbacks, once the scan results are ready.
//Read more
//scanOptions.HttpCallback = new Uri("{PID}");
//scanOptions.InProgressResultsCallback = new Uri("{PID}");
#region Submitting a new scan process to the server
Console.Write("Creating process...");
createdProcess = copyleaks.CreateByUrl(new Uri(url), scanOptions);
// Insert here the URL that you'd like to scan for plagiarism
createdProcess = copyleaks.CreateByUrl(new Uri(""), scanOptions);
// Insert here the file that you'd like to scan for plagiarism
//createdProcess = copyleaks.CreateByFile(new FileInfo("C:\FiletoScan.pdf"), scanOptions);
Console.WriteLine("Done (PID={0})!", createdProcess.PID);
#region Waiting for server's process completion
// Use this if you are not using callback
Console.Write("Scanning... ");
ushort currentProgress;
while (!createdProcess.IsCompleted(out currentProgress))
Console.WriteLine(currentProgress + "%");
#region Processing finished. Getting results
ResultRecord[] results = createdProcess.GetResults();
results = createdProcess.GetResults();
if (results.Length == 0)
Console.WriteLine("No results.");
@@ -81,13 +112,15 @@ private static void Scan(string email, string apiKey, string url)
for (int i = 0; i < results.Length; ++i)
Console.WriteLine("Result {0}:", i + 1);
Console.WriteLine("Url: {0}", results[i].URL);
Console.WriteLine("Percents: {0}", results[i].Percents);
Console.WriteLine("CopiedWords: {0}", results[i].NumberOfCopiedWords);
Console.WriteLine("Information: {0} copied words ({1}%)", results[i].NumberOfCopiedWords, results[i].Percents);
Console.WriteLine("Comparison report: {0}", results[i].ComparisonReport);
Console.WriteLine("Title: {0}", results[i].Title);
Console.WriteLine("Introduction: {0}", results[i].Introduction);
Console.WriteLine("Embeded comparison: {0}", results[i].EmbededComparison);
catch (UnauthorizedAccessException)
@@ -104,7 +137,7 @@ private static void Scan(string email, string apiKey, string url)
Console.WriteLine("*** Error {0}:", theError.CopyleaksErrorCode);
Console.WriteLine("{0}", theError.Message);

0 comments on commit 0428198

Please sign in to comment.