public A2iAOcrProcessingService(API a2iaEngine, string parameterPath, string tableFilename, LoadMethod loadMethod) { _a2iaEngine = a2iaEngine; _parameterDirectory = parameterPath; _documentTableFilename = tableFilename; _loadMethod = loadMethod; }
/// <summary> /// Initializes a new instance of the <see cref="MyTexture"/> class. /// </summary> /// <param name="path">The path.</param> /// <param name="manager">The manager.</param> /// <param name="loadMethod">The load method. See <code>LoadMethod</code> enum.</param> /// <param name="flags">The flags.</param> protected MyTexture(string contentDir, string path, LoadMethod loadMethod, TextureFlags flags) { this.flags = flags; this.Name = path; this.ContentDir = contentDir; // this.Manager = manager; switch (loadMethod) { case LoadMethod.External: this.LoadState = LoadState.Pending; break; case LoadMethod.Lazy: this.LoadState = LoadState.LoadYourself; break; case LoadMethod.LazyBackground: this.LoadState = LoadState.LoadYourselfBackground; break; default: throw new ArgumentOutOfRangeException("loadMethod"); } SetTextureClass(path, ref TextureClassDebug); }
public AssetEntry(string bundleName, string assetName = null, Type assetType = null, LoadMethod?loadMethod = null) { BundleEntry = new BundleEntry(bundleName); AssetName = assetName ?? AssetLoaderInstance.DefaultAssetName(NormBundleName); AssetType = assetType ?? typeof(Object); LoadMethod = loadMethod ?? LoadMethod.Single; }
/// <summary> /// Construct from a Unity SceneSetup /// </summary> public SceneEntry( UnityEditor.SceneManagement.SceneSetup sceneSetup ) { scene = new AmsSceneReference( sceneSetup.path ); loadInEditor = sceneSetup.isLoaded; loadMethod = LoadMethod.Additive; }
/// <summary> /// Construct from a Unity SceneSetup /// </summary> public SceneEntry(UnityEditor.SceneManagement.SceneSetup sceneSetup) { scene = new AmsSceneReference(sceneSetup.path); loadInEditor = sceneSetup.isLoaded; loadMethod = LoadMethod.Additive; }
static private Assembly TryLoad(string name, LoadMethod loadmethod) { Assembly ass = null; try { switch (loadmethod) { case LoadMethod.Load: ass = Assembly.Load(name); break; case LoadMethod.LoadFrom: ass = Assembly.LoadFrom(name); break; case LoadMethod.LoadFile: ass = Assembly.LoadFile(name); break; default: break; } } catch (BadImageFormatException) { } catch (FileNotFoundException) { } catch (FileLoadException) { } catch (SystemException) { } return ass; }
public void LoadMulti(Queue <AssetRecord> queue, bool isCacheToRecord, LoadMethod method, Action <object> onLoadingEnd, Action onAllLoaded) { if (queue.Count == 0 && onAllLoaded != null) { Debug.Log("LoadMulti ~ 无任何可加载的东西 "); onAllLoaded(); } else { int count = queue.Count; ProgressMonitor monitor = new ProgressMonitor(count, ProgressState.LOAD); while (queue.Count > 0) { AssetRecord assetRecord = queue.Dequeue(); LoadFile loadFile = assetRecord.GetLoadFile(LoadBehaviour.ContentLoadFromLoacal_LoadBundleFile, isCacheToRecord, onLoadingEnd, (loadedFile) => { count--; monitor.Refresh(loadedFile); if (count == 0 && onAllLoaded != null) { onAllLoaded(); } }); LoadFileController.Instance.Load(loadFile); } } }
/// <summary> /// Initializes a new instance of the AssemblyResolver class. A default instance of this class will resolve /// assemblies into the LoadFrom context. /// </summary> /// <param name="loader"> /// The loader to use when loading assemblies. Default is null, which will create and use an instance /// of the RemotableAssemblyLoader class. /// </param> /// <param name="loadMethod"> /// The load method to use when loading assemblies. Defaults to LoadMethod.LoadFrom. /// </param> public PathBasedAssemblyResolver( IAssemblyLoader loader = null, LoadMethod loadMethod = LoadMethod.LoadFrom) { this.probePaths = new HashSet<string>(); this.loader = loader == null ? new AssemblyLoader() : loader; this.LoadMethod = loadMethod; }
/// <summary> /// Initializes a new instance of the AssemblyResolver class. A default instance of this class will resolve /// assemblies into the LoadFrom context. /// </summary> /// <param name="loader"> /// The loader to use when loading assemblies. Default is null, which will create and use an instance /// of the RemotableAssemblyLoader class. /// </param> /// <param name="loadMethod"> /// The load method to use when loading assemblies. Defaults to LoadMethod.LoadFrom. /// </param> public PathBasedAssemblyResolver( IAssemblyLoader loader = null, LoadMethod loadMethod = LoadMethod.LoadFrom) { this.probePaths = new HashSet <string>(); this.loader = loader == null ? new AssemblyLoader() : loader; this.LoadMethod = loadMethod; }
public A2iAOcrProcessingService(API a2IaEngine, IA2iaConfiguration configuration) { this.a2IaEngine = a2IaEngine; parameterDirectory = configuration.ParameterPath; loadMethod = configuration.LoadMethod; fileType = configuration.FileType; maxProcessorCount = configuration.MaxProcessorCount; this.configuration = configuration; }
/// <inheritdoc/> /// <remarks> /// In order to ensure that the assembly is loaded the way the caller expects, the LoadMethod property of /// the remote domain assembly resolver will be temporarily set to the value of <paramref name="loadMethod"/>. /// It will be reset to the original value after the load is complete. /// </remarks> public IAssemblyTarget LoadAssembly(LoadMethod loadMethod, string path, string pdbPath = null) { var previousLoadMethod = this.resolverProxy.RemoteObject.LoadMethod; this.resolverProxy.RemoteObject.LoadMethod = loadMethod; var target = this.loaderProxy.RemoteObject.LoadAssembly(loadMethod, path, pdbPath); this.resolverProxy.RemoteObject.LoadMethod = previousLoadMethod; return(target); }
/// <inheritdoc /> /// <remarks> /// In order to ensure that the assembly is loaded the way the caller expects, the LoadMethod property of /// the remote domain assembly resolver will be temporarily set to the value of <paramref name="loadMethod"/>. /// It will be reset to the original value after the load is complete. /// </remarks> public IEnumerable <IAssemblyTarget> LoadAssemblyWithReferences(LoadMethod loadMethod, string path) { var previousLoadMethod = this.resolverProxy.RemoteObject.LoadMethod; this.resolverProxy.RemoteObject.LoadMethod = loadMethod; var targets = this.loaderProxy.RemoteObject.LoadAssemblyWithReferences(loadMethod, path); this.resolverProxy.RemoteObject.LoadMethod = previousLoadMethod; return(targets); }
public A2iAOcrService(IA2iaConfiguration configuration) { _a2IaEngine = new APIClass(); _parameterDirectory = configuration.ParameterPath; _loadMethod = configuration.LoadMethod; _fileType = configuration.FileType; _channelTimeout = configuration.ChannelTimeout; _configuration = configuration; }
public Resourcer(LoadMethod lm) { if (lm == LoadMethod.CurrentCode) { asm = Assembly.GetExecutingAssembly(); } else { asm = Assembly.GetCallingAssembly(); } }
protected static void RegisterType(Type type, LoadMethod loadMethod, Boolean overwriteExisting) { if (ContentLoader._additionalTypeHandlers.ContainsKey(type)) { if (!overwriteExisting) { return; } ContentLoader._additionalTypeHandlers.Remove(type); } ContentLoader._additionalTypeHandlers.Add(type, loadMethod); }
/// <inheritdoc /> /// <remarks> /// This implementation will perform a best-effort load of the target assembly and it's required references /// into the current application domain. The .NET framework pins us in on which call we're allowed to use /// when loading these assemblies, so we'll need to rely on the AssemblyResolver instance attached to the /// AppDomain in order to load the way we want. /// </remarks> public IList <Assembly> LoadAssemblyWithReferences(LoadMethod loadMethod, string assemblyPath) { var list = new List <Assembly>(); var assembly = this.LoadAssembly(loadMethod, assemblyPath); list.Add(assembly); foreach (var reference in assembly.GetReferencedAssemblies()) { list.Add(Assembly.Load(reference)); } return(list); }
public static string ToString(LoadMethod loadMethod) { switch (loadMethod) { case LoadMethod.Replace: return("replace"); case LoadMethod.Append: return("append"); case LoadMethod.AppendPlay: return("append-play"); } throw new ArgumentException("Invalid enumeration value."); }
public SceneState(string filePath = "", int levelID = -1, bool isEncore = false, string sceneDirectory = "", string zone = "", string name = "", string sceneID = "", LoadMethod loadType = SceneState.LoadMethod.Unspecified, IList <string> exDDList = null, string dataDirectory = "") { FilePath = filePath; LevelID = levelID; IsEncoreMode = isEncore; SceneDirectory = sceneDirectory; Zone = zone; Name = name; SceneID = sceneID; LoadType = loadType; MasterDataDirectory = dataDirectory; if (exDDList != null) { ExtraDataDirectories = exDDList; } }
/// <inheritdoc/> public IAssemblyTarget LoadAssembly(LoadMethod loadMethod, string assemblyPath, string pdbPath = null) { IAssemblyTarget target = null; var assembly = this.loader.LoadAssembly(loadMethod, assemblyPath, pdbPath); if (loadMethod == LoadMethod.LoadBits) { // Assemlies loaded by bits will have the codebase set to the assembly that loaded it. Set it to the correct path here. var codebaseUri = new Uri(assemblyPath); target = AssemblyTarget.FromPath(codebaseUri, assembly.Location, assembly.FullName); } else { target = AssemblyTarget.FromAssembly(assembly); } return target; }
/// <inheritdoc/> public IAssemblyTarget LoadAssembly(LoadMethod loadMethod, string assemblyPath, string pdbPath = null) { IAssemblyTarget target = null; var assembly = this.loader.LoadAssembly(loadMethod, assemblyPath, pdbPath); if (loadMethod == LoadMethod.LoadBits) { // Assemlies loaded by bits will have the codebase set to the assembly that loaded it. Set it to the correct path here. var codebaseUri = new Uri(assemblyPath); target = AssemblyTarget.FromPath(codebaseUri, assembly.Location, assembly.FullName); } else { target = AssemblyTarget.FromAssembly(assembly); } return(target); }
public static AudioClip Load( Stream dataStream, SelectDecoder audioFormat, string unityAudioClipName, LoadMethod loadType = LoadMethod.AllPartsInBackgroundThread, bool diposeDataStreamIfNotNeeded = true #if UNITY_4 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 , bool is3D = true #endif ) { var config = new AudioLoaderConfig() { DataStream = dataStream, AudioFormat = audioFormat, UnityAudioClipName = unityAudioClipName, LoadMethod = loadType, DisposeDataStreamIfNotNeeded = diposeDataStreamIfNotNeeded, PreferredDecoder = PreferredDecoder, #if UNITY_4 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 Is3D = is3D, #endif }; var audioLoader = new AudioLoader(config); audioLoader.OnLoadingDone += () => OnLoadingDonePrivate(audioLoader); audioLoader.OnLoadingAborted += () => OnLoadingAbortedPrivate(audioLoader); audioLoader.OnLoadingFailed += (exception) => OnLoadingFailedPrivate(audioLoader, exception); if (loadType == LoadMethod.StreamInUnityThread) { SetAudioClipLoadType(audioLoader.AudioClip, AudioClipLoadType.Streaming); } else { SetAudioClipLoadType(audioLoader.AudioClip, AudioClipLoadType.DecompressOnLoad); } SetAudioClipLoadState(audioLoader.AudioClip, audioLoader.LoadState); audioLoader.StartLoading(); SetAudioClipLoadState(audioLoader.AudioClip, audioLoader.LoadState); return(audioLoader.AudioClip); }
/// <summary> /// Loads content from resources /// </summary> /// <typeparam name="T">Type of content object</typeparam> /// <param name="name">Name of resource</param> /// <returns>Loaded content object</returns> public T Load <T>(String name) { name = FullPath(name); String searchName = ContentName <T>(name); // Check if this resource wasn't already loaded Object typeObject = null; lock (_lockObj) { if (_loadedContentObjects.TryGetValue(searchName, out typeObject)) { return((T)typeObject); } } // Search for registered additional types and their loaders LoadMethod loadMethod = null; lock (_lockObj) { if (_additionalTypeHandlers.TryGetValue(typeof(T), out loadMethod)) { // Call load method to load the object typeObject = loadMethod(name); // If loaded correctly, add object to the buffer; check if it already has object added by LoadNative method which may be called // from loadMethod. if (typeObject != null && !_loadedContentObjects.ContainsKey(searchName)) { _loadedContentObjects.Add(searchName, typeObject); } // Return loaded object return((T)typeObject); } } return(LoadNative <T>(name)); }
private void LoadFile(LoadMethod loadMethod, string filter = "All Files|*.*") { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = filter; bool? fileChosen = dialog.ShowDialog(); if (fileChosen == true) { try { StopEmulation(); loadMethod(dialog.FileName); StartEmulation(); } catch (SystemException ex) { MessageBox.Show(ex.Message, "Failed to Load File", MessageBoxButton.OK, MessageBoxImage.Error); } } }
/// <inheritdoc /> /// <remarks> /// If the LoadMethod for this instance is set to LoadBits and the path to the PDB file is unspecified then we will attempt to guess /// the path to the PDB and load it. Note that if an assembly is loaded into memory without it's debugging symbols then an /// image exception will be thrown. Be wary of this. Loading an Assembly with the LoadBits method will not lock /// the DLL file because the entire assembly is loaded into memory and the file handle is closed. Note that, however, /// Assemblies loaded in this manner will not have a location associated with them--so you must then key the Assembly /// by it's strong name. This can cause problems when loading multiple versions of the same assembly into a single /// application domain. /// </remarks> public Assembly LoadAssembly(LoadMethod loadMethod, string assemblyPath, string pdbPath = null) { Assembly assembly = null; switch (loadMethod) { case LoadMethod.LoadFrom: assembly = Assembly.LoadFrom(assemblyPath); break; case LoadMethod.LoadFile: assembly = Assembly.LoadFile(assemblyPath); break; case LoadMethod.LoadBits: // Attempt to load the PDB bits along with the assembly to avoid image exceptions. pdbPath = string.IsNullOrEmpty(pdbPath) ? Path.ChangeExtension(assemblyPath, "pdb") : pdbPath; // Only load the PDB if it exists--we may be dealing with a release assembly. if (File.Exists(pdbPath)) { assembly = Assembly.Load( File.ReadAllBytes(assemblyPath), File.ReadAllBytes(pdbPath)); } else { assembly = Assembly.Load(File.ReadAllBytes(assemblyPath)); } break; default: // In case we upadate the enum but forget to update this logic. throw new NotSupportedException("The target load method isn't supported!"); } return(assembly); }
public override void Init() { #region For some planned features. /* * _screenWidth = Screen.PrimaryScreen.Bounds.Width; * _screenHeight = Screen.PrimaryScreen.Bounds.Height; * SetWindowSize(_screenWidth, _screenHeight / 9 * 2, true); */ #endregion #region GUI // GUIHandler _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); _guiImage = new GUIImage("Assets/img/AudioTestWallpaper.png", 0, 0, 0, 1280, 720); _guiHandler.Add(_guiImage); #endregion // Set this to control the file formats and loading methods. _fileFormat = AudioFileFormat.mp3; _streamOrLoad = LoadMethod.load; // Now load the correct files. LoadFiles(); #region Audio settings _sound1.Volume = 3.0f; _sound2.Volume = 3.0f; _sound3.Volume = 3.0f; _sound4.Volume = 2.0f; _sound1.Loop = false; _sound2.Loop = false; _sound3.Loop = false; _sound4.Loop = false; #endregion }
public void LoadMulti(RuntimeAssetType type, List <string> indexNames, bool isCacheToRecord, LoadMethod method, Action <object> onLoadingEnd, Action onAllLoaded) { if (!IsInitialized) { Debug.Log("尚未初始化!"); return; } Dictionary <string, AssetRecord> records = RecordsInfo.GetRecordsDic(type); Queue <AssetRecord> queue = new Queue <AssetRecord>(); var it = indexNames.GetEnumerator(); while (it.MoveNext()) { if (records.ContainsKey(it.Current)) { queue.Enqueue(records[it.Current]); } } LoadMulti(queue, isCacheToRecord, method, onLoadingEnd, onAllLoaded); }
/// <inheritdoc /> /// <remarks> /// If the LoadMethod for this instance is set to LoadBits and the path to the PDB file is unspecified then we will attempt to guess /// the path to the PDB and load it. Note that if an assembly is loaded into memory without it's debugging symbols then an /// image exception will be thrown. Be wary of this. Loading an Assembly with the LoadBits method will not lock /// the DLL file because the entire assembly is loaded into memory and the file handle is closed. Note that, however, /// Assemblies loaded in this manner will not have a location associated with them--so you must then key the Assembly /// by it's strong name. This can cause problems when loading multiple versions of the same assembly into a single /// application domain. /// </remarks> public Assembly LoadAssembly(LoadMethod loadMethod, string assemblyPath, string pdbPath = null) { Assembly assembly = null; switch (loadMethod) { case LoadMethod.LoadFrom: assembly = Assembly.LoadFrom(assemblyPath); break; case LoadMethod.LoadFile: assembly = Assembly.LoadFile(assemblyPath); break; case LoadMethod.LoadBits: // Attempt to load the PDB bits along with the assembly to avoid image exceptions. pdbPath = string.IsNullOrEmpty(pdbPath) ? Path.ChangeExtension(assemblyPath, "pdb") : pdbPath; // Only load the PDB if it exists--we may be dealing with a release assembly. if (File.Exists(pdbPath)) { assembly = Assembly.Load( File.ReadAllBytes(assemblyPath), File.ReadAllBytes(pdbPath)); } else { assembly = Assembly.Load(File.ReadAllBytes(assemblyPath)); } break; default: // In case we upadate the enum but forget to update this logic. throw new NotSupportedException("The target load method isn't supported!"); } return assembly; }
/// <inheritdoc /> /// <remarks> /// LoadMethod.LoadFile is not supported. See LoadAssembly for more details. /// </remarks> public Assembly ReflectionOnlyLoadAssembly(LoadMethod loadMethod, string assemblyPath) { Assembly assembly = null; switch (loadMethod) { case LoadMethod.LoadFrom: assembly = Assembly.ReflectionOnlyLoadFrom(assemblyPath); break; case LoadMethod.LoadFile: throw new NotSupportedException("The target load method isn't supported!"); case LoadMethod.LoadBits: assembly = Assembly.ReflectionOnlyLoad(File.ReadAllBytes(assemblyPath)); break; default: // In case we upadate the enum but forget to update this logic. throw new NotSupportedException("The target load method isn't supported!"); } return(assembly); }
/// <summary> /// Initializes a new instance of the <see cref="MyTexture2D"/> class. /// </summary> /// <param name="path">The path.</param> /// <param name="manager">The manager.</param> /// <param name="loadMethod">if set to <c>true</c> [external load].</param> /// <param name="flags">The flags.</param> public MyTexture2D(string contentDir, string path, LoadMethod loadMethod, TextureFlags flags) : base(contentDir, path, loadMethod, flags) { }
public VTex2D(string path, LoadMethod lm, bool alpha = true) { if (File.Exists(path) == false) { return; } if (path == string.Empty || path == "" || path == null) { return; } Path = path; if (Lut.ContainsKey(path)) { var ot = Lut[path]; ID = ot.ID; W = ot.W; H = ot.H; Path = ot.Path; Alpha = ot.Alpha; Name = ot.Name; return; } else { Lut.Add(path, this); } Console.WriteLine("Reading:" + path); GL.Enable(EnableCap.Texture2D); ID = GL.GenTexture(); GL.BindTexture(TextureTarget.Texture2D, ID); if (new FileInfo(path + ".cache").Exists) { FileStream fs = new FileStream(path + ".cache", FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader(fs); Name = r.ReadString(); Path = r.ReadString(); W = r.ReadInt16(); H = r.ReadInt16(); Alpha = r.ReadBoolean(); int pc = 3; if (Alpha) { pc = 4; } RawData = new byte[W * H * pc]; r.Read(RawData, 0, W * H * pc); fs.Close(); fs = null; } else { Bitmap img = new Bitmap(path); //System.Drawing.Imaging.BitmapData dat = img.LockBits( new Rectangle(0, 0, img.Width, img.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.); W = img.Width; H = img.Height; Alpha = alpha; int pc = 3; if (Alpha) { pc = 4; } RawData = new byte[W * H * pc]; //GL.TexImage2D(TextureTarget.Texture2D,0,PixelInternalFormat.) int pi = 0; for (int y = 0; y < img.Height; y++) { for (int x = 0; x < img.Width; x++) { var pix = img.GetPixel(x, y); RawData[pi++] = pix.R; RawData[pi++] = pix.G; RawData[pi++] = pix.B; if (alpha) { RawData[pi++] = pix.A; } } } FileStream fs = new FileStream(path + ".cache", FileMode.Create, FileAccess.Write); BinaryWriter w = new BinaryWriter(fs); if (Name == null || Name == string.Empty) { Name = "Tex2D"; } w.Write(Name); w.Write(Path); w.Write((short)W); w.Write((short)H); w.Write(Alpha); pc = 3; if (alpha) { pc = 4; } w.Write(RawData, 0, W * H * pc); fs.Flush(); fs.Close(); fs = null; } if (alpha) { GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, W, H, 0, PixelFormat.Rgba, PixelType.UnsignedByte, RawData); } else { GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, W, H, 0, PixelFormat.Rgb, PixelType.UnsignedByte, RawData); } GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.BindTexture(TextureTarget.Texture2D, 0); }
public List <BaseModel> Search(string AEOWhereClause, LoadMethod ChooseLoadMethod) { String AOWhereClause = toAOWhereClause(AEOWhereClause); return(_persistence.Search(this, AOWhereClause, ChooseLoadMethod)); }
private void lineByLine_Checked(object sender, RoutedEventArgs e) { loadMethod = LoadMethod.LineByLine; }
public void SetParameters(string parameterPath, string tableFilename, LoadMethod loadMethod) { throw new NotImplementedException(); }
public BaseSettings?Load(BaseSettings settings, string path) => LoadMethod?.Invoke(Object, new object[] { settings, path }) as BaseSettings;
/// <inheritdoc /> public IEnumerable<IAssemblyTarget> LoadTargetWithReferences(LoadMethod loadMethod, IAssemblyTarget target) { return this.LoadAssemblyWithReferences(loadMethod, target.CodeBase.LocalPath); }
public VTex2D(string path, LoadMethod lm) { GL.ActiveTexture(TextureUnit.Texture0); Path = path; if (lm == LoadMethod.Single) { // Check if FreeImage.dll is available (can be in %path%). bool sl = false; if (File.Exists(Path + ".vtex")) { FileStream fs = new FileStream(Path + ".vtex", FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader(fs); SkipBitmap(r); ReadBitmap(r); r.Close(); sl = true; } if (sl == false) { if (File.Exists(path) == false) { return; } TexData = new Bitmap(path); W = TexData.Width; H = TexData.Height; } //TexData = new Bitmap(path); D = 1; Loaded = true; Alpha = true; //SetPix(); BindData(); if (sl == false) { SaveTex(path + ".vtex"); } } else { bool sl = false; if (File.Exists(Path + ".vtex")) { sl = true; } if (sl == false) { LoadThread = new Thread(new ThreadStart(T_LoadTex)); LoadThread.Start(); } else { FileStream fs = new FileStream(Path + ".vtex", FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader(fs); ReadBitmap(r); D = 1; PreLoaded = true; Alpha = true; // SetPix(); BindData(); nf = fs; nr = r; LoadThread = new Thread(new ThreadStart(T_LoadVTex)); LoadThread.Start(); } } }
/// <summary> /// Initializes a new instance of the <see cref="MyTexture"/> class. /// </summary> /// <param name="path">The path.</param> /// <param name="manager">The manager.</param> /// <param name="loadMethod">The load method. See <code>LoadMethod</code> enum.</param> /// <param name="flags">The flags.</param> protected MyTexture(string path, LoadMethod loadMethod, TextureFlags flags) { this.flags = flags; this.Name = path; // this.Manager = manager; switch (loadMethod) { case LoadMethod.External: this.LoadState = LoadState.Pending; break; case LoadMethod.Lazy: this.LoadState = LoadState.LoadYourself; break; case LoadMethod.LazyBackground: this.LoadState = LoadState.LoadYourselfBackground; break; default: throw new ArgumentOutOfRangeException("loadMethod"); } }
private void fileAtOnce_Checked(object sender, RoutedEventArgs e) { loadMethod = LoadMethod.File; }
public Texture2D(string path, LoadMethod lm, bool alpha = true) { Load(path, alpha); }
/// <summary> /// Initializes a new instance of the <see cref="MyTexture2D"/> class. /// </summary> /// <param name="path">The path.</param> /// <param name="manager">The manager.</param> /// <param name="loadMethod">if set to <c>true</c> [external load].</param> /// <param name="flags">The flags.</param> public MyTextureCube(string path, LoadMethod loadMethod, TextureFlags flags) : base(path, loadMethod, flags) { }
/// <inheritdoc/> public IList<IAssemblyTarget> LoadAssemblyWithReferences(LoadMethod loadMethod, string assemblyPath) { return this.loader.LoadAssemblyWithReferences(loadMethod, assemblyPath).Select(x => AssemblyTarget.FromAssembly(x)).ToList(); }
/// <inheritdoc/> /// <remarks> /// In order to ensure that the assembly is loaded the way the caller expects, the LoadMethod property of /// the remote domain assembly resolver will be temporarily set to the value of <paramref name="loadMethod"/>. /// It will be reset to the original value after the load is complete. /// </remarks> public IAssemblyTarget LoadAssembly(LoadMethod loadMethod, string path, string pdbPath = null) { var previousLoadMethod = this.resolverProxy.RemoteObject.LoadMethod; this.resolverProxy.RemoteObject.LoadMethod = loadMethod; var target = this.loaderProxy.RemoteObject.LoadAssembly(loadMethod, path, pdbPath); this.resolverProxy.RemoteObject.LoadMethod = previousLoadMethod; return target; }
/// <inheritdoc/> public IList <IAssemblyTarget> LoadAssemblyWithReferences(LoadMethod loadMethod, string assemblyPath) { return(this.loader.LoadAssemblyWithReferences(loadMethod, assemblyPath).Select(x => AssemblyTarget.FromAssembly(x)).ToList()); }
/// <inheritdoc /> /// <remarks> /// This implementation will perform a best-effort load of the target assembly and it's required references /// into the current application domain. The .NET framework pins us in on which call we're allowed to use /// when loading these assemblies, so we'll need to rely on the AssemblyResolver instance attached to the /// AppDomain in order to load the way we want. /// </remarks> public IList<Assembly> LoadAssemblyWithReferences(LoadMethod loadMethod, string assemblyPath) { var list = new List<Assembly>(); var assembly = this.LoadAssembly(loadMethod, assemblyPath); list.Add(assembly); foreach (var reference in assembly.GetReferencedAssemblies()) { list.Add(Assembly.Load(reference)); } return list; }
/// <inheritdoc /> /// <remarks> /// In order to ensure that the assembly is loaded the way the caller expects, the LoadMethod property of /// the remote domain assembly resolver will be temporarily set to the value of <paramref name="loadMethod"/>. /// It will be reset to the original value after the load is complete. /// </remarks> public IEnumerable<IAssemblyTarget> LoadAssemblyWithReferences(LoadMethod loadMethod, string path) { var previousLoadMethod = this.resolverProxy.RemoteObject.LoadMethod; this.resolverProxy.RemoteObject.LoadMethod = loadMethod; var targets = this.loaderProxy.RemoteObject.LoadAssemblyWithReferences(loadMethod, path); this.resolverProxy.RemoteObject.LoadMethod = previousLoadMethod; return targets; }
private void blockByBlock_Checked(object sender, RoutedEventArgs e) { loadMethod = LoadMethod.Block; }
/// <inheritdoc /> public IAssemblyTarget LoadTarget(LoadMethod loadMethod, IAssemblyTarget target) { return this.LoadAssembly(loadMethod, target.CodeBase.LocalPath); }