Example #1
0
        public ActionResult Index()
        {
            string     asin = "B07Z93JQS6";
            AmazonTest tst  = new AmazonTest();

            //CSObject obj = tst.test("B07MWLD3VX");
            //List <MainASINs> lstmainASINs = dAmazon.getEnabledASINs();

            //foreach (MainASINs mainASINs in lstmainASINs)
            //{
            try
            {
                //currentASIN = mainASINs.ASIN;
                CSObject objCountStock = amzAutomation.test(asin);

                if (objCountStock != null)
                {
                    dAmazon.InsertTrackingRecord(objCountStock);
                }
                //System.Threading.Thread.Sleep(10 * 1000);
            }
            catch (Exception ex)
            {
            }


            return(View());
        }
Example #2
0
        public void TrackASINs(int groupId)
        {
            DAmazon    dAmazon       = new DAmazon();
            AmazonTest amzAutomation = new AmazonTest();

            List <MainASINs> lstmainASINs = dAmazon.getEnabledASINs(groupId);

            foreach (MainASINs mainASINs in lstmainASINs)
            {
                try
                {
                    CSObject objCountStock = amzAutomation.test(mainASINs.ASIN);

                    if (objCountStock != null)
                    {
                        dAmazon.InsertTrackingRecord(objCountStock);
                    }
                }
                catch (Exception ex)
                {
                }
                System.Threading.Thread.Sleep(2 * 60 * 1000); // 1.5 Minute
            }
            GC.Collect();
        }
Example #3
0
        public void TestNewGenericWithArrayType()
        {
            CSNode   root = ParseScript("CSScript.Test.GenericOne<int[]> a = new CSScript.Test.GenericOne<int[]>(new int[] {1,2,3});");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual(typeof(CSScript.Test.GenericOne <int[]>), obj.Type);
        }
Example #4
0
 protected override void ProcessRecord()
 {
     if (this.ID != Guid.Empty)
     {
         using (CSObject csobject = this.MAInstance.GetCSObject(this.ID)) {
             this.WriteObject(csobject);
         }
         return;
     }
     else if (!string.IsNullOrWhiteSpace(this.DN))
     {
         if (this.IncludeSubTree.IsPresent)
         {
             using (CSObjectEnumerator csobjects = this.MAInstance.GetCSObjects(this.DN, true)) {
                 this.WriteObject(csobjects, true);
             }
         }
         else
         {
             using (CSObject csobject = this.MAInstance.GetCSObject(this.DN))
             {
                 this.WriteObject(csobject);
             }
         }
         return;
     }
     else if (!string.IsNullOrWhiteSpace(this.Rdn))
     {
         using (CSObjectEnumerator csobjects = this.MAInstance.GetCSObjects(this.Rdn))
         {
             this.WriteObject(csobjects, true);
         }
         return;
     }
 }
Example #5
0
        public void TestStaticProperty()
        {
            CSNode   root = ParseScript("CSScript.Test.Simple.Hoge = \"HelloWorld\"; CSScript.Test.Simple.Hoge;");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual("Hoge", obj.Name);
            Assert.AreEqual("HelloWorld", obj.GetAs <string> ());
        }
Example #6
0
        public void TestStaticVariable()
        {
            CSNode   root = ParseScript("CSScript.Test.Simple.HELLO = \"HelloWorld\"; CSScript.Test.Simple.HELLO;");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual("HELLO", obj.Name);
            Assert.AreEqual("HelloWorld", obj.GetAs <string> ());
        }
Example #7
0
        public void TestTypeDictionaryAraray()
        {
            CSNode   root = ParseScript("System.Collections.Generic.Dictionary<string, int>[] a = new System.Collections.Generic.Dictionary<string, int>[3];");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual(typeof(System.Collections.Generic.Dictionary <string, int>[]), obj.Type);
            Assert.AreEqual(3, obj.GetAs <System.Collections.Generic.Dictionary <string, int>[]> ().Length);
        }
Example #8
0
        public CSObject CacheFunc(pfunc func)
        {
            CSObject o = new CSObject();

            o.type = CSType.SHARPFUNCTION;
            o.v32  = cache.AddKey(func);
            return(o);
        }
