示例#1
0
 public TinCanInterface(string endpoint, string user, string password)
 {
     this.endpoint = endpoint;
     this.user     = user;
     this.pass     = password;
     this.lrs      = new RemoteLRS(endpoint, user, password);
 }
示例#2
0
        /// <summary>
        /// Changes the configuration.
        /// </summary>
        /// <param name="endpoint">The endpoint.</param>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        public void ChangeConfig(string endpoint, string username, string password)
        {
            _endpoint = string.IsNullOrWhiteSpace(username) ? "https://cloud.scorm.com/tc/U2S4SI5FY0/sandbox/" : endpoint;
            _username = string.IsNullOrWhiteSpace(username) ? "Nja986GYE1_XrWMmFUE" : username;
            _password = string.IsNullOrWhiteSpace(password) ? "Bd9lDr1kjaWWY6RID_4" : password;

            _lrs = new RemoteLRS(_endpoint, _username, _password);
        }
示例#3
0
        public void TestEmptyCtr()
        {
            var obj = new RemoteLRS();

            Assert.IsType <RemoteLRS>(obj);
            Assert.Null(obj.endpoint);
            Assert.Null(obj.auth);
            Assert.Null(obj.version);
        }
示例#4
0
        public void TestEmptyCtr()
        {
            var obj = new RemoteLRS();

            Assert.IsInstanceOf <RemoteLRS>(obj);
            //Assert.IsNull(obj.Endpoint);
            Assert.IsNull(obj.Auth);
            Assert.IsNull(obj.Version);
        }
示例#5
0
        public void TestEmptyCtr()
        {
            var obj = new RemoteLRS();

            //Assert.IsInstanceOf<RemoteLRS>(obj);
            Assert.IsInstanceOfType(obj, new RemoteLRS().GetType());
            Assert.IsNull(obj.endpoint);
            Assert.IsNull(obj.auth);
            Assert.IsNull(obj.version);
        }
示例#6
0
    void Start()
    {
        hazardsIdentified = new List <HazardType> ();
        totalHazardTypes  = System.Enum.GetValues(typeof(HazardType)).Length;
        ResetSimulation();

        ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;

        lrs = new RemoteLRS(WatershedCredentials.ENDPOINT, WatershedCredentials.KEY, WatershedCredentials.SECRET);
    }
 public RemoteLRSResourceTest()
 {
     //
     // these are credentials used by the other OSS libs when building via Travis-CI
     // so are okay to include in the repository, if you wish to have access to the
     // results of the test suite then supply your own endpoint, username, and password
     //
     lrs = new RemoteLRS(
         "https://cloud.scorm.com/tc/U2S4SI5FY0/sandbox/",
         "Nja986GYE1_XrWMmFUE",
         "Bd9lDr1kjaWWY6RID_4"
         );
 }
示例#8
0
        public void Init()
        {
            Console.WriteLine("Running " + TestContext.CurrentContext.Test.FullName);

            //
            // these are credentials used by the other OSS libs when building via Travis-CI
            // so are okay to include in the repository, if you wish to have access to the
            // results of the test suite then supply your own endpoint, username, and password
            //
            lrs = new RemoteLRS(
                "https://cloud.scorm.com/tc/U2S4SI5FY0/sandbox/",
                "Nja986GYE1_XrWMmFUE",
                "Bd9lDr1kjaWWY6RID_4"
                );
        }
        static void Main(string[] args)
        {
            var lrs = new RemoteLRS(
                "https://lrs.adlnet.gov/xAPI/", //adlnet üzerinde lrs endpointi başka bir lrs de kullanılabilir.
                "username",
                "password"
                );

            var actor = new Agent();

            actor.mbox = "mailto:[email protected]";

            var verb = new Verb();

            verb.id      = new Uri("http://adlnet.gov/expapi/verbs/experienced");
            verb.display = new LanguageMap();
            verb.display.Add("en-US", "experienced");

            var activity = new Activity();

            activity.id = new Uri("http://rusticisoftware.github.io/TinCan.NET").ToString();

            var statement = new Statement();

            statement.actor  = actor;
            statement.verb   = verb;
            statement.target = activity;

            StatementLRSResponse lrsResponse = lrs.SaveStatement(statement);

            if (lrsResponse.success)
            {
                // Updated 'statement' here, now with id
                Console.WriteLine("Save statement: " + lrsResponse.content.id);
            }
            else
            {
                // Do something with failure
            }

            Console.Read();
        }
