• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Runtime.IodineObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Iodine.Runtime.IodineObject的典型用法代码示例。如果您正苦于以下问题:C# IodineObject类的具体用法?C# IodineObject怎么用?C# IodineObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IodineObject类属于Iodine.Runtime命名空间,在下文中一共展示了IodineObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: append

		private IodineObject append (VirtualMachine vm, IodineObject self, IodineObject[] args)
		{
			foreach (IodineObject obj in args) {
				buffer.Append (obj.ToString (vm));
			}
			return null;
		}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:7,代码来源:IodineStringBuilder.cs


示例2: push

			private IodineObject push (VirtualMachine vm, IodineObject self, IodineObject[] args)
			{
				foreach (IodineObject obj in args) {
					Stack.Push (obj);
				}
				return null;
			}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:7,代码来源:CollectionsModule.cs


示例3: randInt

		private IodineObject randInt (VirtualMachine vm, IodineObject self, IodineObject[] args)
		{
			if (args.Length <= 0) {
				return new IodineInteger (rgn.Next (Int32.MinValue, Int32.MaxValue));
			} else {
				int start = 0;
				int end = 0;
				if (args.Length <= 1) {
					IodineInteger integer = args [0] as IodineInteger;
					if (integer == null) {
						vm.RaiseException (new IodineTypeException ("Int"));
						return null;
					}
					end = (int)integer.Value;
				} else {
					IodineInteger startInteger = args [0] as IodineInteger;
					IodineInteger endInteger = args [1] as IodineInteger;
					if (startInteger == null || endInteger == null) {
						vm.RaiseException (new IodineTypeException ("Int"));
						return null;
					}
					start = (int)startInteger.Value;
					end = (int)endInteger.Value;
				}
				return new IodineInteger (rgn.Next (start, end));
			}
		}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:27,代码来源:RandomModule.cs


示例4: Invoke

			public override IodineObject Invoke (VirtualMachine vm, IodineObject[] args)
			{
				if (args.Length <= 0) {
					vm.RaiseException (new IodineArgumentException (1));
				}
				return IodineBool.Create (Boolean.Parse (args [0].ToString ()));
			}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:7,代码来源:IodineBool.cs


示例5: IodineProperty

 public IodineProperty(IodineObject getter, IodineObject setter, IodineObject self)
     : base(TypeDefinition)
 {
     Setter = setter;
     Getter = getter;
     this.self = self;
 }
开发者ID:iwatakeshi,项目名称:Iodine,代码行数:7,代码来源:IodineProperty.cs


示例6: Invoke

			public override IodineObject Invoke (VirtualMachine vm, IodineObject[] args)
			{
				if (args.Length <= 0) {
					vm.RaiseException (new IodineArgumentException (1));
				}

				if (args [0] is IodineFloat) {
					IodineFloat fp = args [0] as IodineFloat;
					return new IodineInteger ((long)fp.Value);
				}

				long value;
				NumberStyles style = NumberStyles.AllowLeadingSign;

				if (args.Length > 1) {
					IodineInteger basen = args [1] as IodineInteger;
					switch (basen.Value) {
					case 16:
						style = NumberStyles.HexNumber;
						break;
					}
				}

				if (!Int64.TryParse (args [0].ToString (), style, null, out value)) {
					vm.RaiseException (new IodineTypeCastException ("Int"));
					return null;
				} else {
					return new IodineInteger (value);
				}
			}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:30,代码来源:IodineInteger.cs


示例7: listDirectories

			private IodineObject listDirectories (VirtualMachine vm, IodineObject self, IodineObject[] args)
			{
				if (args.Length <= 0) {
					vm.RaiseException (new IodineArgumentException (1));
					return null;
				}

				if (!(args [0] is IodineString)) {
					vm.RaiseException (new IodineTypeException ("Str"));
					return null;
				}

				if (!Directory.Exists (args [0].ToString ())) {
					vm.RaiseException (new IodineIOException ("Directory '" + args [0].ToString () +
					"' does not exist!"));
					return null;
				}

				IodineList ret = new IodineList (new IodineObject[]{ });

				foreach (string dir in Directory.GetDirectories (args[0].ToString ())) {
					ret.Add (new IodineString (dir));
				}
				return ret;
			}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:25,代码来源:IOModule.cs


示例8: sha1

		private IodineObject sha1 (VirtualMachine vm, IodineObject self, IodineObject[] args)
		{
			if (args.Length <= 0) {
				vm.RaiseException (new IodineArgumentException (1));
				return null;
			}

			byte[] bytes = new byte[]{};
			byte[] hash = null;

			SHA1Managed hashstring = new SHA1Managed();

			if (args[0] is IodineString) {
				bytes = System.Text.Encoding.UTF8.GetBytes (args[0].ToString ());
				hash = hashstring.ComputeHash(bytes);
			} else if (args[0] is IodineByteArray) {
				bytes = ((IodineByteArray)args[0]).Array;
				hash = hashstring.ComputeHash(bytes);
			} else if (args[0] is IodineStream) {
				hash = hashstring.ComputeHash(((IodineStream)args[0]).File);
			} else {
				vm.RaiseException (new IodineTypeException ("Str"));
				return null;
			}

			return new IodineByteArray (hash);
		}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:27,代码来源:HashModule.cs