Example #9
0
        public void TestNewInnerClass()
        {
            CSNode   root = ParseScript("CSScript.Test.Simple.Inner a = new CSScript.Test.Simple.Inner (33);");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual(typeof(CSScript.Test.Simple.Inner), obj.Type);
            Assert.AreEqual(33, obj.GetAs <CSScript.Test.Simple.Inner> ()._a);
        }
Example #10
0
        public void TestTypeIntArray()
        {
            CSNode   root = ParseScript("int[] a = new int[3];");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual(typeof(int[]), obj.Type);
            Assert.AreEqual(3, obj.GetAs <int[]> ().Length);
        }
Example #11
0
        public void AssignInt()
        {
            CSNode   root = ParseScript("var myVar = 3;");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual("myVar", obj.Name);
            Assert.AreEqual(3, obj.Value);
        }
Example #12
0
        public void TestLocalVariable2()
        {
            CSNode   root = ParseScript("CSScript.Test.Simple s = new CSScript.Test.Simple(33); int b = s._a;");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual("b", obj.Name);
            Assert.AreEqual(33, obj.GetAs <int> ());
        }
Example #13
0
        public void TestLocalVariable()
        {
            CSNode   root = ParseScript("int a = 33; int b = a;");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual("b", obj.Name);
            Assert.AreEqual(33, obj.GetAs <int> ());
        }
Example #14
0
        public CSObject CacheObj(object obj)
        {
            CSObject o = new CSObject();

            o.type = CSType.SHARPOBJECT;
            o.v32  = cache.AddKey(obj);
            return(o);
        }
Example #15
0
        public void TypedVarSimple()
        {
            CSNode   root = ParseScript("CSScript.Test.Simple a = new CSScript.Test.Simple(3);");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual("a", obj.Name);
            Assert.AreEqual(typeof(Simple), obj.Type);
            Assert.AreEqual(3, obj.GetAs <Simple> ()._a);
        }
Example #16
0
        public void TypedVarInt()
        {
            CSNode   root = ParseScript("int a = 3;");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual("a", obj.Name);
            Assert.AreEqual(typeof(int), obj.Type);
            Assert.AreEqual(3, obj.Value);
        }
Example #17
0
        public void Declaration()
        {
            CSNode root = ParseScript("var myVar;");

            CSObject obj = root.Evaluate();

            Assert.AreEqual("myVar", obj.Name);
            Assert.AreEqual(null, obj.Value);
        }
Example #18
0
        public void NewArrayInt()
        {
            CSNode   root = ParseScript("var a = new int[32];");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual(typeof(int[]), obj.Type);
            int[] arr = obj.GetAs <int[]> ();
            Assert.AreEqual(32, arr.Length);
        }
Example #19
0
        public void NewArrayList()
        {
            CSNode   root = ParseScript("var a = new System.Collections.Generic.List<int>[2];");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual(typeof(List <int>[]), obj.Type);
            List <int>[] arr = obj.GetAs <List <int>[]> ();
            Assert.AreEqual(2, arr.Length);
        }
Example #20
0
		public void TestStaticMethod () {
			CSNode root = ParseScript (
				"string a = CSScript.Test.Simple.StaticMethod(\"moge\");"
			);
			
			CSObject obj = root.Evaluate ();
			Assert.AreEqual ("a", obj.Name);
			Assert.AreEqual ("moge", obj.GetAs<string> ());
		}
Example #21
0
		public void TestMethodIntWrongCall () {
			CSNode root = ParseScript (
				"int a = CSScript.Test.Simple.GetInt();"
			);

			Assert.Throws<System.MissingMethodException> (() => {
				CSObject obj = root.Evaluate ();
			}, "static method: GetInt cannot be found in CSScript.Test.Simple");
		}
Example #22
0
        public void TestNewInnerGenericClass()
        {
            CSNode   root = ParseScript("CSScript.Test.GenericOne<int>.Inner<float, string> a = new CSScript.Test.GenericOne<int>.Inner<float, string>(3.3f, \"hoge\");");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual(typeof(CSScript.Test.GenericOne <int> .Inner <float, string>), obj.Type);
            Assert.AreEqual(3.3f, obj.GetAs <CSScript.Test.GenericOne <int> .Inner <float, string> > ()._a);
            Assert.AreEqual("hoge", obj.GetAs <CSScript.Test.GenericOne <int> .Inner <float, string> > ()._b);
        }
