コード例 #1
0
        public SetResult Set(ScormSet set)
        {
            // strip off cmi. for test harness
            string element = set.GetIdentifier().Replace("cmi.", "");

            string commandstring = "Set " + element + " " + "\"" + set.GetValue() + "\"";

            parser.Process(commandstring);
            Console.WriteLine("API_1484_11.SetValue(\"" + set.GetIdentifier() + "\",\"" + set.GetValue() + "\");");
            return(SetResult.Ok);
        }
コード例 #2
0
        public SetResult Set(ScormSet set)
        {
            //  set = mConverter.Map2004_to_12(set);

            string commandstring = set.GetIdentifier() + " " + set.GetValue();

            commandstring = commandstring.Replace("._count", ".length");
            commandstring = commandstring.Substring(4);
            commandstring = "Set " + commandstring;
            parser.Process(commandstring);
            Console.WriteLine(commandstring);

            return(SetResult.Ok);
        }
コード例 #3
0
 ///<summary>
 ///Set a value on the javascript API
 ///</summary>
 ///<remarks>
 ///Implements the interface in ScormWrapper, and looks syncronous to the caller.
 ///</remarks>
 ///<returns>
 ///A SetResult enum with the return value of the set command
 ///</returns>
 ///<param name="identifier">
 ///the dot notation identifier of the data model element to get
 ///does the 2004/1.2 conversion.
 ///</param>
 public SetResult Set(ScormSet set)
 {
     if (set.GetValue() != "not_set")
     {
         int key = SetupCallback();
         Log("Set  " + set.GetIdentifier() + " to " + set.GetValue());
         UnityEngine.Application.ExternalCall("doSetValue", new object[] { set.GetIdentifier(), set.GetValue(), CallbackObjectName, CallbackFunctionName, key });
         APICallResult returnval = WaitForReturn(key);
         if (returnval.ErrorCode == "")
         {
             Log("Got " + returnval.Result);
             return(SetResult.Ok);
         }
         else
         {
             Log("Error:" + returnval.ErrorCode.ToString() + " " + returnval.ErrorDescription);
             return(SetResult.Error);
         }
     }
     return(SetResult.Ok);
 }
コード例 #4
0
        //Create a Set command for the identifier on top of the stack
        //NOTE: unlike GET, the last value on the SET stack is assumed to be the new value
        private void RecordStack(Type ExpectedDataType)
        {
            string total = "";

            //Add the dot notation
            System.Collections.ArrayList thiscommand = new System.Collections.ArrayList();
            foreach (string i in stack)
            {
                thiscommand.Add(i);
                thiscommand.Add(".");
            }

            //some string fixup
            thiscommand.Reverse();
            thiscommand.RemoveAt(thiscommand.Count - 2);
            string value = (string)thiscommand[thiscommand.Count - 1];

            thiscommand.RemoveAt(thiscommand.Count - 1);

            foreach (string i in thiscommand)
            {
                total += i;
            }
            //Total is not the name of the identifier
            //value is the value
            total = total.Substring(1);

            // add cmi. to all data model identifiers
            total = "cmi." + total;


            ScormSet ss = new ScormSet(total, value, ExpectedDataType);

            //set this on the serilization list
            //NOTE: we could just call the wrapper here directly
            wrapper.Set(ss);
        }
コード例 #5
0
 ///<summary>
 ///Set a value on the javascript API
 ///</summary>
 ///<remarks> 
 ///Implements the interface in ScormWrapper, and looks syncronous to the caller.
 ///</remarks>
 ///<returns>
 ///A SetResult enum with the return value of the set command
 ///</returns>
 ///<param name="identifier">
 ///the dot notation identifier of the data model element to get
 ///does the 2004/1.2 conversion.
 ///</param>
 public SetResult Set(ScormSet set)
 {
     if(set.GetValue() != "not_set")
     {
         int key = SetupCallback();
         Log( "Set  " + set.GetIdentifier() + " to " + set.GetValue());
         UnityEngine.Application.ExternalCall("doSetValue", new object[] { set.GetIdentifier(), set.GetValue(), CallbackObjectName, CallbackFunctionName, key });
         APICallResult returnval = WaitForReturn(key);
         if(returnval.ErrorCode == "")
         {
             Log("Got " + returnval.Result);
             return SetResult.Ok;
         }
         else
         {
             Log("Error:" + returnval.ErrorCode.ToString() + " " + returnval.ErrorDescription);
             return SetResult.Error;
         }
     }
     return SetResult.Ok;
 }
コード例 #6
0
        public SetResult Set(ScormSet set)
        {
            //  set = mConverter.Map2004_to_12(set);

            string commandstring = set.GetIdentifier() + " " + set.GetValue();
            commandstring = commandstring.Replace("._count", ".length");
            commandstring = commandstring.Substring(4);
            commandstring = "Set " + commandstring;
            parser.Process(commandstring);
            Console.WriteLine(commandstring);

            return SetResult.Ok;
        }
コード例 #7
0
        //Create a Set command for the identifier on top of the stack
        //NOTE: unlike GET, the last value on the SET stack is assumed to be the new value
        private void RecordStack(Type ExpectedDataType)
        {
            string total = "";
            //Add the dot notation
            System.Collections.ArrayList thiscommand = new System.Collections.ArrayList();
            foreach (string i in stack)
            {
                thiscommand.Add(i);
                thiscommand.Add(".");
            }

            //some string fixup
            thiscommand.Reverse();
            thiscommand.RemoveAt(thiscommand.Count - 2);
            string value = (string)thiscommand[thiscommand.Count - 1];
            thiscommand.RemoveAt(thiscommand.Count - 1);

            foreach (string i in thiscommand)
            {
                total += i;
            }
            //Total is not the name of the identifier
            //value is the value
            total = total.Substring(1);

            // add cmi. to all data model identifiers
            total = "cmi." + total;

            ScormSet ss = new ScormSet(total, value, ExpectedDataType);

            //set this on the serilization list
            //NOTE: we could just call the wrapper here directly
            wrapper.Set(ss);
        }
コード例 #8
0
        public SetResult Set(ScormSet set)
        {
            // strip off cmi. for test harness
            string element = set.GetIdentifier().Replace("cmi.", "");

            string commandstring = "Set " + element + " " + "\"" + set.GetValue() + "\"";
            parser.Process(commandstring);
            Console.WriteLine("API_1484_11.SetValue(\"" + set.GetIdentifier() + "\",\"" + set.GetValue() + "\");");
            return SetResult.Ok;
        }