当前位置: 首页>>代码示例>>C#>>正文


C# Scriptable类代码示例

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


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

示例1: ModuleScope

		public ModuleScope(Scriptable prototype, Uri uri, Uri @base)
		{
			this.uri = uri;
			[email protected] = @base;
			SetPrototype(prototype);
			CacheBuiltins();
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:ModuleScope.cs

示例2: Action

		public virtual object Action(Context cx, Scriptable scope, Scriptable thisObj, object[] args, int actionType)
		{
			GlobData data = new GlobData();
			data.mode = actionType;
			switch (actionType)
			{
				case RegExpProxyConstants.RA_MATCH:
				{
					object rval;
					data.optarg = 1;
					rval = MatchOrReplace(cx, scope, thisObj, args, this, data, false);
					return data.arrayobj == null ? rval : data.arrayobj;
				}

				case RegExpProxyConstants.RA_SEARCH:
				{
					data.optarg = 1;
					return MatchOrReplace(cx, scope, thisObj, args, this, data, false);
				}

				case RegExpProxyConstants.RA_REPLACE:
				{
					object arg1 = args.Length < 2 ? Undefined.instance : args[1];
					string repstr = null;
					Function lambda = null;
					if (arg1 is Function)
					{
						lambda = (Function)arg1;
					}
					else
					{
						repstr = ScriptRuntime.ToString(arg1);
					}
					data.optarg = 2;
					data.lambda = lambda;
					data.repstr = repstr;
					data.dollar = repstr == null ? -1 : repstr.IndexOf('$');
					data.charBuf = null;
					data.leftIndex = 0;
					object val = MatchOrReplace(cx, scope, thisObj, args, this, data, true);
					if (data.charBuf == null)
					{
						if (data.global || val == null || !val.Equals(true))
						{
							return data.str;
						}
						SubString lc = this.leftContext;
						Replace_glob(data, cx, scope, this, lc.index, lc.length);
					}
					SubString rc = this.rightContext;
					data.charBuf.AppendRange(rc.str, rc.index, rc.index + rc.length);
					return data.charBuf.ToString();
				}

				default:
				{
					throw Kit.CodeBug();
				}
			}
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:60,代码来源:RegExpImpl.cs

示例3: CreateFunction

		/// <summary>Create function compiled from Function(...) constructor.</summary>
		/// <remarks>Create function compiled from Function(...) constructor.</remarks>
		internal static Rhino.InterpretedFunction CreateFunction(Context cx, Scriptable scope, InterpreterData idata, object staticSecurityDomain)
		{
			Rhino.InterpretedFunction f;
			f = new Rhino.InterpretedFunction(idata, staticSecurityDomain);
			f.InitScriptFunction(cx, scope);
			return f;
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:9,代码来源:InterpretedFunction.cs

示例4: Construct

		public override Scriptable Construct(Context cx, Scriptable scope, object[] args)
		{
			NativeRegExp re = new NativeRegExp();
			re.Compile(cx, scope, args);
			ScriptRuntime.SetBuiltinProtoAndParent(re, scope, TopLevel.Builtins.RegExp);
			return re;
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:NativeRegExpCtor.cs

示例5: RunFileIfExists

		private static void RunFileIfExists(Context cx, Scriptable global, FilePath f)
		{
			if (f.IsFile())
			{
				Main.ProcessFileNoThrow(cx, global, f.GetPath());
			}
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:ShellTest.cs

示例6: LoadFromPathArray

		/// <exception cref="System.IO.IOException"></exception>
		private ModuleSource LoadFromPathArray(string moduleId, Scriptable paths, object validator)
		{
			long llength = ScriptRuntime.ToUint32(ScriptableObject.GetProperty(paths, "length"));
			// Yeah, I'll ignore entries beyond Integer.MAX_VALUE; so sue me.
			int ilength = llength > int.MaxValue ? int.MaxValue : (int)llength;
			for (int i = 0; i < ilength; ++i)
			{
				string path = EnsureTrailingSlash(ScriptableObject.GetTypedProperty<string>(paths, i));
				try
				{
					Uri uri = new Uri(path);
					if (!uri.IsAbsoluteUri)
					{
						uri = new FilePath(path).ToURI().Resolve(string.Empty);
					}
					ModuleSource moduleSource = LoadFromUri(uri.Resolve(moduleId), uri, validator);
					if (moduleSource != null)
					{
						return moduleSource;
					}
				}
				catch (URISyntaxException e)
				{
					throw new UriFormatException(e.Message);
				}
			}
			return null;
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:29,代码来源:ModuleSourceProviderBase.cs

示例7: Init

		internal static void Init(Scriptable scope, bool @sealed)
		{
			Rhino.BaseFunction obj = new Rhino.BaseFunction();
			// Function.prototype attributes: see ECMA 15.3.3.1
			obj.prototypePropertyAttributes = DONTENUM | READONLY | PERMANENT;
			obj.ExportAsJSClass(MAX_PROTOTYPE_ID, scope, @sealed);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:BaseFunction.cs

示例8: Init

		internal static void Init(Scriptable scope, bool @sealed)
		{
			Rhino.NativeDate obj = new Rhino.NativeDate();
			// Set the value of the prototype Date to NaN ('invalid date');
			obj.date = ScriptRuntime.NaN;
			obj.ExportAsJSClass(MAX_PROTOTYPE_ID, scope, @sealed);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:NativeDate.cs

示例9: Initialize

		internal void Initialize(XMLLibImpl lib, Scriptable scope, XMLObject prototype)
		{
			SetParentScope(scope);
			SetPrototype(prototype);
			prototypeFlag = (prototype == null);
			this.lib = lib;
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:XMLObjectImpl.cs

示例10: Call

		public override object Call(Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (args.Length > 0 && args[0] is NativeRegExp && (args.Length == 1 || args[1] == Undefined.instance))
			{
				return args[0];
			}
			return Construct(cx, scope, args);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:NativeRegExpCtor.cs

示例11: HasInstance

		public override bool HasInstance(Scriptable instance)
		{
			if (targetFunction is Function)
			{
				return ((Function)targetFunction).HasInstance(instance);
			}
			throw ScriptRuntime.TypeError0("msg.not.ctor");
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:BoundFunction.cs

示例12: Construct

		public override Scriptable Construct(Context cx, Scriptable scope, object[] extraArgs)
		{
			if (targetFunction is Function)
			{
				return ((Function)targetFunction).Construct(cx, scope, Concat(boundArgs, extraArgs));
			}
			throw ScriptRuntime.TypeError0("msg.not.ctor");
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:BoundFunction.cs

示例13: Call

		public override object Call(Context cx, Scriptable scope, Scriptable thisObj, object[] args)
		{
			if (script != null)
			{
				return script.Exec(cx, scope);
			}
			return Undefined.instance;
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:NativeScript.cs

示例14: Get

		public virtual object Get(string id, Scriptable start)
		{
			if (start == this)
			{
				start = prototype;
			}
			return prototype.Get(id, start);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:NativeWith.cs

示例15: Has

		public override bool Has(string name, Scriptable start)
		{
			if (this == thePrototypeInstance)
			{
				return base.Has(name, start);
			}
			return (Runtime.GetProperty(name) != null);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:Environment.cs


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