示例#10
0
        public void CreateStatement(string shortVerb, HttpRequest Request)
        {
            _request = Request;


            Verb verb;

            if (!ValidateVerb(shortVerb))
            {
                throw new Exception("Supplied Verb is not in the map of valid verbs (Check spelling or usage?)");
            }
            else
            {
                // Create the verb using the supplied shortverb
                verb = CreateVerb(shortVerb);
            }



            string fetched_username = "";
            string fetched_password = "";
            // Connect to the LRS
            var endpoint = _request.QueryString["endpoint"];

            var actorJSON = string.IsNullOrEmpty(_request.QueryString["actor"]) ? null : JsonConvert.DeserializeObject <ActorJSON>(_request.QueryString["actor"]);

            if (actorJSON != null)
            {
                //Get the username
                fetched_username = actorJSON.account.name.Split('|')[1];
                // Get the password
                fetched_password = actorJSON.account.name.Split('|')[0];
            }

            // Lets try and mash the enpoint out of the Query String
            _lrs = string.IsNullOrEmpty(endpoint) ? ConnectLrs(_username, _password) : ConnectLrs(_username, _password, endpoint);



            // Create the statement context
            var context = new Context();

            //Create the actor (of type agent)
            var actor = CreateActor(context);

            // Define the activity
            var activity = CreateActivity();

            var state1 = _lrs.auth;
            var state  = _lrs.RetrieveState("", activity, actor, context.registration);
            // Debug.WriteLine("\n \n \n State Doc?: \n" + state.content.ToString() + "\n\nAuth:" + state1 + "\n\n");

            // Define the statement
            var statement = new Statement()
            {
                actor   = actor,
                verb    = verb,
                target  = activity,
                context = context,
            };

            SendStatement(statement);
        }