Example #23
0
        public void NewSimpleClass()
        {
            CSNode root = ParseScript("var a = new CSScript.Test.Simple();");

            CSObject obj = root.Evaluate();

            Assert.AreEqual("a", obj.Name);
            Assert.AreEqual(typeof(CSScript.Test.Simple), obj.Value.GetType());
        }
Example #24
0
        public void TestStaticVariable2()
        {
            CSNode root = ParseScript(
                "CSScript.Test.GenericOne<int>._s = new CSScript.Test.Simple (34);" +
                "int a = CSScript.Test.GenericOne<int>._s._a;");
            CSObject obj = root.Evaluate();

            Assert.AreEqual("a", obj.Name);
            Assert.AreEqual(34, obj.GetAs <int> ());
        }
Example #25
0
		public void TestMethodInt () {
			CSNode root = ParseScript (
				"CSScript.Test.Simple s = new CSScript.Test.Simple(55);\n" +
				"int a = s.GetInt();"
			);

			CSObject obj = root.Evaluate ();
			Assert.AreEqual ("a", obj.Name);
			Assert.AreEqual (55, obj.GetAs<int> ());
		}
Example #26
0
        public void TestLocalVariable3()
        {
            CSNode root = ParseScript(
                "CSScript.Test.Simple s = new CSScript.Test.Simple(33);\n" +
                "CSScript.Test.GenericOne<CSScript.Test.Simple> g = new CSScript.Test.GenericOne<CSScript.Test.Simple>(s);\n" +
                "int b = g._pa._a;");
            CSObject obj = root.Evaluate();

            Assert.AreEqual("b", obj.Name);
            Assert.AreEqual(33, obj.GetAs <int> ());
        }
Example #27
0
        protected void CacheLog()
        {
            CSObject[] args = new CSObject[2];
            CSObject   cso  = CacheFunc(Log);

            args[0]      = cso;
            args[1]      = new CSObject();
            args[1].type = CSType.NIL;

            sharpc_log(_sharpc, args);
        }
Example #28
0
        public void NewSimpleClassArgsRef()
        {
            CSNode root = ParseScript("var a = new CSScript.Test.Simple(new CSScript.Test.Simple());");

            CSObject obj = root.Evaluate();

            Assert.AreEqual("a", obj.Name);

            Assert.AreEqual(typeof(CSScript.Test.Simple), obj.Value.GetType());
            CSScript.Test.Simple s = obj.Value as CSScript.Test.Simple;
            Assert.AreNotEqual(null, s._i);
        }
Example #29
0
        public void NewSimpleClassArgsString()
        {
            CSNode root = ParseScript("var a = new CSScript.Test.Simple(\"hello\");");

            CSObject obj = root.Evaluate();

            Assert.AreEqual("a", obj.Name);

            Assert.AreEqual(typeof(CSScript.Test.Simple), obj.Value.GetType());
            CSScript.Test.Simple s = obj.Value as CSScript.Test.Simple;
            Assert.AreEqual("hello", s._s);
        }
Example #30
0
        public void NewInitializerClassArray()
        {
            CSNode   root = ParseScript("var a = new CSScript.Test.Simple[]{new CSScript.Test.Simple(1), new CSScript.Test.Simple(2)};");
            CSObject obj  = root.Evaluate();

            Assert.AreEqual(typeof(Simple[]), obj.Type);
            Simple[] arr = obj.GetAs <Simple[]> ();
            Assert.AreEqual(2, arr.Length);

            Assert.AreEqual(1, arr[0]._a);
            Assert.AreEqual(2, arr[1]._a);
        }
Example #31
0
		internal CSFieldValue(CSObject objectData , CSSchemaField schemaField)
		{
			_csObject = objectData;
			_schemaField = schemaField;
		}
Example #32
0
 internal abstract void AddFromPrefetch(CSObject obj);
Example #33
0
 internal abstract void Remove(CSObject obj);