public virtual EntityRecord GetRecord(EntityKey primaryKey, LoadFlags flags = LoadFlags.Default) { if (primaryKey == null || primaryKey.IsNull()) { return(null); } var record = GetLoadedRecord(primaryKey); if (record != null) { if (record.Status == EntityStatus.Stub && flags.IsSet(LoadFlags.Load)) { record.Reload(); } return(record); } // TODO: review returning Record stub in the context of SecureSession. // We might have security hole here if user is not authorized to access the record if (flags.IsSet(LoadFlags.Stub)) { return(CreateStub(primaryKey)); } if (!flags.IsSet(LoadFlags.Load)) { return(null); } //Otherwise, load it var ent = this.SelectByPrimaryKey(primaryKey.KeyInfo.Entity, primaryKey.Values); return(ent?.Record); }
private void LoadV2(string s, ref LoadFlags flags) { this.State.Load(s); if (this.State.Inventory.WeightCurrent == 0 && this.State.Inventory.WeightMax1 == 0 && this.State.Inventory.WeightMax2 == 0) { flags |= LoadFlags.V2InventoryWeightsMissing; } if (this.State.ObjectID.Equals(Guid.Empty) || this.State.Inventory.Items.Any(i => i.ObjectID.Equals(Guid.Empty)) || this.State.Spellbook.AllSpells.Any(sp => sp.ObjectID.Equals(Guid.Empty))) { flags |= LoadFlags.V2NoObjectIDs; } if (this._tempLoadObject.ContainsKey("Extras") && ((JObject)this._tempLoadObject["Extras"]).ContainsKey("Feats")) { flags |= LoadFlags.V2OldFeats | LoadFlags.KeepLoadObject; } if (this.State.Inventory.Items.Any(i => !string.IsNullOrEmpty(i.ImageIndex) && i.ImageIndex[0] != '\\') || this.State.Extras.FeatsArray.Any(i => !string.IsNullOrEmpty(i.ImageIndex) && i.ImageIndex[0] != '\\') || this.State.Extras.TraitsArray.Any(i => !string.IsNullOrEmpty(i.ImageIndex) && i.ImageIndex[0] != '\\') || this.State.Spellbook.AllSpells.Any(i => !string.IsNullOrEmpty(i.ImageIndex) && i.ImageIndex[0] != '\\')) { flags |= LoadFlags.V2OldImageModels; } }
private ScriptCode /*!*/ CompileRubySource(SourceUnit /*!*/ sourceUnit, LoadFlags flags) { Assert.NotNull(sourceUnit); // TODO: check file timestamp string fullPath = Platform.GetFullPath(sourceUnit.Path); CompiledFile compiledFile; if (TryGetCompiledFile(fullPath, out compiledFile)) { Utils.Log(String.Format("{0}: {1}", ++_cacheHitCount, sourceUnit.Path), "LOAD_CACHED"); return(compiledFile.CompiledCode); } else { Utils.Log(String.Format("{0}: {1}", ++_compiledFileCount, sourceUnit.Path), "LOAD_COMPILED"); RubyCompilerOptions options = new RubyCompilerOptions(_context.RubyOptions) { FactoryKind = (flags & LoadFlags.LoadIsolated) != 0 ? TopScopeFactoryKind.WrappedFile : TopScopeFactoryKind.File }; long ts1 = Stopwatch.GetTimestamp(); ScriptCode compiledCode = sourceUnit.Compile(options, _context.RuntimeErrorSink); long ts2 = Stopwatch.GetTimestamp(); Interlocked.Add(ref _ScriptCodeGenerationTimeTicks, ts2 - ts1); AddCompiledFile(fullPath, compiledCode); return(compiledCode); } }
private void FileLoaded(MutableString /*!*/ path, LoadFlags flags) { if ((flags & LoadFlags.LoadOnce) != 0) { AddLoadedFile(path); } }
private ScriptCode /*!*/ CompileRubySource(SourceUnit /*!*/ sourceUnit, LoadFlags flags) { Assert.NotNull(sourceUnit); // TODO: check file timestamp string fullPath = Platform.GetFullPath(sourceUnit.Path); #if FEATURE_FILESYSTEM CompiledFile compiledFile; if (TryGetCompiledFile(fullPath, out compiledFile)) { Utils.Log(String.Format("{0}: {1}", ++_cacheHitCount, sourceUnit.Path), "LOAD_CACHED"); return(compiledFile.CompiledCode); } Utils.Log(String.Format("{0}: {1}", ++_compiledFileCount, sourceUnit.Path), "LOAD_COMPILED"); #endif RubyCompilerOptions options = new RubyCompilerOptions(_context.RubyOptions) { FactoryKind = (flags & LoadFlags.LoadIsolated) != 0 ? TopScopeFactoryKind.WrappedFile : TopScopeFactoryKind.File }; ScriptCode compiledCode = sourceUnit.Compile(options, _context.RuntimeErrorSink); #if FEATURE_FILESYSTEM AddCompiledFile(fullPath, compiledCode); #endif return(compiledCode); }
public virtual TEntity GetEntity <TEntity>(object primaryKeyValue, LoadFlags flags = LoadFlags.Default) where TEntity : class { Util.Check(primaryKeyValue != null, "Session.GetEntity<{0}>(): primary key may not be null.", typeof(TEntity)); var entityInfo = GetEntityInfo(typeof(TEntity)); Util.Check(entityInfo.Kind != EntityKind.View, "Cannot use session.GetEntity<TEntity>(PK) method for views. Entity: {0}.", typeof(TEntity)); //Check if it is an entity key object; if not, it is a "value" (or values) of the key var pkType = primaryKeyValue.GetType(); EntityKey pk; if (pkType == typeof(EntityKey)) { pk = (EntityKey)primaryKeyValue; } else { //try array of objects; if not, it is a single value, turn it into array object[] pkValues = pkType == typeof(object[]) ? (object[])primaryKeyValue : new object[] { primaryKeyValue }; pk = EntityKey.CreateSafe(entityInfo.PrimaryKey, pkValues); } var rec = GetRecord(pk, flags); if (rec != null) { return((TEntity)(object)rec.EntityInstance); } return(default(TEntity)); }
/////////////////////////////////////////////////////////////////////// public TclBuild( FindFlags findFlags, LoadFlags loadFlags, object findData, string fileName, Priority priority, Sequence sequence, OperatingSystemId operatingSystemId, Version patchLevel, Tcl_ReleaseLevel releaseLevel, ushort magic, bool threaded, bool debug ) { this.findFlags = findFlags; this.loadFlags = loadFlags; this.findData = findData; this.fileName = fileName; this.priority = priority; this.sequence = sequence; this.operatingSystemId = operatingSystemId; this.patchLevel = patchLevel; this.releaseLevel = releaseLevel; this.magic = magic; this.threaded = threaded; this.debug = debug; // // NOTE: The version may only contain the major and minor parts. // this.version = GlobalState.GetTwoPartVersion(patchLevel); }
/// <summary> /// Method to create an object from a set of object attributes. /// </summary> /// <param name="obj_attributes">The object attributes to create/open from.</param> /// <returns>The newly created object.</returns> protected override object CreateObject(ObjectAttributes obj_attributes) { string key_path = Win32Path ? NtKeyUtils.Win32KeyNameToNt(KeyPath) : KeyPath; using (ObjectAttributes name = new ObjectAttributes(key_path, AttributeFlags.CaseInsensitive)) { if (!LoadFlags.HasFlag(LoadKeyFlags.AppKey)) { using (NtToken token = NtToken.OpenProcessToken()) { TokenPrivilege priv = token.GetPrivilege(TokenPrivilegeValue.SeRestorePrivilege); if (priv == null || (priv.Attributes & PrivilegeAttributes.Enabled) == 0) { WriteWarning("Loading a non-app hive should require SeRestorePrivilege"); } } } else { if (!KeyPath.StartsWith(@"\Registry\A\", System.StringComparison.OrdinalIgnoreCase)) { WriteWarning(@"Loading app hive outside of \Registry\A\ will fail on an up to date system."); } } if (NoOpen) { NtKey.LoadKeyNoOpen(name, obj_attributes, LoadFlags, TrustKey, Event, Token); return(null); } return(NtKey.LoadKey(name, obj_attributes, LoadFlags, Access, TrustKey, Event, Token)); } }
/// <summary> /// Loads a library with flags to use with dlopen. Uses <see cref="LoadFlags"/> for the flags /// /// Uses NATIVE_DLL_SEARCH_DIRECTORIES and then ld.so for library paths /// </summary> /// <param name="library">Full name of the library</param> /// <param name="flags">See 'man dlopen' for more information.</param> public static void Load(string library, LoadFlags flags) { var paths = (string)AppContext.GetData("NATIVE_DLL_SEARCH_DIRECTORIES"); foreach (var path in paths.Split(':')) { if (dlopen(Path.Combine(path, library), flags) != IntPtr.Zero) break; } }
private bool AlreadyLoaded(string /*!*/ path, string fullPath, LoadFlags flags, string[] /*!*/ sourceFileExtensions) { Debug.Assert(fullPath == null || RubyUtils.GetExtension(path) == RubyUtils.GetExtension(fullPath)); IEnumerable <string> appendExtensions = (flags & LoadFlags.AppendExtensions) != 0 && RubyUtils.GetExtension(path).Length == 0 ? sourceFileExtensions.Concat(_LibraryExtensions) : null; return((flags & LoadFlags.LoadOnce) != 0 && IsFileLoaded(path, fullPath, appendExtensions)); }
public void LoadChar(uint c, LoadFlags flags) { var err = FreeTypeNative.FT_Load_Char(reference, c, (int)flags); if (err != 0) { throw FreeTypeException.Except(err); } }
/// <summary> /// /// </summary> /// <param name="glyph">Char index <see cref="TryCharIndex"/></param> /// <param name="flags"></param> /// <exception cref="FreeTypeException"></exception> public void LoadGlyph(uint glyph, LoadFlags flags) { var err = FreeTypeNative.FT_Load_Glyph(reference, glyph, (int)flags); if (err != 0) { throw FreeTypeException.Except(err); } }
public void Go(string url, LoadFlags flags) { if (navigation == null) { return; } control.Reset(); navigation.loadURI(url, (uint)flags, null, null, null); }
public FT_Error LoadGlyph(uint glyph_index, LoadFlags flags, LoadTarget target) { if (Form == LongForm.Long4) { return(FT_Load_Glyph_4(mHandle, glyph_index, ((Int32)flags | (Int32)target))); } else { return(FT_Load_Glyph_8(mHandle, glyph_index, ((Int32)flags | (Int32)target))); } }
/// <summary> /// Overload for loading glyphs that can't be expressed as a char literal like emojis. /// Grabs the first 4 bytes in the string /// </summary> /// <param name="glyph"></param> /// <param name="flags"></param> /// <returns>bool indicating whether the glyph exists in this face</returns> public bool LoadGlyph(string c, LoadFlags flags) { Encoding.UTF32.GetBytes(c, 0, 2, charCopy, 0); var glyphCode = BitConverter.ToUInt32(charCopy, 0); if (TryCharIndex(glyphCode, out var index)) { LoadGlyph(index, flags); return(true); } return(false); }
public static void LoadAllFromBspStream(BspFile bsp, LoadFlags flags, Stream stream) { if (bsp == null) { throw new ArgumentNullException(nameof(bsp), "Target BSP is null."); } if (stream == null) { throw new ArgumentNullException(nameof(stream)); } var reader = new BinaryReader(stream); var startPos = stream.Position; //4 bytes = 1 uint uint version = reader.ReadUInt32(); stream.Position = startPos; switch (version) { case (uint)BspVersion.Quake1: { throw new BspVersionNotSupportedException(version, "Quake 1"); } case (uint)BspVersion.GoldSource: { GoldSource.Bsp.LoadAllFromBspStream(bsp, flags, stream); } break; case (uint)BspVersion.ValveBSP: { throw new BspVersionNotSupportedException(version, "ValveBSP (Source engine)"); } case (uint)BspVersion.RespawnBSP: { throw new BspVersionNotSupportedException(version, "rBSP (Titanfall)"); } default: throw new BspVersionNotSupportedException(version); } }
/// <summary>Finds the type with the specified name.</summary> /// <param name="name">The name of the type (this can be a full type name or a full qualified name with assembly information).</param> /// <param name="mode">The loader mode.</param> /// <returns>Returns the first matching type.</returns> /// <exception cref="System.TypeLoadException">when type cannot be loaded.</exception> public static Type FindType(string name, LoadFlags mode = 0) { if (name.Contains(',')) { var typeName = name.BeforeFirst(',').Trim(); var assemblyName = name.AfterFirst(',').Trim(); var assembly = mode.HasFlag(LoadFlags.LoadAssemblies) ? Assembly.Load(assemblyName) ?? throw new TypeLoadException($"Could not load assembly {assemblyName}") : FindAssembly(assemblyName, true); return(assembly.GetType(typeName, true, false)); } return(FindType(name, null, mode)); }
/////////////////////////////////////////////////////////////////////// #if NATIVE && TCL public static bool HasFlags( LoadFlags flags, LoadFlags hasFlags, bool all ) { if (all) { return((flags & hasFlags) == hasFlags); } else { return((flags & hasFlags) != LoadFlags.None); } }
public static void LoadAllFromFile(BspFile bsp, LoadFlags flags, string path) { if (bsp == null) { throw new ArgumentNullException(nameof(bsp), "Target BSP is null."); } if (!File.Exists(path)) { throw new FileNotFoundException("BSP file not found", path); } using (var stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { LoadAllFromBspStream(bsp, flags, stream); } }
/// <summary> /// A variant of <see cref="ImageCache.Lookup"/> that uses a <see cref="Scaler"/> to specify the face ID and its /// size. /// </summary> /// <remarks><para> /// The returned glyph is owned and managed by the glyph image cache. Never try to transform or discard it /// manually! You can however create a copy with <see cref="Glyph.Copy"/> and modify the new one. /// </para><para> /// If ‘node’ is not NULL, it receives the address of the cache node containing the glyph image, /// after increasing its reference count. This ensures that the node (as well as the <see cref="Glyph"/>) will /// always be kept in the cache until you call <see cref="Node.Unref"/> to ‘release’ it. /// </para><para> /// If ‘node’ is NULL, the cache node is left unchanged, which means that the <see cref="Glyph"/> /// could be flushed out of the cache on the next call to one of the caching sub-system APIs. Don't assume that /// it is persistent! /// </para><para> /// Calls to <see cref="Face.SetCharSize"/> and friends have no effect on cached glyphs; you should always use /// the FreeType cache API instead. /// </para></remarks> /// <param name="scaler">A pointer to a scaler descriptor.</param> /// <param name="loadFlags">The corresponding load flags.</param> /// <param name="gIndex">The glyph index to retrieve.</param> /// <param name="node"> /// Used to return the address of of the corresponding cache node after incrementing its reference count (see /// note below). /// </param> /// <returns>The corresponding <see cref="Glyph"/> object. 0 in case of failure.</returns> public Glyph LookupScaler(Scaler scaler, LoadFlags loadFlags, uint gIndex, out Node node) { if (parentManager.IsDisposed) { throw new ObjectDisposedException("Reference", "Cannot access a disposed object."); } Error err = FT.FTC_ImageCache_LookupScaler(Reference, scaler.Reference, loadFlags, gIndex, out var glyphRef, out var nodeRef); if (err != Error.Ok) { throw new FreeTypeException(err); } node = new Node(nodeRef); return(new Glyph(glyphRef, null)); }
public SBit LookupScaler(Scaler scaler, LoadFlags loadFlags, uint gIndex, out Node node) { if (parentManager.IsDisposed) { throw new ObjectDisposedException("Reference", "Cannot access a disposed object."); } IntPtr sbitRef, nodeRef; Error err = FT.FTC_SBitCache_LookupScaler(Reference, scaler.Reference, loadFlags, gIndex, out sbitRef, out nodeRef); if (err != Error.Ok) { throw new FreeTypeException(err); } node = new Node(nodeRef); return(new SBit(sbitRef)); }
public void Load(string s, out LoadFlags flags) { flags = LoadFlags.None; this.FreezeAutocalc = true; this._tempLoadObject = JObject.Parse(s); int saveVersion = this.LookupSaveVersion(); this.State.Clear(); switch (saveVersion) { case 1: { this.LoadV1(s); flags = LoadFlags.V2AdaptV1; break; } case 2: { this.LoadV2(s, ref flags); break; } default: throw new NotSupportedException($"The specified save file version can't be loaded - no format converter exists for version { saveVersion }."); } AppEvents.InvokeLoad(ref s); //HACK modifiers fix this.State.General.StatStr -= this.State.General.ModifiersStr.Sum(m => m.Value); this.State.General.StatDex -= this.State.General.ModifiersDex.Sum(m => m.Value); this.State.General.StatCon -= this.State.General.ModifiersCon.Sum(m => m.Value); this.State.General.StatCha -= this.State.General.ModifiersCha.Sum(m => m.Value); this.State.General.StatWis -= this.State.General.ModifiersWis.Sum(m => m.Value); this.State.General.StatInt -= this.State.General.ModifiersInt.Sum(m => m.Value); this.FreezeAutocalc = false; this._ignoreLastSaveFile = false; if (!flags.HasFlag(LoadFlags.KeepLoadObject)) { this._tempLoadObject = null; } }
public virtual TEntity GetEntity <TEntity>(object primaryKeyValue, LoadFlags flags = LoadFlags.Default) where TEntity : class { try { Util.Check(primaryKeyValue != null, "Session.GetEntity<{0}>(): primary key may not be null.", typeof(TEntity)); var entityInfo = GetEntityInfo(typeof(TEntity)); Util.Check(entityInfo.Kind != EntityKind.View, "Cannot use session.GetEntity<TEntity>(PK) method for views. Entity: {0}.", typeof(TEntity)); //Check if it is an entity key object; if not, it is a "value" (or values) of the key var pkType = primaryKeyValue.GetType(); EntityKey pk = entityInfo.CreatePrimaryKeyInstance(primaryKeyValue); var rec = GetRecord(pk, flags); if (rec != null) { return((TEntity)(object)rec.EntityInstance); } return(default(TEntity)); } catch (Exception ex) { this._appEvents.OnError(this.Context, ex); throw; } }
private void FileLoaded(MutableString/*!*/ path, LoadFlags flags) { if ((flags & LoadFlags.LoadOnce) != 0) { AddLoadedFile(path); } }
private IEnumerable<MutableString>/*!*/ GetPathsToTestLoaded(string/*!*/ path, string fullPath, LoadFlags flags, string[]/*!*/ sourceFileExtensions) { List<MutableString> paths = new List<MutableString>(); paths.Add(_context.EncodePath(path)); if (fullPath != null) { paths.Add(_context.EncodePath(path)); } if ((flags & LoadFlags.AppendExtensions) != 0 && RubyUtils.GetExtension(path).Length == 0) { foreach (var extension in sourceFileExtensions) { paths.Add(_context.EncodePath(path + extension)); } foreach (var extension in _LibraryExtensions) { paths.Add(_context.EncodePath(path + extension)); } } return paths; }
public bool LoadFile(Scope globalScope, object self, MutableString/*!*/ path, LoadFlags flags) { object loaded; return LoadFile(globalScope, self, path, flags, out loaded); }
private void ExecuteRubySourceUnit(SourceUnit/*!*/ sourceUnit, Scope/*!*/ globalScope, LoadFlags flags) { Assert.NotNull(sourceUnit, globalScope); // TODO: check file timestamp string fullPath = Platform.GetFullPath(sourceUnit.Path); CompiledFile compiledFile; if (TryGetCompiledFile(fullPath, out compiledFile)) { Utils.Log(String.Format("{0}: {1}", ++_cacheHitCount, sourceUnit.Path), "LOAD_CACHED"); compiledFile.CompiledCode.Run(globalScope); } else { Utils.Log(String.Format("{0}: {1}", ++_compiledFileCount, sourceUnit.Path), "LOAD_COMPILED"); RubyCompilerOptions options = new RubyCompilerOptions(_context.RubyOptions) { IsIncluded = true, IsWrapped = (flags & LoadFlags.LoadIsolated) != 0, }; long ts1 = Stopwatch.GetTimestamp(); ScriptCode compiledCode = sourceUnit.Compile(options, _context.RuntimeErrorSink); long ts2 = Stopwatch.GetTimestamp(); Interlocked.Add(ref _ScriptCodeGenerationTimeTicks, ts2 - ts1); AddCompiledFile(fullPath, compiledCode); CompileAndRun(globalScope, compiledCode, _context.Options.InterpretedMode); } }
private ScriptCode/*!*/ CompileRubySource(SourceUnit/*!*/ sourceUnit, LoadFlags flags) { Assert.NotNull(sourceUnit); // TODO: check file timestamp string fullPath = Platform.GetFullPath(sourceUnit.Path); #if FEATURE_FILESYSTEM CompiledFile compiledFile; if (TryGetCompiledFile(fullPath, out compiledFile)) { Utils.Log(String.Format("{0}: {1}", ++_cacheHitCount, sourceUnit.Path), "LOAD_CACHED"); return compiledFile.CompiledCode; } Utils.Log(String.Format("{0}: {1}", ++_compiledFileCount, sourceUnit.Path), "LOAD_COMPILED"); #endif RubyCompilerOptions options = new RubyCompilerOptions(_context.RubyOptions) { FactoryKind = (flags & LoadFlags.LoadIsolated) != 0 ? TopScopeFactoryKind.WrappedFile : TopScopeFactoryKind.File }; ScriptCode compiledCode = sourceUnit.Compile(options, _context.RuntimeErrorSink); #if FEATURE_FILESYSTEM AddCompiledFile(fullPath, compiledCode); #endif return compiledCode; }
internal static extern Error FT_Get_Advance(IntPtr face, uint gIndex, LoadFlags load_flags, out IntPtr padvance);
internal static extern Error FTC_ImageCache_LookupScaler(IntPtr cache, IntPtr scaler, LoadFlags load_flags, uint gindex, out IntPtr aglyph, out IntPtr anode);
public static extern int gambatte_load(IntPtr core, byte[] romdata, uint length, long now, LoadFlags flags);
public Fixed16Dot16 GetAdvance(uint glyphIndex, LoadFlags flags) { IntPtr padvance; Error err = FT.FT_Get_Advance(Reference, glyphIndex, flags, out padvance); if (err != Error.Ok) throw new FreeTypeException(err); return Fixed16Dot16.FromRawValue((int)padvance); }
public unsafe Fixed16Dot16[] GetAdvances(uint start, uint count, LoadFlags flags) { IntPtr advPtr; Error err = FT.FT_Get_Advances(Reference, start, count, flags, out advPtr); if (err != Error.Ok) throw new FreeTypeException(err); //create a new array and copy the data from the pointer over Fixed16Dot16[] advances = new Fixed16Dot16[count]; IntPtr* ptr = (IntPtr*)advPtr; for (int i = 0; i < count; i++) advances[i] = Fixed16Dot16.FromRawValue((int)ptr[i]); return advances; }
private ScriptCode/*!*/ CompileRubySource(SourceUnit/*!*/ sourceUnit, LoadFlags flags) { Assert.NotNull(sourceUnit); // TODO: check file timestamp string fullPath = Platform.GetFullPath(sourceUnit.Path); CompiledFile compiledFile; if (TryGetCompiledFile(fullPath, out compiledFile)) { Utils.Log(String.Format("{0}: {1}", ++_cacheHitCount, sourceUnit.Path), "LOAD_CACHED"); return compiledFile.CompiledCode; } else { Utils.Log(String.Format("{0}: {1}", ++_compiledFileCount, sourceUnit.Path), "LOAD_COMPILED"); RubyCompilerOptions options = new RubyCompilerOptions(_context.RubyOptions) { FactoryKind = (flags & LoadFlags.LoadIsolated) != 0 ? TopScopeFactoryKind.WrappedFile : TopScopeFactoryKind.File }; long ts1 = Stopwatch.GetTimestamp(); ScriptCode compiledCode = sourceUnit.Compile(options, _context.RuntimeErrorSink); long ts2 = Stopwatch.GetTimestamp(); Interlocked.Add(ref _ScriptCodeGenerationTimeTicks, ts2 - ts1); AddCompiledFile(fullPath, compiledCode); return compiledCode; } }
private bool LoadFromPath(Scope globalScope, object self, string/*!*/ path, LoadFlags flags, out object loaded) { Assert.NotNull(path); string[] sourceFileExtensions; if ((flags & LoadFlags.AnyLanguage) != 0) { sourceFileExtensions = DomainManager.Configuration.GetFileExtensions(); } else { sourceFileExtensions = DomainManager.Configuration.GetFileExtensions(_context); } ResolvedFile file = FindFile(path, (flags & LoadFlags.AppendExtensions) != 0, sourceFileExtensions); if (file == null) { throw RubyExceptions.CreateLoadError(String.Format("no such file to load -- {0}", path)); } MutableString pathWithExtension = _context.EncodePath(path); if (file.AppendedExtension != null) { pathWithExtension.Append(file.AppendedExtension); } if (AlreadyLoaded(pathWithExtension, flags) || _unfinishedFiles.Contains(pathWithExtension.ToString())) { if ((flags & LoadFlags.ResolveLoaded) != 0) { var fullPath = Platform.GetFullPath(file.Path); if (file.SourceUnit != null) { Scope loadedScope; if (!LoadedScripts.TryGetValue(fullPath, out loadedScope)) { throw RubyExceptions.CreateLoadError(String.Format("no such file to load -- {0}", file.Path)); } loaded = loadedScope; } else { loaded = Platform.LoadAssemblyFromPath(fullPath); } } else { loaded = null; } return false; } try { // save path as is, no canonicalization nor combination with an extension or directory: _unfinishedFiles.Push(pathWithExtension.ToString()); if (file.SourceUnit != null) { AddScriptLines(file.SourceUnit); ScriptCode compiledCode; if (file.SourceUnit.LanguageContext == _context) { compiledCode = CompileRubySource(file.SourceUnit, flags); } else { compiledCode = file.SourceUnit.Compile(); } loaded = Execute(globalScope, compiledCode); } else { Debug.Assert(file.Path != null); try { Assembly assembly = Platform.LoadAssemblyFromPath(Platform.GetFullPath(file.Path)); DomainManager.LoadAssembly(assembly); loaded = assembly; } catch (Exception e) { throw RubyExceptions.CreateLoadError(e); } } FileLoaded(pathWithExtension, flags); } finally { _unfinishedFiles.Pop(); } return true; }
/// <summary> /// Returns <b>true</b> if a Ruby file is successfully loaded, <b>false</b> if it is already loaded. /// </summary> /// <param name="globalScope"> /// A scope against which the file should be executed or null to create a new scope. /// </param> /// <returns>True if the file was loaded/executed by this call.</returns> public bool LoadFile(Scope globalScope, object self, MutableString/*!*/ path, LoadFlags flags, out object loaded) { Assert.NotNull(path); string assemblyName, typeName; string strPath = path.ConvertToString(); if (TryParseAssemblyName(strPath, out typeName, out assemblyName)) { if (AlreadyLoaded(path, flags)) { loaded = ((flags & LoadFlags.ResolveLoaded) != 0) ? GetAssembly(assemblyName, true, false) : null; return false; } Assembly assembly = LoadAssembly(assemblyName, typeName, false, false); if (assembly != null) { FileLoaded(path, flags); loaded = assembly; return true; } } return LoadFromPath(globalScope, self, strPath, flags, out loaded); }
private bool AlreadyLoaded(string/*!*/ path, string fullPath, LoadFlags flags, string[]/*!*/ sourceFileExtensions) { Debug.Assert(fullPath == null || RubyUtils.GetExtension(path) == RubyUtils.GetExtension(fullPath)); return (flags & LoadFlags.LoadOnce) != 0 && AnyFileLoaded(GetPathsToTestLoaded(path, fullPath, flags, sourceFileExtensions)); }
public void LoadChar(uint charCode, LoadFlags flags, LoadTarget target) { if (disposed) throw new ObjectDisposedException("face", "Cannot access a disposed object."); Error err = FT.FT_Load_Char(Reference, charCode, (int)flags | (int)target); if (err != Error.Ok) throw new FreeTypeException(err); }
private bool AlreadyLoaded(string/*!*/ path, string fullPath, LoadFlags flags) { return AlreadyLoaded(path, fullPath, flags, ArrayUtils.EmptyStrings); }
public int GetAdvance(uint glyphIndex, LoadFlags flags) { int padvance; Error err = FT.FT_Get_Advance(Reference, glyphIndex, flags, out padvance); if (err != Error.Ok) throw new FreeTypeException(err); return padvance; }
public static extern IntPtr LoadLibraryEx (string lpFileName, IntPtr hFile, LoadFlags dwFlags);
private static extern IntPtr dlopen(string library, LoadFlags flags);
/// <summary> /// Returns <b>true</b> if a Ruby file is successfully loaded, <b>false</b> if it is already loaded. /// </summary> public bool LoadFile(Scope/*!*/ globalScope, object self, MutableString/*!*/ path, LoadFlags flags) { Assert.NotNull(globalScope, path); string assemblyName, typeName; string strPath = path.ConvertToString(); if (TryParseAssemblyName(strPath, out typeName, out assemblyName)) { if (AlreadyLoaded(path, flags)) { return false; } if (LoadAssembly(assemblyName, typeName, false)) { FileLoaded(path, flags); return true; } } return LoadFromPath(globalScope, self, strPath, flags); }
internal static extern Error FT_Get_Advances(IntPtr face, uint start, uint count, LoadFlags load_flags, out IntPtr padvance);
/// <summary> /// Return true if any of the files has alraedy been loaded. /// </summary> private bool AlreadyLoaded(string/*!*/ path, IEnumerable<ResolvedFile>/*!*/ files, LoadFlags flags) { return (flags & LoadFlags.LoadOnce) != 0 && AnyFileLoaded( new[] { _context.EncodePath(path) }.Concat(files.Select((file) => _context.EncodePath(file.Path))) ); }
internal static extern Error FTC_SBitCache_LookupScaler(IntPtr cache, IntPtr scaler, LoadFlags load_flags, uint gindex, out IntPtr sbit, out IntPtr anode);
internal static extern Error FT_Get_Advance(IntPtr face, uint gIndex, LoadFlags load_flags, out int padvance);
public void LoadGlyph(uint glyphIndex, LoadFlags flags, LoadTarget target) { if (disposed) throw new ObjectDisposedException("face", "Cannot access a disposed object."); Error err = FT.FT_Load_Glyph(Reference, glyphIndex, (int)flags | (int)target); if (err != Error.Ok) throw new FreeTypeException(err); }
public unsafe int[] GetAdvances(uint start, uint count, LoadFlags flags) { IntPtr advPtr; Error err = FT.FT_Get_Advances(Reference, start, count, flags, out advPtr); if (err != Error.Ok) throw new FreeTypeException(err); //create a new array and copy the data from the pointer over int[] advances = new int[count]; int* ptr = (int*)advPtr; for (int i = 0; i < count; i++) advances[i] = ptr[i]; return advances; }
public static IntPtr LoadLibraryEx (string lpFileName, IntPtr hFile, LoadFlags dwFlags) { throw new System.NotImplementedException(); }
private bool LoadFromPath(Scope/*!*/ globalScope, object self, string/*!*/ path, LoadFlags flags) { Assert.NotNull(globalScope, path); ResolvedFile file = FindFile(globalScope, path, (flags & LoadFlags.AppendExtensions) != 0); if (file == null) { throw new LoadError(String.Format("no such file to load -- {0}", path)); } MutableString pathWithExtension = MutableString.Create(path); if (file.AppendedExtension != null) { pathWithExtension.Append(file.AppendedExtension); } if (AlreadyLoaded(pathWithExtension, flags) || _unfinishedFiles.Contains(pathWithExtension.ToString())) { return false; } try { // save path as is, no canonicalization nor combination with an extension or directory: _unfinishedFiles.Push(pathWithExtension.ToString()); if (file.SourceUnit != null) { RubyContext rubySource = file.SourceUnit.LanguageContext as RubyContext; if (rubySource != null) { ExecuteRubySourceUnit(file.SourceUnit, globalScope, flags); } else { file.SourceUnit.Execute(); } } else { Debug.Assert(file.Path != null); try { Assembly asm = Platform.LoadAssemblyFromPath(Platform.GetFullPath(file.Path)); DomainManager.LoadAssembly(asm); } catch (Exception e) { throw new LoadError(e.Message, e); } } FileLoaded(pathWithExtension, flags); } finally { _unfinishedFiles.Pop(); } return true; }
internal XmlRawWriter LoadFromWriter(LoadFlags flags, string baseUri) { return new XPathDocumentBuilder(this, null, baseUri, flags); }
private bool AlreadyLoaded(MutableString/*!*/ path, LoadFlags flags) { return (flags & LoadFlags.LoadOnce) != 0 && IsFileLoaded(path); }
public Glyph LookupScaler(Scaler scaler, LoadFlags loadFlags, uint gIndex, out Node node) { if (parentManager.IsDisposed) throw new ObjectDisposedException("Reference", "Cannot access a disposed object."); IntPtr glyphRef, nodeRef; Error err = FT.FTC_ImageCache_LookupScaler(Reference, scaler.Reference, loadFlags, gIndex, out glyphRef, out nodeRef); if (err != Error.Ok) throw new FreeTypeException(err); node = new Node(nodeRef); return new Glyph(glyphRef, null); }
public abstract bool Init(ref LoadData loadData, ControllerType[] controllerSettings, LoadFlags loadFlags);
public DubProject LoadProject(string file, Solution parentSolution, IProgressMonitor monitor, LoadFlags flags = LoadFlags.LoadReferences, DubProject superProject = null) { DubProject prj; if (FilesBeingLoaded.TryGetValue(file, out prj)) return prj; using (new FilesBeingLoadedCleanser(file)) { monitor.BeginTask("Load dub project '" + file + "'", 1); try { prj = supportedDubFileFormats.First((i) => i.CanLoad(file)).Load(file, superProject, parentSolution); } catch (Exception ex) { monitor.ReportError("Couldn't load dub package \"" + file + "\"", ex); } finally { monitor.EndTask(); } if (flags.HasFlag(LoadFlags.LoadReferences)) LoadSubProjects(prj, monitor); } return prj; }