void setContext(ITypeDescriptorContext context) { _metaConnection = context.Instance as MetaConnection; _metaEnum = context.Instance as MetaEnum; _metaTable = context.Instance as MetaTable; _metaColumn = context.Instance as MetaColumn; _metaJoin = context.Instance as MetaJoin; _reportView = context.Instance as ReportView; _reportOutput = context.Instance as ReportOutput; _reportSchedule = context.Instance as ReportSchedule; _parameter = context.Instance as Parameter; _security = context.Instance as SealSecurity; _emailDevice = context.Instance as OutputEmailDevice; }
/// <summary> /// Init the repository from a given path /// </summary> public void Init(string path) { RepositoryPath = path; RepositoryServer.ViewsFolder = ViewsFolder; RepositoryServer.TableTemplatesFolder = TableTemplatesFolder; CheckFolders(); //Data sources if (Sources.Count == 0) { foreach (var file in Directory.GetFiles(SourcesFolder, "*." + SealConfigurationFileExtension)) { try { var source = MetaSource.LoadFromFile(file, this); Sources.Add(source); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } } if (Devices.Count == 0) { //Devices, add a default folder device, then the other devices Devices.Add(OutputFolderDevice.Create()); foreach (var file in Directory.GetFiles(DevicesEmailFolder, "*." + SealConfigurationFileExtension)) { try { Devices.Add(OutputEmailDevice.LoadFromFile(file, true)); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } foreach (var file in Directory.GetFiles(DevicesFileServerFolder, "*." + SealConfigurationFileExtension)) { try { Devices.Add(OutputFileServerDevice.LoadFromFile(file, true)); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } } if (!_assembliesLoaded) { //Load extra assemblies defined in Repository var assemblies = Directory.GetFiles(AssembliesFolder, "*.dll"); foreach (var assembly in assemblies) { try { Assembly.LoadFrom(assembly); } catch (Exception Exception) { Debug.WriteLine(Exception.Message); } } //Add this assembly resolve necessary when executing Razor scripts AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolve); _assembliesLoaded = true; } }
public void Init(string path) { _path = path; CheckFolders(); //Data sources if (_sources.Count == 0) { foreach (var file in Directory.GetFiles(SourcesFolder, "*." + SealConfigurationFileExtension)) { try { var source = MetaSource.LoadFromFile(file, this); _sources.Add(source); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } } if (_devices.Count == 0) { //Devices, add a default folder device, then the other devices _devices.Add(new OutputFolderDevice() { Name = "Folder Device" }); foreach (var file in Directory.GetFiles(DevicesEmailFolder, "*." + SealConfigurationFileExtension)) { try { var device = OutputEmailDevice.LoadFromFile(file, true); _devices.Add(device); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } } if (!_assembliesLoaded) { //Load extra assemblies defined in Repository var assemblies = Directory.GetFiles(AssembliesFolder, "*.dll"); foreach (var assembly in assemblies) { try { Assembly.LoadFrom(assembly); } catch (Exception Exception) { Debug.WriteLine(Exception.Message); } } //Add this assembly resolve necessary when executing Razor scripts AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolve); _assembliesLoaded = true; } }
public static OutputEmailDevice Create() { OutputEmailDevice result = new OutputEmailDevice() { GUID = Guid.NewGuid().ToString() }; result.Name = "Email Device"; return result; }