示例#11
0
    void SendMessage(string playerName, string email)
    {
        float health  = FindObjectOfType <PlayerController>().health;
        float stamina = FindObjectOfType <PlayerController>().stamina;

        ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;

        var lrs = new RemoteLRS(
            "https://cloud.scorm.com/tc/B0MLOLLYBS/sandbox/",
            "*****@*****.**",
            "Abcd1234"
            );

        var actor = new Agent();

        //actor.mbox = "mailto:[email protected]";
        actor.mbox = "mailto:" + email;
        actor.name = playerName;

        var verb = new Verb();

        verb.id      = new Uri("http://activitystrea.ms/schema/1.0/submit");
        verb.display = new LanguageMap();
        verb.display.Add("en-US", "submitted");

        var activity = new Activity();

        //id
        activity.id = "http://adlnet.gov/expapi/activities/performance";

        //definition
        activity.definition = new ActivityDefinition();

        //definition name
        activity.definition.name = new LanguageMap();
        activity.definition.name.Add("en-US", "Stamina");

        //definition description
        activity.definition.description = new LanguageMap();
        activity.definition.description.Add("en-US", "The Player's Stamina Score");

        //definition type
        activity.definition.type = new Uri("http://adlnet.gov/expapi/activities/performance");

        //result
        var result = new Result();

        result.completion = true;
        result.success    = true;
        result.score      = new Score();
        result.score.raw  = stamina;

        //declaring the full statement
        var statement = new Statement();

        statement.actor  = actor;
        statement.verb   = verb;
        statement.target = activity;
        statement.result = result;


        StatementLRSResponse lrsResponse = lrs.SaveStatement(statement);

        if (lrsResponse.success)
        {
            // Updated 'statement' here, now with id
            Debug.Log("Save statement: " + lrsResponse.content.id);
        }
        else
        {
            // Do something with failure
            Debug.Log("YOU SUCK!");
        }
    }
    public void ReportScore()
    {
        ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;

        var lrs = new RemoteLRS(
            "https://cloud.scorm.com/tc/B0MLOLLYBS/sandbox/",
            "*****@*****.**",
            "Abcd1234"
            );

        var actor = new Agent();

        //actor.mbox = "mailto:[email protected]";
        actor.mbox = "mailto:" + email;
        actor.name = playerName;

        var verb = new Verb();

        verb.id      = new Uri("http://activitystrea.ms/schema/1.0/submit");
        verb.display = new LanguageMap();
        verb.display.Add("en-US", "submitted");

        var activity = new Activity();

        //id
        activity.id = "http://adlnet.gov/expapi/activities/assessment";

        //definition
        activity.definition = new ActivityDefinition();

        //definition name
        activity.definition.name = new LanguageMap();
        activity.definition.name.Add("en-US", "Assessment");

        //definition description
        activity.definition.description = new LanguageMap();
        activity.definition.description.Add("en-US", "A collection of questions");

        //definition type
        activity.definition.type = new Uri("http://adlnet.gov/expapi/activities/assessment");

        //result
        var result = new Result();

        result.completion = true;
        result.success    = wasSuccessful;
        result.score      = new Score();
        result.score.raw  = score * 100;

        //declaring the full statement
        var statement = new Statement();

        statement.actor  = actor;
        statement.verb   = verb;
        statement.target = activity;
        statement.result = result;


        StatementLRSResponse lrsResponse = lrs.SaveStatement(statement);

        if (lrsResponse.success)
        {
            // Updated 'statement' here, now with id
            Debug.Log("Score Reported: " + lrsResponse.content.id);
        }
        else
        {
            // Do something with failure
            Debug.Log("Failure to Report Score");
        }
    }
    public void ReportLogOut()
    {
        ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;

        var lrs = new RemoteLRS(
            "https://cloud.scorm.com/tc/B0MLOLLYBS/sandbox/",
            "*****@*****.**",
            "Abcd1234"
            );

        var actor = new Agent();

        //actor.mbox = "mailto:[email protected]";
        actor.mbox = "mailto:" + email;
        actor.name = playerName;

        var verb = new Verb();

        verb.id      = new Uri("https://brindlewaye.com/xAPITerms/verbs/loggedout/");
        verb.display = new LanguageMap();
        verb.display.Add("en-US", "Logged Out Of");

        var activity = new Activity();

        //id
        activity.id = "http://activitystrea.ms/schema/1.0/application";

        //definition
        activity.definition = new ActivityDefinition();

        //definition name
        activity.definition.name = new LanguageMap();
        activity.definition.name.Add("en-US", "Missile Training App");

        //definition description
        activity.definition.description = new LanguageMap();
        activity.definition.description.Add("en-US", "MTSI's Missile Training Application");

        //definition type
        activity.definition.type = new Uri("http://activitystrea.ms/schema/1.0/application");

        //declaring the full statement
        var statement = new Statement();

        statement.actor  = actor;
        statement.verb   = verb;
        statement.target = activity;


        StatementLRSResponse lrsResponse = lrs.SaveStatement(statement);

        if (lrsResponse.success)
        {
            // Updated 'statement' here, now with id
            Debug.Log("Log Out Reported: " + lrsResponse.content.id);
            lrsError = false;
        }
        else
        {
            // Do something with failure
            Debug.Log("Failed To Log Out");
            lrsError = true;
        }
    }
    public void ReportArTime()
    {
        ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;

        var lrs = new RemoteLRS(
            "https://cloud.scorm.com/tc/B0MLOLLYBS/sandbox/",
            "*****@*****.**",
            "Abcd1234"
            );

        var actor = new Agent();

        //actor.mbox = "mailto:[email protected]";
        actor.mbox = "mailto:" + email;
        actor.name = playerName;

        var verb = new Verb();

        verb.id      = new Uri("http://id.tincanapi.com/verb/viewed");
        verb.display = new LanguageMap();
        verb.display.Add("en-US", "viewed");

        var activity = new Activity();

        //id
        activity.id = "http://adlnet.gov/expapi/activities/module";

        //definition
        activity.definition = new ActivityDefinition();

        //definition name
        activity.definition.name = new LanguageMap();
        activity.definition.name.Add("en-US", "Augmented Reality Missile");

        //definition description
        activity.definition.description = new LanguageMap();
        activity.definition.description.Add("en-US", "A view of the missile in augmented reality");

        //definition type
        activity.definition.type = new Uri("http://adlnet.gov/expapi/activities/module");

        //result
        var result = new Result();

        result.completion = true;
        result.success    = wasSuccessful;
        result.score      = new Score();
        result.score.raw  = arTimer;

        //declaring the full statement
        var statement = new Statement();

        statement.actor  = actor;
        statement.verb   = verb;
        statement.target = activity;
        statement.result = result;


        StatementLRSResponse lrsResponse = lrs.SaveStatement(statement);

        if (lrsResponse.success)
        {
            // Updated 'statement' here, now with id
            Debug.Log("AR Model Viewing Time Reported: " + lrsResponse.content.id);
        }
        else
        {
            // Do something with failure
            Debug.Log("Failure to Report Time Spent Viewing AR Model");
        }
    }
示例#15
0
 public static void Init()
 {
     lrs = new RemoteLRS(_endpoint, _key, _secret_key);
 }
示例#16
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 /// <exception cref="System.NotImplementedException"></exception>
 public void Dispose()
 {
     _lrs = null;
 }
示例#17
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 void IDisposable.Dispose()
 {
     _lrs = null;
 }