示例9: write

		private IodineObject write (VirtualMachine vm, IodineObject self, IodineObject[] args)
		{
			if (Closed) { 
				vm.RaiseException (new IodineIOException ("Stream has been closed!"));
				return null;
			}

			if (!CanWrite) {
				vm.RaiseException (new IodineIOException ("Can not write to stream!"));
				return null;
			}

			foreach (IodineObject obj in args) {
				if (obj is IodineString) {
					write (obj.ToString ());
				} else if (obj is IodineBytes) {
					IodineBytes arr = obj as IodineBytes;
					File.Write (arr.Value, 0, arr.Value.Length);
				} else if (obj is IodineInteger) {
					IodineInteger intVal = obj as IodineInteger;
					write ((byte)intVal.Value);
				} else if (obj is IodineByteArray) {
					IodineByteArray arr = obj as IodineByteArray;
					File.Write (arr.Array, 0, arr.Array.Length);
				} else {
					vm.RaiseException (new IodineTypeException (""));
				}
			}
			return null;
		}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:30,代码来源:IodineStream.cs


示例10: unzip

		private IodineObject unzip (VirtualMachine vm, IodineObject self, IodineObject[] args)
		{
			var archiveName = args [0] as IodineString;
			var targetDir = args [1] as IodineString;
			ZipFile.ExtractToDirectory (archiveName.Value, targetDir.Value);
			return null;
		}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:7,代码来源:ZipModule.cs


示例11: Invoke

			public override IodineObject Invoke (VirtualMachine vm, IodineObject[] args)
			{
				if (args.Length <= 0) {
					vm.RaiseException (new IodineArgumentException (1));
				}
				return new IodineBytes (args [0].ToString ());
			}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:7,代码来源:IodineBytes.cs


示例12: pow

		private IodineObject pow (VirtualMachine vm, IodineObject self, IodineObject[] args)
		{
			if (args.Length <= 1) {
				vm.RaiseException (new IodineArgumentException (2));
				return null;
			}

			double a1 = 0;
			double a2 = 0;
			if (args [0] is IodineInteger) {
				a1 = (double)((IodineInteger)args [0]).Value;
			} else if (args [0] is IodineFloat) {
				a1 = ((IodineFloat)args [0]).Value;
			} else {
				vm.RaiseException (new IodineTypeException ("Float"));
				return null;
			}

			if (args [1] is IodineInteger) {
				a2 = (double)((IodineInteger)args [1]).Value;
			} else if (args [1] is IodineFloat) {
				a2 = ((IodineFloat)args [1]).Value;
			} else {
				vm.RaiseException (new IodineTypeException ("Float"));
				return null;
			}
			return new IodineFloat (Math.Pow (a1, a2));
		}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:28,代码来源:MathModule.cs


示例13: BindAttributes

 public IodineObject BindAttributes(IodineObject obj)
 {
     foreach (KeyValuePair<string, IodineObject> kv in attributes) {
         if (!obj.HasAttribute (kv.Key))
             obj.SetAttribute (kv.Key, kv.Value);
     }
     return obj;
 }
开发者ID:iwatakeshi,项目名称:Iodine,代码行数:8,代码来源:IodineTypeDefinition.cs


示例14: getValue

			private IodineObject getValue (VirtualMachine vm, IodineObject self, IodineObject[] args)
			{
				string name = args [0].ToString ();
				IodineObject ioval = null;
				object val = Key.GetValue (name);
				//IodineTypeConverter.Instance.ConvertFromPrimative (val, out ioval);
				return ioval;
			}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:8,代码来源:WinRegModule.cs


示例15: getProcList

 private IodineObject getProcList(VirtualMachine vm, IodineObject self, IodineObject[] args)
 {
     IodineList list = new IodineList (new IodineObject[] { });
     foreach (Process proc in Process.GetProcesses ()) {
         list.Add (new IodineProc (proc));
     }
     return list;
 }
开发者ID:iwatakeshi,项目名称:Iodine,代码行数:8,代码来源:OSModule.cs


示例16: SetAttribute

		public override void SetAttribute (VirtualMachine vm, string name, IodineObject value)
		{
			if (!initializerInvoked) {
				initializerInvoked = true;
				Initializer.Invoke (vm, new IodineObject[] { });
			}
			base.SetAttribute (vm, name, value);
		}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:8,代码来源:IodineClass.cs


示例17: IodineGenerator

        public IodineGenerator(StackFrame parentFrame, IodineInstanceMethodWrapper baseMethod,
			IodineObject[] args)
            : base(TypeDef)
        {
            arguments = args;
            self = baseMethod.Self;
            this.baseMethod = baseMethod.Method;
        }
开发者ID:iwatakeshi,项目名称:Iodine,代码行数:8,代码来源:IodineGenerator.cs


示例18: GetIndex

		public override IodineObject GetIndex (VirtualMachine vm, IodineObject key)
		{
			IodineInteger index = key as IodineInteger;
			if (index.Value < Objects.Length)
				return Objects [(int)index.Value];
			vm.RaiseException (new IodineIndexException ());
			return null;
		}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:8,代码来源:IodineTuple.cs


示例19: Invoke

			public override IodineObject Invoke (VirtualMachine vm, IodineObject[] args)
			{
				if (args.Length >= 1) {
					IodineList inputList = args [0] as IodineList;
					return new IodineTuple (inputList.Objects.ToArray ());
				}
				return null;
			}
开发者ID:GruntTheDivine,项目名称:Iodine,代码行数:8,代码来源:IodineTuple.cs


示例20: TryToConvertFromPrimative

 public bool TryToConvertFromPrimative(object obj, out IodineObject result)
 {
     if (obj is IConvertible) {
         result = new IodineInteger (Convert.ToInt64 (obj));
         return true;
     }
     result = null;
     return false;
 }
开发者ID:iwatakeshi,项目名称:Iodine,代码行数:9,代码来源:IntegerTypeConverter.cs



注:本文中的Iodine.Runtime.IodineObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Runtime.VirtualMachine类代码示例发布时间:2022-05-26
下一篇:
C# Compiler.TokenStream类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap