/// <summary> /// Manually adds a Program to the database /// </summary> /// <param name="instance">CLAPI Instance for the current thread</param> /// <param name="file">Path fo the file</param> public void AddProgram(CLAPI instance, string file) { if (!CLAPI.FileExists(file)) { throw new Exception(file); } string path = Path.GetFullPath(file); logger.Log(LogType.Log, "Creating CLProgram from file: " + file); CLProgram program = new CLProgram(instance, path, GenDataType); foreach (KeyValuePair <string, CLKernel> containedKernel in program.ContainedKernels) { if (!LoadedKernels.ContainsKey(containedKernel.Key)) { logger.Log(LogType.Log, "Adding Kernel: " + containedKernel.Key); LoadedKernels.Add(containedKernel.Key, containedKernel.Value); } else { logger.Log(LogType.Log, "Kernel with name: " + containedKernel.Key + " is already loaded. Skipping..."); } } }
/// <summary> /// Manually adds a Program to the database /// </summary> /// <param name="instance">CLAPI Instance for the current thread</param> /// <param name="file">Path fo the file</param> public void AddProgram(CLAPI instance, string file) { if (!IOManager.FileExists(file)) { throw new FileNotFoundException("File not found: " + file); } string path = file; Logger.Log(LogType.Log, "Creating CLProgram from file: " + file, 3); CLProgram program = new CLProgram(instance, path); loadedPrograms.Add(program); foreach (KeyValuePair <string, CLKernel> containedKernel in program.ContainedKernels) { if (!loadedKernels.ContainsKey(containedKernel.Key)) { Logger.Log(LogType.Log, "Adding Kernel: " + containedKernel.Key, 4); loadedKernels.Add(containedKernel.Key, containedKernel.Value); } else { Logger.Log(LogType.Log, "Kernel with name: " + containedKernel.Key + " is already loaded. Skipping...", 5); } } }