public static List <TaskHost> GetControlFlowObjects <T>(DtsContainer container) { List <TaskHost> returnItems = new List <TaskHost>(); if (container is EventsProvider) { EventsProvider ep = (EventsProvider)container; foreach (DtsEventHandler eh in ep.EventHandlers) { returnItems.AddRange(GetControlFlowObjects <T>(eh)); } } IDTSSequence sequence = (IDTSSequence)container; foreach (Executable exec in sequence.Executables) { if (exec is IDTSSequence) { returnItems.AddRange(GetControlFlowObjects <T>((DtsContainer)exec)); } else if (exec is TaskHost) { TaskHost th = (TaskHost)exec; if (th.InnerObject is T) { returnItems.Add(th); } } } return(returnItems); }
public void EventsProvider_Initialisation() { Mock<IEventsDevice> eventsDevice = new Mock<IEventsDevice>(); IEventsProvider eventsProvider = new EventsProvider(eventsDevice.Object); Assert.IsNotNull(eventsProvider); }
private DtsContainer FindObjectForVariablePackagePath(DtsContainer parent, string PackagePath) { if (PackagePath.StartsWith(((IDTSPackagePath)parent).GetPackagePath() + ".Variables[")) { return((DtsContainer)parent); } IDTSSequence seq = parent as IDTSSequence; if (seq != null) { foreach (Executable e in seq.Executables) { if (e is IDTSPackagePath) { if (PackagePath.StartsWith(((IDTSPackagePath)e).GetPackagePath() + ".Variables[")) { return((DtsContainer)e); } } if (e is DtsContainer) { DtsContainer ret = FindObjectForVariablePackagePath((DtsContainer)e, PackagePath); if (ret != null) { return(ret); } } } } EventsProvider prov = parent as EventsProvider; if (prov != null) { foreach (DtsEventHandler eh in prov.EventHandlers) { if (eh is IDTSPackagePath) { if (PackagePath.StartsWith(((IDTSPackagePath)eh).GetPackagePath() + ".Variables[")) { return((DtsContainer)eh); } } if (eh is IDTSSequence) { DtsContainer ret = FindObjectForVariablePackagePath((DtsContainer)eh, PackagePath); if (ret != null) { return(ret); } } } } return(null); }
private void ProcessObject(object component, System.ComponentModel.BackgroundWorker worker, string path) { if (worker.CancellationPending) { return; } DtsContainer container = component as DtsContainer; // Should only get package as we call GetPackage up front. Could make scope like, but need UI indicator that this is happening Package package = component as Package; if (package != null) { path = "\\Package"; CheckConnectionManagers(package, worker, path); } else if (!(component is DtsEventHandler)) { path = path + "\\" + container.Name; } IDTSPropertiesProvider propertiesProvider = component as IDTSPropertiesProvider; if (propertiesProvider != null) { CheckProperties(propertiesProvider, worker, path); } EventsProvider eventsProvider = component as EventsProvider; if (eventsProvider != null) { foreach (DtsEventHandler eventhandler in eventsProvider.EventHandlers) { ProcessObject(eventhandler, worker, path + ".EventHandlers[" + eventhandler.Name + "]"); } } IDTSSequence sequence = component as IDTSSequence; if (sequence != null) { ProcessSequence(container, sequence, worker, path); ScanPrecedenceConstraints(worker, path, container.ID, sequence.PrecedenceConstraints); } }
static void Main(string[] args) { Console.WriteLine("My build test for CS"); if (args == null) { Console.WriteLine("args is null"); } string path = args[0]; var repository = new EventRepository(); var provider = new EventsProvider(path); var eventService = new EventService(provider, repository); eventService.SaveAsync(); }
private DtsContainer FindContainer(DtsContainer component, string objectId) { //DtsContainer container = component as DtsContainer; if (component == null) { return(null); } else if (component.ID == objectId) { return(component); } EventsProvider eventsProvider = component as EventsProvider; if (eventsProvider != null) { foreach (DtsEventHandler eventhandler in eventsProvider.EventHandlers) { DtsContainer container = FindContainer(eventhandler, objectId); if (container != null) { return(container); } } } IDTSSequence sequence = component as IDTSSequence; if (sequence != null) { foreach (Executable executable in sequence.Executables) { DtsContainer container = FindContainer((DtsContainer)executable, objectId); if (container != null) { return(container); } } } return(null); }
private void ProcessObject(object component, string path) { DtsContainer container = component as DtsContainer; // Should only get package as we call GetPackage up front. Could make scope like, but need UI indicator that this is happening Package package = component as Package; if (package != null) { path = "\\Package"; } else if (!(component is DtsEventHandler)) { path = path + "\\" + container.Name; } if (container != null) { ScanVariables(path, container.Variables); } EventsProvider eventsProvider = component as EventsProvider; if (eventsProvider != null) { foreach (DtsEventHandler eventhandler in eventsProvider.EventHandlers) { ProcessObject(eventhandler, path + ".EventHandlers[" + eventhandler.Name + "]"); } } IDTSSequence sequence = component as IDTSSequence; if (sequence != null) { ProcessSequence(container, sequence, path); } }
public void SetUp() { // arrange var testCaseCollection = new List <List <Event> >(); var collection1 = new List <Event> { new Event(), new Event() }; var collection2 = new List <Event> { new Event() }; var collection3 = new List <Event> { new Event(), new Event(), new Event() }; testCaseCollection.Add(collection1); testCaseCollection.Add(collection2); testCaseCollection.Add(collection3); contentProviderFactory = new Mock <IContentProvidersFacade>(); contentProviderFactory.Setup(p => p.CreateContentProvidersCollectionAsync()) .ReturnsAsync(testCaseCollection); eventsProvider = new EventsProvider(contentProviderFactory.Object); }
private void IterateContainers(DtsContainer parent, TreeNodeCollection nodes) { TreeNode node = new TreeNode(); node.Name = parent.Name; node.Text = parent.Name; node.Tag = parent.ID; node.Checked = true; node.Expand(); if (parent is EventsProvider) { EventsProvider ep = (EventsProvider)parent; if (ep.EventHandlers.Count > 0) { TreeNode eventNode = new TreeNode("Event Handlers"); foreach (DtsEventHandler eh in ep.EventHandlers) { IterateContainers((DtsContainer)eh, eventNode.Nodes); } node.Nodes.Add(eventNode); } } nodes.Add(node); IDTSSequence seq = (IDTSSequence)parent; foreach (Executable e in seq.Executables) { if (e is IDTSSequence) { IterateContainers((DtsContainer)e, node.Nodes); } else { DtsContainer task = (DtsContainer)e; TreeNode childNode = new TreeNode(); childNode.Name = task.Name; childNode.Text = task.Name; childNode.Tag = task.ID; childNode.Checked = true; if (task is EventsProvider) { EventsProvider ep = (EventsProvider)task; if (ep.EventHandlers.Count > 0) { TreeNode eventNode = new TreeNode("Event Handlers"); foreach (DtsEventHandler eh in ep.EventHandlers) { IterateContainers((DtsContainer)eh, eventNode.Nodes); } node.Nodes.Add(eventNode); } } node.Nodes.Add(childNode); } } return; }
private void Awake() { _selfTransform = GetComponent <Transform>(); _playerEvents = EventsProvider.Get <PlayerControllerEvents>(); _playerEvents.OnPlayerMoving += OnPlayerMoving; }
private void ProcessObject(object component, TreeNode parentNode) { if (this.CancellationPending) { return; } Package package = component as Package; if (package != null) { // Package node is created in calling function. CheckConnectionManagers(package, parentNode); } DtsContainer container = component as DtsContainer; if (container != null) { string containerKey = PackageHelper.GetContainerKey(container); TaskHost taskHost = null; if (package == null) { int imageIndex = GetControlFlowImageIndex(containerKey); parentNode = AddNode(parentNode, container.Name, imageIndex, component); taskHost = container as TaskHost; } if (taskHost != null) { CheckTask(taskHost, parentNode); } else if (containerKey == PackageHelper.ForLoopCreationName) { CheckForLoop(container as IDTSPropertiesProvider, parentNode); } else if (containerKey == PackageHelper.ForEachLoopCreationName) { CheckForEachLoop(container as ForEachLoop, parentNode); } else if (containerKey == PackageHelper.SequenceCreationName) { ScanProperties(container as IDTSPropertiesProvider, parentNode); } else { // Package, Event Handlers etc ScanProperties(container as IDTSPropertiesProvider, parentNode); } string currentPath = string.Empty; IDTSPackagePath packagePath = component as IDTSPackagePath; if (packagePath != null) { currentPath = packagePath.GetPackagePath(); } ScanVariables(container.Variables, parentNode, currentPath); } EventsProvider eventsProvider = component as EventsProvider; if (eventsProvider != null) { TreeNode eventsNode = AddFolder("EventHandlers", parentNode); foreach (DtsEventHandler eventhandler in eventsProvider.EventHandlers) { ProcessObject(eventhandler, eventsNode); } } IDTSSequence sequence = component as IDTSSequence; if (sequence != null) { ProcessSequence(sequence, parentNode); ScanPrecedenceConstraints(container.ID, sequence.PrecedenceConstraints, parentNode); } }
private void Awake() { _playerEvents = EventsProvider.Get <PlayerControllerEvents>(); _selfTransform = GetComponent <Transform>(); _lastPosition = _selfTransform.position; }
public void Setup() { var hub = new EventsProvider(); _fixture.Register<IEventsProvider>(() => hub); }
private object SetPropertyValue(DtsObject dtsObject, string propertyPath, object value) { propertyPath = propertyPath.Replace("\\", "."); object returnValue = null; string firstPart = propertyPath; string restOfString = string.Empty; if (propertyPath.Contains(".")) { //Can have periods in object names (like connection manager names) //Need to verify that period is not between an index marker int delimiterIndex = propertyPath.IndexOf("."); //while (delimiterIndex > propertyPath.IndexOf("[") && // delimiterIndex < propertyPath.IndexOf("]")) //{ // delimiterIndex = propertyPath.IndexOf(".", delimiterIndex + 1 ); //} if (delimiterIndex > propertyPath.IndexOf("[") && delimiterIndex < propertyPath.IndexOf("]")) { delimiterIndex = propertyPath.IndexOf(".", propertyPath.IndexOf("]")); } if (delimiterIndex > -1) { firstPart = propertyPath.Substring(0, delimiterIndex); restOfString = propertyPath.Substring(delimiterIndex + 1, (propertyPath.Length - (delimiterIndex + 1))); if (firstPart.Length == 0) { return(SetPropertyValue(dtsObject, restOfString, value)); } } } if (firstPart.ToUpper().StartsWith("PACKAGE")) { if (!(dtsObject is Package)) { throw new ArgumentException("The initial object must be of type Package.", "dtsObject"); } return(SetPropertyValue(dtsObject, restOfString, value)); } // \Package.Variables[User::TestVar].Properties[Value] if (firstPart.ToUpper().StartsWith("VARIABLES")) { if (!(dtsObject is DtsContainer)) { throw new ArgumentException("Object must be of type DtsContainer to reference variables.", "dtsObject"); } Variables vars = null; string varName = GetSubStringBetween(firstPart, "[", "]"); DtsContainer cont = (DtsContainer)dtsObject; cont.VariableDispenser.LockOneForRead(varName, ref vars); returnValue = SetPropertyValue(vars[varName], restOfString, value); vars.Unlock(); return(returnValue); } // \Package.Properties[CreationDate] if (firstPart.ToUpper().StartsWith("PROPERTIES")) { if (!(dtsObject is IDTSPropertiesProvider)) { throw new ArgumentException("Object must be of type IDTSPropertiesProvider to reference properties.", "dtsObject"); } IDTSPropertiesProvider propProv = (IDTSPropertiesProvider)dtsObject; string propIndex = GetSubStringBetween(firstPart, "[", "]"); DtsProperty prop = propProv.Properties[propIndex]; if (dtsObject is Variable && prop.Name == "Value") { Variable var = (Variable)dtsObject; prop.SetValue(dtsObject, Convert.ChangeType(value, var.DataType)); } else { prop.SetValue(dtsObject, Convert.ChangeType(value, propProv.Properties[propIndex].Type)); } //Flag value as changing changesvc.OnComponentChanging(prop, null); changesvc.OnComponentChanged(prop, null, null, null); //marks the package designer as dirty return(prop.GetValue(dtsObject)); } // \Package.Connections[localhost.AdventureWorksDW2008].Properties[Description] if (firstPart.ToUpper().StartsWith("CONNECTIONS")) { if (!(dtsObject is Package)) { throw new ArgumentException("Object must be of type Package to reference Connections.", "dtsObject"); } string connIndex = GetSubStringBetween(firstPart, "[", "]"); Package pkg = (Package)dtsObject; return(SetPropertyValue(pkg.Connections[connIndex], restOfString, value)); } // \Package.EventHandlers[OnError].Properties[Description] if (firstPart.ToUpper().StartsWith("EVENTHANDLERS")) { if (!(dtsObject is EventsProvider)) { throw new ArgumentException("Object must be of type EventsProvider to reference events.", "dtsObject"); } EventsProvider eventProvider = (EventsProvider)dtsObject; string eventIndex = GetSubStringBetween(firstPart, "[", "]"); return(SetPropertyValue(eventProvider.EventHandlers[eventIndex], restOfString, value)); } //First Part of string is not one of the hard-coded values - it's either a task or container if (!(dtsObject is IDTSSequence)) { throw new ArgumentException("Object must be of type IDTSSequence to reference other tasks or containers.", "dtsObject"); } IDTSSequence seq = (IDTSSequence)dtsObject; if (seq.Executables.Contains(firstPart)) { return(SetPropertyValue(seq.Executables[firstPart], restOfString, value)); } // \Package\Sequence Container\Script Task.Properties[Description] // \Package\Sequence Container.Properties[Description] // \Package\Execute SQL Task.Properties[Description] //\Package.EventHandlers[OnError].Variables[System::Cancel].Properties[Value] // \Package.EventHandlers[OnError]\Script Task.Properties[Description] if (restOfString.Length > 0) { returnValue = SetPropertyValue(dtsObject, restOfString, value); } return(returnValue); }
public EventListController(EventsProvider provider) { _provider = provider; }
/// <summary> /// A constructor that accepts a Microsoft.SqlServer.Dts.Runtime.EventsProvider object /// </summary> /// <param name="eventsProvider"></param> internal ISEventsProviderAsIDTSSequence(EventsProvider eventsProvider) : base(eventsProvider) { EventsProviderAsIDTSSequence = (IDTSSequence)eventsProvider; }
private void IterateContainers(DtsContainer parent, TreeNodeCollection nodes, string selectedContainerId) { TreeNode node = new TreeNode(); node.Name = parent.Name; node.Text = parent.Name; node.Tag = parent; SetNodeIcon(parent, node); nodes.Add(node); if (parent.ID == selectedContainerId) { node.TreeView.SelectedNode = node; } IDTSSequence seq = parent as IDTSSequence; if (seq != null) { foreach (Executable e in seq.Executables) { if (e is IDTSSequence || e is EventsProvider) { IterateContainers((DtsContainer)e, node.Nodes, selectedContainerId); } else { DtsContainer task = (DtsContainer)e; TreeNode childNode = new TreeNode(); childNode.Name = task.Name; childNode.Text = task.Name; childNode.Tag = task; SetNodeIcon(task, childNode); node.Nodes.Add(childNode); if (task.ID == selectedContainerId) { node.TreeView.SelectedNode = childNode; } } } } EventsProvider prov = parent as EventsProvider; if (prov != null) { foreach (DtsEventHandler p in prov.EventHandlers) { DtsContainer task = (DtsContainer)p; TreeNode childNode = new TreeNode(); childNode.Name = string.Format(CultureInfo.InvariantCulture, "{0} Event", p.Name); childNode.Text = string.Format(CultureInfo.InvariantCulture, "{0} Event", p.Name); childNode.Tag = task; SetNodeIcon(task, childNode); node.Nodes.Add(childNode); if (task.ID == selectedContainerId) { node.TreeView.SelectedNode = childNode; } } } return; }
public SearchController(EventsProvider provider) { _provider = provider; }
private object LocatePropertyValue(object project, DtsObject dtsObject, string propertyPath, PropertyOperation operation, object value) { propertyPath = propertyPath.Replace("\\", "."); object returnValue = null; string firstPart = propertyPath; string restOfString = string.Empty; if (propertyPath.Contains(".")) { // Can have periods in object names (like connection manager names) // Need to verify that period is not between an index marker int delimiterIndex = propertyPath.IndexOf(".", StringComparison.Ordinal); if (delimiterIndex > propertyPath.IndexOf("[", StringComparison.Ordinal) && delimiterIndex < propertyPath.IndexOf("]", StringComparison.Ordinal)) { delimiterIndex = propertyPath.IndexOf(".", propertyPath.IndexOf("]", StringComparison.Ordinal), StringComparison.Ordinal); } if (delimiterIndex > -1) { firstPart = propertyPath.Substring(0, delimiterIndex); restOfString = propertyPath.Substring(delimiterIndex + 1, propertyPath.Length - (delimiterIndex + 1)); if (firstPart.Length == 0) { return(LocatePropertyValue(project, dtsObject, restOfString, operation, value)); } } } //\Project\ConnectionManagers[localhost.AdventureWorks2012.conmgr].Properties[ConnectionString] //\Project\Properties[ProtectionLevel] if (firstPart.ToUpper().StartsWith("PROJECT")) { if (!(project is Project)) { throw new ArgumentException("The initial object must be of type Project.", "project"); } return(LocatePropertyValue(project, (DtsObject)project, restOfString, operation, value)); } //\Project\ConnectionManagers[localhost.AdventureWorks2012.conmgr].Properties[ConnectionString] if (firstPart.ToUpper().StartsWith("CONNECTIONMANAGERS")) { string connIndex = GetSubStringBetween(firstPart, "[", "]"); ConnectionManager cm = (((Project)project).ConnectionManagerItems[connIndex]).ConnectionManager; return(LocatePropertyValue(project, cm, restOfString, operation, value)); } if (firstPart.ToUpper().StartsWith("PACKAGE")) { if (!(dtsObject is Package)) { throw new ArgumentException("The initial object must be of type Package.", "dtsObject"); } return(LocatePropertyValue(project, dtsObject, restOfString, operation, value)); } if (firstPart.ToUpper().StartsWith("VARIABLES")) { if (!(dtsObject is DtsContainer)) { throw new ArgumentException("Object must be of type DtsContainer to reference variables.", "dtsObject"); } Variables vars = null; string varName = GetSubStringBetween(firstPart, "[", "]"); DtsContainer cont = (DtsContainer)dtsObject; cont.VariableDispenser.LockOneForRead(varName, ref vars); returnValue = LocatePropertyValue(project, vars[varName], restOfString, operation, value); vars.Unlock(); return(returnValue); } // \Package.Properties[CreationDate] if (firstPart.ToUpper().StartsWith("PROPERTIES")) { string propIndex = GetSubStringBetween(firstPart, "[", "]"); if (!(dtsObject is IDTSPropertiesProvider)) { if (!(dtsObject is Project)) { throw new ArgumentException("Object must be of type Project or IDTSPropertiesProvider to reference properties.", "dtsObject"); } else { if (operation == PropertyOperation.Set) { dtsObject.GetType().GetProperty(propIndex).SetValue(dtsObject, Convert.ChangeType(value, dtsObject.GetType())); } return(dtsObject.GetType().GetProperty(propIndex).GetValue(dtsObject, null)); } } IDTSPropertiesProvider propProv = (IDTSPropertiesProvider)dtsObject; DtsProperty prop = propProv.Properties[propIndex]; if (operation == PropertyOperation.Set) { if (dtsObject is Variable) { Variable var = (Variable)dtsObject; prop.SetValue(dtsObject, Convert.ChangeType(value, var.DataType)); } else { prop.SetValue(dtsObject, Convert.ChangeType(value, propProv.Properties[propIndex].Type)); } } return(prop.GetValue(dtsObject)); } // \Package.Connections[localhost.AdventureWorksDW2008].Properties[Description] if (firstPart.ToUpper().StartsWith("CONNECTIONS")) { if (!(dtsObject is Package)) { throw new ArgumentException("Object must be of type Package to reference Connections.", "dtsObject"); } string connIndex = GetSubStringBetween(firstPart, "[", "]"); Package pkg = (Package)dtsObject; return(LocatePropertyValue(project, pkg.Connections[connIndex], restOfString, operation, value)); } // \Package.EventHandlers[OnError].Properties[Description] if (firstPart.ToUpper().StartsWith("EVENTHANDLERS")) { if (!(dtsObject is EventsProvider)) { throw new ArgumentException("Object must be of type EventsProvider to reference events.", "dtsObject"); } EventsProvider eventProvider = (EventsProvider)dtsObject; string eventIndex = GetSubStringBetween(firstPart, "[", "]"); return(LocatePropertyValue(project, eventProvider.EventHandlers[eventIndex], restOfString, operation, value)); } // First Part of string is not one of the hard-coded values - it's either a task or container if (!(dtsObject is IDTSSequence)) { throw new ArgumentException("Object must be of type IDTSSequence to reference other tasks or containers.", "dtsObject"); } IDTSSequence seq = (IDTSSequence)dtsObject; if (seq.Executables.Contains(firstPart)) { return(LocatePropertyValue(project, seq.Executables[firstPart], restOfString, operation, value)); } // \Package\Sequence Container\Script Task.Properties[Description] // \Package\Sequence Container.Properties[Description] // \Package\Execute SQL Task.Properties[Description] // \Package.EventHandlers[OnError].Variables[System::Cancel].Properties[Value] // \Package.EventHandlers[OnError]\Script Task.Properties[Description] if (restOfString.Length > 0) { returnValue = LocatePropertyValue(project, dtsObject, restOfString, operation, value); } return(returnValue); }
public EventsListController(EventsProvider eventsProvider) { _eventsProvider = eventsProvider; }
/// <summary> /// Run preparation steps to initialization application /// </summary> /// <param name="eventsProvider"></param> /// <param name="dataStorageProvider"></param> /// <returns></returns> public static SituationalCentre Initialization() { Log.Debug("-------Запуск системы--------"); //1. Init XML DATA Storage IDataStorage storage = new XMLDataStorage(); if (storage.State != ComponentState.Ready) { Log.Error("Initialization(): Cannot init DataStorage."); storage.Dispose(); storage = null; return null; } //. Init Data Provider IDataStorageProvider dataStorageProvider = new DataStorageProvider(storage); if (dataStorageProvider.State != ComponentState.Ready) { Log.Error("Initialization(): Cannot init DataStorageProvider."); storage.Dispose(); storage = null; dataStorageProvider.Dispose(); dataStorageProvider = null; return null; } // return null; //2. create events device bool autoConnect = true; IEventsDevice eventsDevice = new DeviceModemGSM(autoConnect); //3. Init Events provider IEventsProvider eventsProvider = new EventsProvider(eventsDevice); //IDataStorageProvider dataStorageProvider = null; SituationalCentre sCentre = new SituationalCentre(eventsProvider, dataStorageProvider); return sCentre; /// <summary> /// Start up all other components /// </summary> //1. Init XML DATA Storage //IDataStorage storage = new XMLDataStorage(); //2. Init Data provider //3. Init Events provider // //4. SituationalCentre(IEventsProvider eventsProvider, IDataStorageProvider dataStorage) }
public void Setup() { var hub = new EventsProvider(); _fixture.Register <IEventsProvider>(() => hub); }
/// <summary> /// A constructor that accepts a Microsoft.SqlServer.Dts.Runtime.EventsProvider object /// </summary> /// <param name="eventsProvider"></param> internal ISEventsProvider(EventsProvider eventsProvider) : base((DtsContainer)eventsProvider) { EventsProvider = eventsProvider; }