Ejemplo n.º 1
0
 public UserControl GetVisualisationUserControl(IConfigurable configuration)
 {
     _antWarsViewModel = new AntWarsViewModel();
     _movementService = new MovementService(_antWarsViewModel);
     _botService = new BotService(_antWarsViewModel);
     return new AntWarsUserControl(_antWarsViewModel);
 }
        public EditAvailableConfigurationsDialog(IConfigurable configurable, bool editPlatforms)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            foreach (Control ctl in this.Controls) {
                ctl.Text = StringParser.Parse(ctl.Text);
            }

            this.configurable = configurable;
            this.editPlatforms = editPlatforms;
            if (editPlatforms) {
                if (configurable is ISolution)
                    this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditSolutionPlatforms}");
                else
                    this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditProjectPlatforms}");
                this.editedCollection = configurable.PlatformNames;
            } else {
                if (configurable is ISolution)
                    this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditSolutionConfigurations}");
                else
                    this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditProjectConfigurations}");
                this.editedCollection = configurable.ConfigurationNames;
            }
            InitList();
        }
Ejemplo n.º 3
0
        public ConfigurationWindow(NovaromaEngine engine, IExceptionHandler exceptionHandler, IDialogService dialogService) {
            InitializeComponent();

            _configurableEngine = engine;
            _engine = engine;
            _downloader = engine.Settings.Downloader.SelectedItem as IConfigurable;
            _exceptionHandler = exceptionHandler;
            _dialogService = dialogService;
            _initialMovieDir = engine.MovieDirectory;
            _initialTvShowDir = engine.TvShowDirectory;

            _engineSettings = engine.Settings;

            var utor = _downloader as UTorrentDownloader;
            if (utor != null && utor.IsAvailable) {
                _torrentSettings = utor.Settings;
                TorrentHowToHyperink.NavigateUri = new Uri(Properties.Resources.Url_HowToConfigureUtorrentWebUISettings);
            }
            else {
                var trantor = _downloader as TransmissionDownloader;
                if (trantor != null) {
                    _torrentSettings = trantor.Settings;
                    TorrentHowToHyperink.NavigateUri = new Uri(Properties.Resources.Url_HowToConfigureTransmissionWebUISettings);
                }
            }
            if (_torrentSettings == null)
                TorrentSettingsExpander.Visibility = Visibility.Collapsed;
            else if (_downloader != null)
                TorrentSettingsExpander.Tag = string.Format(Properties.Resources.TorrentWebUISettings, _downloader.SettingName);

            DataContext = this;

            Closing += OnClosing;
        }
 public PreprocessorComponentForm(IConfigurable iComponent)
 {
     if (iComponent == null) throw new ArgumentNullException();
     _configuredComponent = iComponent;
     InitializeComponent();
     preprocessorsComboBox.Items.AddRange((_configuredComponent.GetValueForKey("preprocessorsList") as object[]));
     inputsCountTextBox.Text = _configuredComponent.GetValueForKey("defaultInputsCount") as string;
 }
Ejemplo n.º 5
0
        public SettingsViewModel(INovaromaEngine engine, IDialogService dialogService, IConfigurable configurable): base(dialogService) {
            _engine = engine;
            _configurable = configurable;
            _settings = configurable.Settings;
            _initialValues = configurable.SerializeSettings();

            _editServiceSettingsCommand = new RelayCommand(EditServiceSettings);
        }
 public BSModelBuilderComponentForm(IConfigurable iConfiguredComponent)
     : base()
 {
     if (iConfiguredComponent == null) throw new ArgumentNullException();
     _configuredComponent = iConfiguredComponent;
     InitializeComponent();
     modelsListComboBox.Items.AddRange((_configuredComponent.GetValueForKey("modelsList") as object[]));
     inputsCountTextBox.Text = _configuredComponent.GetValueForKey("defaultInputsCount") as string;
 }
Ejemplo n.º 7
0
        public UserControl GetVisualization(IConfigurable configuration)
        {
            if (Bots != null)
            {
                _tournamentLadderViewModel = new TournamentLadderViewModel(Bots);
                return new TournamentLadderControl(_tournamentLadderViewModel);
            }

            return null;
        }
Ejemplo n.º 8
0
        internal IEnumerable <T> GetObjects <T>(ObjectId rootId, IConfigDataProvider session, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) where T : IConfigurable, new()
        {
            if (!(session is ContentFilterPhraseDataProvider))
            {
                throw new ArgumentException(Strings.ErrorInvalidType((session != null) ? session.GetType().Name : "null"), "session");
            }
            notFoundReason = null;
            IConfigurable configurable = session.Read <T>(new ContentFilterPhraseIdentity(this.phrase));

            T[] result;
            if (configurable != null)
            {
                result = new T[]
                {
                    (T)((object)configurable)
                };
            }
            else
            {
                result = new T[0];
            }
            return(result);
        }
Ejemplo n.º 9
0
        public Object GetDelegate(DelegationImpl delegationImpl)
        {
            Object       delegateClass = null;
            IClassLoader classLoader   = null;

            try
            {
                classLoader   = (IClassLoader)ServiceLocator.Instance.GetService(typeof(IClassLoader));
                delegateClass = classLoader.CreateObject(delegationImpl);
            }
            finally
            {
                ServiceLocator.Instance.Release(classLoader);
            }
            // configure class
            if (delegateClass is IConfigurable)
            {
                IConfigurable configurable = (IConfigurable)delegateClass;
                IDictionary   parameters   = ParseConfiguration(delegationImpl);
                configurable.SetConfiguration(parameters);
            }
            return(delegateClass);
        }
Ejemplo n.º 10
0
        private void OnNewConnection(Control control1, Point p1, Control control2, Point p2)
        {
            Cursor = Cursors.Default;
            foreach (var c in Controls.OfType <Control>())
            {
                c.Cursor = Cursor;
            }
            IConfigurable ws1 = control1 as IConfigurable;
            IConfigurable ws2 = control2 as IConfigurable;

            if (ws1 == null || ws2 == null)
            {
                return;
            }
            int port1 = ws1.GetPortIDByPoint(p1);
            int port2 = ws2.GetPortIDByPoint(p2);

            if (port1 < 0 || port2 < 0)
            {
                return;
            }
            NewConnectionCreated?.Invoke((Control)ws1, port1, (Control)ws2, port2);
        }
Ejemplo n.º 11
0
        protected override bool ShouldSkipObject(IConfigurable dataObject)
        {
            if (dataObject is PagedPositionInfo)
            {
                return(false);
            }
            RecipientType        recipientType;
            RecipientTypeDetails recipientTypeDetails;

            if (dataObject is ReducedRecipient)
            {
                ReducedRecipient reducedRecipient = dataObject as ReducedRecipient;
                recipientType        = reducedRecipient.RecipientType;
                recipientTypeDetails = reducedRecipient.RecipientTypeDetails;
            }
            else
            {
                ADRecipient adrecipient = dataObject as ADRecipient;
                recipientType        = adrecipient.RecipientType;
                recipientTypeDetails = adrecipient.RecipientTypeDetails;
            }
            return(Array.IndexOf <RecipientType>(this.RecipientTypes, recipientType) == -1 || (this.InternalRecipientTypeDetails != null && this.InternalRecipientTypeDetails.Length > 0 && Array.IndexOf <RecipientTypeDetails>(this.InternalRecipientTypeDetails, recipientTypeDetails) == -1));
        }
Ejemplo n.º 12
0
        public void Save(IConfigurable instance, bool keepUnmanagedResources)
        {
            this.DisposeCheck();
            MapiObject mapiObject = instance as MapiObject;

            if (mapiObject == null)
            {
                throw new ArgumentException("instance");
            }
            if (mapiObject.MapiSession == null)
            {
                mapiObject.MapiSession = this;
            }
            ValidationError[] array = mapiObject.Validate();
            if (array != null && 0 < array.Length)
            {
                throw new DataValidationException(array[0]);
            }
            this.InvokeWithWrappedException(delegate()
            {
                mapiObject.Save(keepUnmanagedResources);
            }, (instance.ObjectState == ObjectState.New) ? Strings.ExceptionNewObject((instance.Identity == null) ? Strings.ConstantNull : instance.Identity.ToString()) : Strings.ExceptionSaveObject((instance.Identity == null) ? Strings.ConstantNull : instance.Identity.ToString()), null);
        }
Ejemplo n.º 13
0
        protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
        {
            if (dataObject == null)
            {
                return(null);
            }
            ADContact       dataObject2     = (ADContact)dataObject;
            SyncMailContact syncMailContact = new SyncMailContact(dataObject2);

            syncMailContact.propertyBag.SetField(ADRecipientSchema.AcceptMessagesOnlyFrom, SyncTaskHelper.RetrieveFullADObjectId(base.TenantGlobalCatalogSession, syncMailContact.AcceptMessagesOnlyFrom));
            syncMailContact.propertyBag.SetField(ADRecipientSchema.AcceptMessagesOnlyFromDLMembers, SyncTaskHelper.RetrieveFullADObjectId(base.TenantGlobalCatalogSession, syncMailContact.AcceptMessagesOnlyFromDLMembers));
            syncMailContact.propertyBag.SetField(ADRecipientSchema.RejectMessagesFrom, SyncTaskHelper.RetrieveFullADObjectId(base.TenantGlobalCatalogSession, syncMailContact.RejectMessagesFrom));
            syncMailContact.propertyBag.SetField(ADRecipientSchema.RejectMessagesFromDLMembers, SyncTaskHelper.RetrieveFullADObjectId(base.TenantGlobalCatalogSession, syncMailContact.RejectMessagesFromDLMembers));
            if (this.outputCookie != null)
            {
                syncMailContact.propertyBag.SetField(SyncMailContactSchema.Cookie, this.outputCookie.ToBytes());
                if (this.outputCookie.HighWatermark == 0L)
                {
                    syncMailContact.propertyBag.SetField(SyncMailContactSchema.EndOfList, true);
                }
            }
            return(syncMailContact);
        }
Ejemplo n.º 14
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter(new object[]
            {
                dataObject.Identity
            });
            TenantRelocationRequest tenantRelocationRequest = (TenantRelocationRequest)dataObject;

            if (!this.SourceStateOnly)
            {
                if (tenantRelocationRequest.TargetForest != null)
                {
                    this.targetForestRIDMaster = ForestTenantRelocationsCache.GetRidMasterName(new PartitionId(tenantRelocationRequest.TargetForest));
                }
                Exception ex;
                TenantRelocationRequest.PopulatePresentationObject(tenantRelocationRequest, this.targetForestRIDMaster, out ex);
                if (ex != null)
                {
                    if (ex is CannotFindTargetTenantException)
                    {
                        base.WriteWarning(ex.Message);
                    }
                    else
                    {
                        base.WriteError(ex, ErrorCategory.InvalidOperation, tenantRelocationRequest.Identity);
                    }
                }
                GetTenantRelocationRequest.PopulateGlsProperty(tenantRelocationRequest, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                GetTenantRelocationRequest.PopulateRidMasterProperties(tenantRelocationRequest, this.sourceForestRIDMaster, this.targetForestRIDMaster, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                if (tenantRelocationRequest.OriginatingServer != this.sourceForestRIDMaster)
                {
                    this.warning = Strings.WarningShouldReadFromRidMaster(tenantRelocationRequest.OriginatingServer, this.sourceForestRIDMaster);
                }
            }
            base.WriteResult(tenantRelocationRequest);
            TaskLogger.LogExit();
        }
            public override void Save(IConfigurable instance)
            {
                AdminAuditLogSearch adminAuditLogSearch  = (AdminAuditLogSearch)instance;
                AdminAuditLogSearch adminAuditLogSearch2 = new AdminAuditLogSearch();

                adminAuditLogSearch2.Identity             = (AuditLogSearchId)adminAuditLogSearch.Identity;
                adminAuditLogSearch2.Name                 = adminAuditLogSearch.Name;
                adminAuditLogSearch2.StartDateUtc         = new DateTime?(adminAuditLogSearch.StartDateUtc.Value);
                adminAuditLogSearch2.EndDateUtc           = new DateTime?(adminAuditLogSearch.EndDateUtc.Value);
                adminAuditLogSearch2.StatusMailRecipients = NewAuditLogSearchBase <AdminAuditLogSearch> .GetMultiValuedSmptAddressAsStrings(adminAuditLogSearch.StatusMailRecipients);

                adminAuditLogSearch2.CreatedBy   = adminAuditLogSearch.CreatedBy;
                adminAuditLogSearch2.CreatedByEx = adminAuditLogSearch.CreatedByEx;
                adminAuditLogSearch2.Cmdlets     = adminAuditLogSearch.Cmdlets;
                adminAuditLogSearch2.Parameters  = adminAuditLogSearch.Parameters;
                adminAuditLogSearch2.ObjectIds   = adminAuditLogSearch.ObjectIds;
                if (adminAuditLogSearch.ExternalAccess != null)
                {
                    adminAuditLogSearch2.ExternalAccess = (adminAuditLogSearch.ExternalAccess.Value ? bool.TrueString : bool.FalseString);
                }
                adminAuditLogSearch2.UserIds                = adminAuditLogSearch.UserIds;
                adminAuditLogSearch2.ResolvedUsers          = adminAuditLogSearch.ResolvedUsers;
                adminAuditLogSearch2.RedactDatacenterAdmins = adminAuditLogSearch.RedactDatacenterAdmins;
                base.Save(adminAuditLogSearch2);
                AuditQueuesOpticsLogData auditQueuesOpticsLogData = new AuditQueuesOpticsLogData
                {
                    QueueType      = AuditQueueType.AsyncAdminSearch,
                    EventType      = QueueEventType.Queue,
                    CorrelationId  = adminAuditLogSearch2.Identity.Guid.ToString(),
                    OrganizationId = this.organizationId,
                    QueueLength    = ((this.defaultFolder != null) ? (this.defaultFolder.TotalCount + 1) : 1)
                };

                auditQueuesOpticsLogData.Log();
                instance.ResetChangeTracking();
            }
Ejemplo n.º 16
0
        private static void SaveConfig(Type type, IConfigurable configurable)
        {
            var configPath = $"Config\\{type.Name}.xml";

            Log.Config.Trace($"Saving config file: {configPath}");

            try
            {
                // Serialize config
                var document = new XDocument();
                {
                    var rootElement = new XElement(type.Name);
                    configurable.Serialize(rootElement);
                    document.Add(rootElement);
                }

                document.Save(configPath);
            }
            catch (Exception e)
            {
                Log.Config.Error($"Failed to save config file: {configPath}");
                Log.Config.Trace(e.Message);
            }
        }
Ejemplo n.º 17
0
        private static void LoadConfig(Type type, IConfigurable configurable)
        {
            // Deserialize config
            var configPath = $"Config\\{type.Name}.xml";

            if (File.Exists(configPath))
            {
                Log.Config.Trace($"Loading config file: {configPath}");

                try
                {
                    var document = XDocument.Load(configPath);
                    if (document.Root != null)
                    {
                        configurable.Deserialize(document.Root);
                    }
                }
                catch (Exception e)
                {
                    Log.Config.Error($"Failed to load config file: {configPath}");
                    Log.Config.Trace(e.Message);
                }
            }
        }
Ejemplo n.º 18
0
        protected override void StampChangesOn(IConfigurable dataObject)
        {
            TaskLogger.LogEnter();
            PimSubscriptionProxy pimSubscriptionProxy = (PimSubscriptionProxy)dataObject;

            if (base.Fields.IsModified("DisplayName"))
            {
                pimSubscriptionProxy.DisplayName = this.DisplayName;
            }
            SubscriptionStateTransitionHelper subscriptionStateTransitionHelper = new SubscriptionStateTransitionHelper(pimSubscriptionProxy.Subscription);

            if (this.DisableAsPoison)
            {
                subscriptionStateTransitionHelper.DisableAsPoisonous();
            }
            else if (this.EnablePoisonSubscription)
            {
                if (this.Enabled)
                {
                    subscriptionStateTransitionHelper.EnableFromPoison();
                }
                else
                {
                    subscriptionStateTransitionHelper.Disable();
                }
            }
            else if (this.Enabled)
            {
                subscriptionStateTransitionHelper.Enable();
            }
            else
            {
                subscriptionStateTransitionHelper.Disable();
            }
            TaskLogger.LogExit();
        }
Ejemplo n.º 19
0
        internal static MultiValuedProperty <ADObjectId> ValidateVirtualDirectory(IConfigDataProvider session, VirtualDirectoryIdParameter[] virtualDirectories, OfflineAddressBookTaskUtility.GetUniqueObject getOabVirtualDirectory, OfflineAddressBook target, Task.TaskErrorLoggingDelegate writeError)
        {
            MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>(false, OfflineAddressBookSchema.VirtualDirectories, new object[0]);

            foreach (VirtualDirectoryIdParameter virtualDirectoryIdParameter in virtualDirectories)
            {
                if (virtualDirectoryIdParameter != null)
                {
                    IConfigurable configurable = getOabVirtualDirectory(virtualDirectoryIdParameter, session, null, new LocalizedString?(Strings.OabVirtualDirectoryNotExisting(virtualDirectoryIdParameter.ToString())), new LocalizedString?(Strings.OabVirtualDirectoryAmbiguous(virtualDirectoryIdParameter.ToString())));
                    if (configurable != null)
                    {
                        if (multiValuedProperty.Contains((ADObjectId)configurable.Identity))
                        {
                            writeError(new InvalidOperationException(Strings.ErrorOabVDirAlreadyAssigned((target.Identity != null) ? target.Identity.ToString() : target.Name, configurable.Identity.ToString())), ErrorCategory.InvalidOperation, target.Identity);
                        }
                        else
                        {
                            multiValuedProperty.Add((ADObjectId)configurable.Identity);
                        }
                    }
                }
            }
            return(multiValuedProperty);
        }
Ejemplo n.º 20
0
        protected override void WriteResult()
        {
            TaskLogger.LogEnter(new object[]
            {
                this.DataObject.Identity
            });
            base.WriteVerbose(TaskVerboseStringHelper.GetReadObjectVerboseString(this.DataObject.Identity, base.DataSession, typeof(TransactionalRequestJob)));
            IConfigurable configurable = null;

            try
            {
                try
                {
                    configurable = base.DataSession.Read <TransactionalRequestJob>(this.DataObject.Identity);
                }
                finally
                {
                    base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession));
                }
                if (configurable == null)
                {
                    base.WriteError(new ManagementObjectNotFoundException(base.GetErrorMessageObjectNotFound(this.DataObject.Identity.ToString(), typeof(TRequest).ToString(), (base.DataSession != null) ? base.DataSession.Source : null)), (ErrorCategory)1003, this.DataObject.Identity);
                }
                this.WriteResult(configurable);
            }
            finally
            {
                IDisposable disposable = configurable as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                    configurable = null;
                }
            }
            TaskLogger.LogExit();
        }
Ejemplo n.º 21
0
        protected IConfigurable GetDataObject <TObject>(IIdentityParameter id, IConfigDataProvider session, ObjectId rootID, OptionalIdentityData optionalData, LocalizedString notFoundError, LocalizedString multipleFoundError) where TObject : IConfigurable, new()
        {
            IConfigurable         result          = null;
            LocalizedString?      localizedString = null;
            IEnumerable <TObject> objects         = id.GetObjects <TObject>(rootID, session, optionalData, out localizedString);

            using (IEnumerator <TObject> enumerator = objects.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    result = enumerator.Current;
                    if (enumerator.MoveNext())
                    {
                        Exception innerException = new ManagementObjectAmbiguousException(multipleFoundError);
                        base.WriteError(new TaskInvalidOperationException(multipleFoundError, innerException), ExchangeErrorCategory.Client, this.Identity);
                    }
                }
                else
                {
                    LocalizedString message;
                    if (localizedString != null)
                    {
                        string          notFound         = notFoundError;
                        LocalizedString?localizedString2 = localizedString;
                        message = Strings.ErrorNotFoundWithReason(notFound, (localizedString2 != null) ? localizedString2.GetValueOrDefault() : null);
                    }
                    else
                    {
                        message = notFoundError;
                    }
                    Exception innerException = new ManagementObjectNotFoundException(message);
                    base.WriteError(new TaskInvalidOperationException(notFoundError, innerException), ExchangeErrorCategory.Client, this.Identity);
                }
            }
            return(result);
        }
Ejemplo n.º 22
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            ReceiveConnector receiveConnector = dataObject as ReceiveConnector;

            if (receiveConnector != null && !receiveConnector.IsReadOnly)
            {
                Server permissionGroupsBasedOnSecurityDescriptor = (Server)base.GetDataObject <Server>(new ServerIdParameter(receiveConnector.Server), base.DataSession, this.RootId, new LocalizedString?(Strings.ErrorServerNotFound(receiveConnector.Server.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(receiveConnector.Server.ToString())));
                if (base.HasErrors)
                {
                    return;
                }
                try
                {
                    receiveConnector.SetPermissionGroupsBasedOnSecurityDescriptor(permissionGroupsBasedOnSecurityDescriptor);
                }
                catch (LocalizedException exception)
                {
                    base.WriteError(exception, ErrorCategory.InvalidOperation, dataObject);
                    return;
                }
                receiveConnector.ResetChangeTracking();
            }
            base.WriteResult(dataObject);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Get information about an object.
        /// </summary>
        /// <param name="forInstance"></param>
        /// <param name="instance"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        private bool GetObjectInformation(Guid forInstance, out IUserObject instance, out IConfigurationDescription description)
        {
            description = null;
            instance    = GetInstance(forInstance);
            if (instance == null)
            {
                this.Log().Warn("Requested configuration for non-existant object '{0}'", forInstance);
                return(false);
            }
            IConfigurable configurable = instance as IConfigurable;

            if (configurable == null)
            {
                this.Log().Warn("Requested configuration for unconfigurable object '{0}' (Class {1}.{2})", forInstance, instance.GetType().Namespace, instance.GetType().Name);
                return(false);
            }
            description = GetConfigurationDescription(forInstance);
            if (description == null)
            {
                this.Log().Warn("No configuration description for object '{0}' (Class {1}.{2})", forInstance, instance.GetType().Namespace, instance.GetType().Name);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 24
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter();
            ADUser     aduser = (ADUser)dataObject;
            ADObjectId owaMailboxPolicy;

            if (aduser.OwaMailboxPolicy != null && OwaSegmentationSettings.UpdateOwaMailboxPolicy(aduser.OrganizationId, aduser.OwaMailboxPolicy, out owaMailboxPolicy))
            {
                aduser.OwaMailboxPolicy = owaMailboxPolicy;
            }
            if (this.RecalculateHasActiveSyncDevicePartnership == true)
            {
                IConfigurationSession configurationSession = this.GetConfigurationSession();
                MobileDevice[]        array = configurationSession.Find <MobileDevice>(aduser.ObjectId, QueryScope.SubTree, null, null, 0);
                bool flag = array.Length > 0;
                if (flag != aduser.HasActiveSyncDevicePartnership)
                {
                    aduser.HasActiveSyncDevicePartnership = flag;
                    IRecipientSession recipientSession = (IRecipientSession)this.CreateSession();
                    recipientSession.Save(aduser);
                }
            }
            base.WriteResult(aduser);
        }
Ejemplo n.º 25
0
        public void Save(IConfigurable instance)
        {
            PimSubscriptionProxy pimSubscriptionProxy = instance as PimSubscriptionProxy;

            switch (pimSubscriptionProxy.ObjectState)
            {
            case ObjectState.New:
                this.NewAggregationSubscription(pimSubscriptionProxy);
                return;

            case ObjectState.Unchanged:
                return;

            case ObjectState.Changed:
                this.UpdateAggregationSubscription(pimSubscriptionProxy);
                return;

            case ObjectState.Deleted:
                throw new InvalidOperationException("Calling Save() on a deleted object is not permitted. Delete() should be used instead.");

            default:
                return;
            }
        }
Ejemplo n.º 26
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter(new object[]
            {
                dataObject.Identity,
                dataObject
            });
            MailboxServer mailboxServer = new MailboxServer((Server)dataObject);
            string        fqdn          = ((Server)dataObject).Fqdn;

            if (this.Status && ((Server)dataObject).IsProvisionedServer)
            {
                this.WriteWarning(Strings.StatusSpecifiedForProvisionedServer);
            }
            if (this.Status && !mailboxServer.IsReadOnly && !((Server)dataObject).IsProvisionedServer)
            {
                if (string.IsNullOrEmpty(fqdn))
                {
                    this.WriteWarning(Strings.ErrorInvalidObjectMissingCriticalProperty(typeof(Server).Name, mailboxServer.Identity.ToString(), ServerSchema.Fqdn.Name));
                }
                else
                {
                    Exception     ex = null;
                    CultureInfo[] array;
                    GetMailboxServer.GetConfigurationFromRegistry(fqdn, out array, out ex);
                    if (ex != null)
                    {
                        this.WriteWarning(Strings.ErrorAccessingRegistryRaisesException(fqdn, ex.Message));
                    }
                    mailboxServer.Locale = array;
                    mailboxServer.ResetChangeTracking();
                }
            }
            base.WriteResult(mailboxServer);
            TaskLogger.LogExit();
        }
Ejemplo n.º 27
0
        protected override IConfigurable ResolveDataObject()
        {
            if (this.Identity == null)
            {
                IConfigurable[] array = null;
                try
                {
                    array = base.DataSession.Find <ActiveSyncOrganizationSettings>(null, this.RootId, false, null);
                }
                catch (DataSourceTransientException exception)
                {
                    base.WriteError(exception, (ErrorCategory)1002, null);
                }
                if (array == null)
                {
                    array = new IConfigurable[0];
                }
                IConfigurable result = null;
                switch (array.Length)
                {
                case 0:
                    base.WriteError(new ManagementObjectNotFoundException(base.GetErrorMessageObjectNotFound(null, typeof(ActiveSyncOrganizationSettings).ToString(), (base.DataSession != null) ? base.DataSession.Source : null)), (ErrorCategory)1003, null);
                    break;

                case 1:
                    result = array[0];
                    break;

                default:
                    base.WriteError(new ManagementObjectAmbiguousException(Strings.ActiveSyncOrganizationSettingsAmbiguous), (ErrorCategory)1003, null);
                    break;
                }
                return(result);
            }
            return(base.ResolveDataObject());
        }
Ejemplo n.º 28
0
        protected override void StampChangesOnXsoObject(IConfigurable dataObject)
        {
            base.StampChangesOnXsoObject(dataObject);
            MailboxMessageConfiguration mailboxMessageConfiguration = (MailboxMessageConfiguration)dataObject;

            if (mailboxMessageConfiguration.IsModified(MailboxMessageConfigurationSchema.SignatureHtml))
            {
                mailboxMessageConfiguration.SignatureHtml = TextConverterHelper.SanitizeHtml(mailboxMessageConfiguration.SignatureHtml);
                if (!mailboxMessageConfiguration.IsModified(MailboxMessageConfigurationSchema.SignatureText))
                {
                    mailboxMessageConfiguration.SignatureText = TextConverterHelper.HtmlToText(mailboxMessageConfiguration.SignatureHtml, true);
                }
            }
            else if (mailboxMessageConfiguration.IsModified(MailboxMessageConfigurationSchema.SignatureText))
            {
                mailboxMessageConfiguration.SignatureHtml = TextConverterHelper.TextToHtml(mailboxMessageConfiguration.SignatureText);
            }
            if (SyncUtilities.IsDatacenterMode() && mailboxMessageConfiguration.IsModified(MailboxMessageConfigurationSchema.SendAddressDefault))
            {
                SendAsDefaultsManager sendAsDefaultsManager = new SendAsDefaultsManager();
                sendAsDefaultsManager.SaveSettingForOutlook(mailboxMessageConfiguration.SendAddressDefault, this.mailboxSession);
            }
            this.mailboxSession = null;
        }
Ejemplo n.º 29
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            InterceptorRule      interceptorRule      = dataObject as InterceptorRule;
            InterceptorAgentRule interceptorAgentRule = null;

            try
            {
                interceptorAgentRule = InterceptorAgentRule.CreateRuleFromXml(interceptorRule.Xml);
            }
            catch (InvalidOperationException exception)
            {
                base.WriteError(exception, ErrorCategory.InvalidOperation, this.Identity);
                TaskLogger.LogExit();
                return;
            }
            catch (FormatException exception2)
            {
                base.WriteError(exception2, ErrorCategory.InvalidOperation, this.Identity);
                TaskLogger.LogExit();
                return;
            }
            interceptorAgentRule.SetPropertiesFromAdObjet(interceptorRule);
            base.WriteResult(interceptorAgentRule);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FileWatchHandler" /> class.
 /// </summary>
 /// <param name="repository">The repository to configure.</param>
 /// <param name="configFile">The configuration file to watch.</param>
 /// <remarks>
 /// <para>
 /// Initializes a new instance of the <see cref="FileWatchHandler" /> class.
 /// </para>
 /// </remarks>
 public FileWatchHandler(IConfigurable repository, FileInfo configFile)
 {
     _repository = repository;
     _configFileInfo = configFile;
 }
Ejemplo n.º 31
0
 internal PluginConfiuration(string name, IConfigurable config)
 {
     this.name   = name;
     this.config = config;
     ForceLoad();
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Gets the <see cref="MemoryAllocator"/> assigned to 'source'.
 /// </summary>
 /// <param name="source">The source image.</param>
 /// <returns>Returns the configuration.</returns>
 internal static MemoryAllocator GetMemoryAllocator(this IConfigurable source)
 => GetConfiguration(source).MemoryAllocator;
Ejemplo n.º 33
0
        private void HandleObject(IPAddress senderIPAddress, IConfigurable theObject)
        {
            if (theObject is GameMessage)
            {
                lock (ChatLock)
                {
                    var gameMessage = (GameMessage)theObject;
                    ChatText.AppendLine(gameMessage.Content);
                    if (IsHost)
                    {
                        _host.SendObjectTCP(gameMessage);
                    }
                }
                NewChatMessage = true;
                return;
            }

            if (theObject is PlayerList)
            {
                lock (PlayerListLock)
                {
                    PlayerList = (PlayerList)theObject;
                }
                NewPlayerListUpdate = true;
                return;
            }

            if (theObject is NetworkMessage)
            {
                ReceiveNetworkMessage(senderIPAddress, (NetworkMessage)theObject);
                return;
            }

            if (theObject is Player)
            {
                var thePlayer = (Player)theObject;
                string name = thePlayer.Name;
                foreach (var item in _clientAddressesAndMonikers)
                {
                    if (item.Value[NAME].Equals(name))
                    {
                        PlayerManager.Players[(int)item.Value[ID]] = thePlayer;
                        thePlayer.ShipSprite = SpriteManager.GetShipSprite(thePlayer.ShipSize, thePlayer.ShipStyle, Random);
                        return;
                    }
                }
                return;
            }

            if (theObject is Ship)
            {
                Ship ship = (Ship)theObject;
                int ownerID = (int)_clientAddressesAndMonikers[senderIPAddress][ID];
                Player player = PlayerManager.Players[ownerID];
                player.ClientIsDead = ship.IsDead;
                player.IsDead = ship.IsDead;
                player.Energy = ship.Energy;
                player.PositionX = ship.PositionX;
                player.PositionY = ship.PositionY;
                player.VelocityX = ship.VelocityX;
                player.VelocityY = ship.VelocityY;
                player.Angle     = ship.Angle;
            }

            if (theObject is ShipList)
            {
                var ships = ((ShipList)theObject).Ships;
                var thePlayers = PlayerManager.Players;
                while (thePlayers.Count < ships.Count)
                {
                    thePlayers.Add(new Player(1, 1, Color.Red));
                }
                for (int j = 0; j < ships.Count; ++j)
                {
                    var theShip = ships[j];
                    thePlayers[j].Name = theShip.OwnerName;
                    thePlayers[j].IsDead = theShip.IsDead;
                    thePlayers[j].ClientIsDead = theShip.IsDead;
                }
                return;
            }

            if (theObject is AsteroidsList)
            {
                AsteroidManager.Asteroids = ((AsteroidsList)theObject).Asteroids;
            }

            if (theObject is CombatData)
            {
                var combatData = (CombatData)theObject;
                for (int i = 0; i < combatData.ShipList.Ships.Count; i++)
                {
                    if (i != MainPlayerID || combatData.OverrideClient)
                    {
                        var player = PlayerManager.Players[i];
                        var ship = combatData.ShipList.Ships[i];
                        player.IsDead = ship.IsDead;
                        player.Energy = ship.Energy;
                        player.ClientIsDead = ship.IsDead;
                        player.PositionX = ship.PositionX;
                        player.PositionY = ship.PositionY;
                        player.VelocityX = ship.VelocityX;
                        player.VelocityY = ship.VelocityY;
                        player.Angle = ship.Angle;
                    }
                }
                ObjectManager.Bullets = combatData.Bullets;
                ObjectManager.Shockwaves = combatData.Shockwaves;
                LevelSize = combatData.LevelSize;
                return;
            }

            if (theObject is PlayerFired)
            {
                if (_host == null) //Clients don't care about this
                {
                    return;
                }
                var playerFired = (PlayerFired)theObject;
                var player = PlayerManager.Players[playerFired.PlayerID];
                //Make sure to update player to correct position and angle
                player.Angle = playerFired.Angle;
                player.PositionX = playerFired.PositionX;
                player.PositionY = playerFired.PositionY;
                player.VelocityX = playerFired.VelocityX;
                player.VelocityY = playerFired.VelocityY;
                player.Energy = playerFired.Energy;
                ObjectManager.AddBullet(player);
                return;
            }
        }
Ejemplo n.º 34
0
 public UserControl GetVisualization(IConfigurable configuration)
 {
     _viewModel = new RoundRobinViewModel(Bots);
     return new RoundRobinUserControl(_viewModel);
 }
Ejemplo n.º 35
0
 public UserControl GetVisualisationUserControl(IConfigurable configuration)
 {
     _configuration = configuration;
     TicTacToeViewModel = new TicTacToeViewModel();
     return new TicTacToeUserControl(TicTacToeViewModel);
 }
Ejemplo n.º 36
0
 private void SendObjectTcpToClient(IConfigurable obj, TcpClient client)
 {
     NetworkStream stream = client.GetStream();
     string data = _objectStringConverter.ObjectToString(obj);
     byte[] bytes = System.Text.Encoding.ASCII.GetBytes(data);
     stream.BeginWrite(bytes, 0, bytes.Length, OnTcpDataSent, client);
 }
Ejemplo n.º 37
0
 public ConfigNode BuildChildForHost(IConfigurable host)
 {
     ConfigNode cn = new ConfigNode(this);
     cn.AttatchToHost(host);
     return cn;
 }
Ejemplo n.º 38
0
 public ConfigNode BuildSiblingForHost(IConfigurable host)
 {
     ConfigNode cn = new ConfigNode(_parentNode);
     cn.AttatchToHost(host);
     return cn;
 }
Ejemplo n.º 39
0
 internal static void EditSettings(INovaromaEngine engine, IDialogService dialogService, IConfigurable configurable, Window ownerWindow = null) {
     var settingsViewModel = new SettingsViewModel(engine, dialogService, configurable);
     var settingsWindow = new SettingsWindow(settingsViewModel);
     settingsWindow.Owner = ownerWindow;
     settingsWindow.ShowDialog();
 }
Ejemplo n.º 40
0
        public static bool Load(IConfigurable target, string iniFile)
        {
            Debug.WriteLine("Loading configuration file " + iniFile);
            // Reset to default
            target.ResetParameters();
            try
            {
                // Load custom settings from INI file
                using (var ini = new IniReader(iniFile, true))
                {
                    ini.AddHandler((x) =>
                    {
                        if (target.AcceptsConfigs.Any(y => y == x.Group))
                        {
                            target.ApplyParameter(x);
                        }

                    });
                    ini.Parse();
                }
                return true;
            }
            catch
            {
                Debug.WriteLine("Failed to load configuration from " + iniFile);
            }
            return false;
            // DONE :)
        }
 public BSSaveDataComponentForm(IConfigurable iComponent)
 {
     component = iComponent;
     InitializeComponent();
 }
Ejemplo n.º 42
0
 public void LoadConfig(IConfigSetting x, IConfigurable c)
 {
     c.LoadConfig(x);
 }
Ejemplo n.º 43
0
 public static void AttachRootNodeToHost(IConfigurable host)
 {
     ConfigNode cn = new ConfigNode();
     cn.AttatchToHost(host);
 }
Ejemplo n.º 44
0
 public void SendObjectTcp(IConfigurable obj, bool tryAgainOnFailure = true)
 {
     string data = _objectStringConverter.ObjectToString(obj);
     byte[] bytes = System.Text.Encoding.ASCII.GetBytes(data);
     NetworkStream stream = _tcpClient.GetStream();
     try
     {
         stream.BeginWrite(bytes, 0, bytes.Length, OnTcpDataSent, _tcpClient);
     }
     catch (IOException exception)
     {
         if (tryAgainOnFailure)
         {
             ResetTcpClient();
             SendObjectTcp(obj, false);
             return;
         }
         SocketException innerException = exception.InnerException as SocketException;
         if (innerException != null && innerException.SocketErrorCode == SocketError.ConnectionReset)
         {
             MessageBox.Show("Your connection with the host computer appears to have been reset. " +
                 "An attempt was made to fix the problem, but it failed. You are currently unable to send data to the host computer"
             );
         }
         else
         {
             MessageBox.Show("You were unable to send data to the host computer. Here is what .Net says about the error: " +
                 exception.Message
             );
         }
     }
 }
 public InputComponentForm(IConfigurable iComponent)
 {
     if (iComponent == null) throw new ArgumentNullException();
     configuredComponent = iComponent;
     InitializeComponent();
 }
Ejemplo n.º 46
0
 public UserControl GetVisualisationUserControl(IConfigurable configurable)
 {
     _delayTime = configurable.NextMoveDelay;
     return new TankBlasterUserControl(_field);
 }
 public PreprocessorComponentForm()
 {
     _configuredComponent = null;
     InitializeComponent();
 }
Ejemplo n.º 48
0
 public void AttatchToHost(IConfigurable host)
 {
     _host = host;
     _host.Rebind(this);
 }
Ejemplo n.º 49
0
		SolutionSection GenerateSolutionConfigurationSection(IConfigurable solution)
		{
			SolutionSection section = new SolutionSection("SolutionConfigurationPlatforms", "preSolution");
			foreach (var config in solution.ConfigurationNames) {
				foreach (var platform in solution.PlatformNames) {
					string key = config + "|" + platform;
					section.Add(key, key);
				}
			}
			return section;
		}
Ejemplo n.º 50
0
        internal static IConfigurable ResolveDataObject(IConfigDataProvider readOnlySession, IConfigDataProvider readOnlyConfigurationSession, IConfigDataProvider globalCatalogSession, IIdentityParameter identity, DataAccessHelper.GetDataObjectDelegate getDataObjectHandler, Task.TaskVerboseLoggingDelegate logHandler)
        {
            IConfigurable configurable   = null;
            ADObjectId    adobjectId     = null;
            ADObjectId    rootID         = RecipientTaskHelper.IsValidDistinguishedName(identity, out adobjectId) ? adobjectId.Parent : null;
            Exception     innerException = null;

            if (readOnlySession != null)
            {
                try
                {
                    configurable = getDataObjectHandler(identity, readOnlySession, rootID, null, null, new LocalizedString?(Strings.ErrorObjectNotUnique(identity.ToString())));
                }
                catch (ADTransientException ex)
                {
                    innerException = ex;
                    logHandler(Strings.VerboseCannotReadObject(identity.ToString(), readOnlySession.Source, ex.Message));
                }
                catch (ManagementObjectNotFoundException ex2)
                {
                    innerException = ex2;
                    logHandler(Strings.VerboseCannotReadObject(identity.ToString(), readOnlySession.Source, ex2.Message));
                }
            }
            if (configurable == null && readOnlyConfigurationSession != null)
            {
                try
                {
                    configurable = getDataObjectHandler(identity, readOnlyConfigurationSession, rootID, null, null, new LocalizedString?(Strings.ErrorObjectNotUnique(identity.ToString())));
                }
                catch (ADTransientException ex3)
                {
                    innerException = ex3;
                    logHandler(Strings.VerboseCannotReadObject(identity.ToString(), readOnlyConfigurationSession.Source, ex3.Message));
                }
                catch (ManagementObjectNotFoundException ex4)
                {
                    innerException = ex4;
                    logHandler(Strings.VerboseCannotReadObject(identity.ToString(), readOnlyConfigurationSession.Source, ex4.Message));
                }
            }
            if (configurable == null && globalCatalogSession != null)
            {
                try
                {
                    configurable = getDataObjectHandler(identity, globalCatalogSession, rootID, null, null, new LocalizedString?(Strings.ErrorObjectNotUnique(identity.ToString())));
                }
                catch (ADTransientException ex5)
                {
                    innerException = ex5;
                    logHandler(Strings.VerboseCannotReadObject(identity.ToString(), globalCatalogSession.Source, ex5.Message));
                }
                catch (ManagementObjectNotFoundException ex6)
                {
                    innerException = ex6;
                    logHandler(Strings.VerboseCannotReadObject(identity.ToString(), globalCatalogSession.Source, ex6.Message));
                }
            }
            if (configurable == null)
            {
                throw new ManagementObjectNotFoundException(Strings.ErrorObjectNotFound(identity.ToString()), innerException);
            }
            return(configurable);
        }
Ejemplo n.º 51
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter(new object[]
            {
                dataObject.Identity,
                dataObject
            });
            ADOrganizationConfig adorganizationConfig = dataObject as ADOrganizationConfig;

            if (adorganizationConfig != null)
            {
                int?num = this.RetrieveSCLJunkThreshold(adorganizationConfig.Id);
                if (num != null)
                {
                    adorganizationConfig.SCLJunkThreshold = num.Value;
                }
                this.FillTaskPopulatedFields(adorganizationConfig);
                MultiValuedProperty <OrganizationSummaryEntry> multiValuedProperty = new MultiValuedProperty <OrganizationSummaryEntry>();
                foreach (OrganizationSummaryEntry organizationSummaryEntry in adorganizationConfig.OrganizationSummary)
                {
                    if (OrganizationSummaryEntry.IsValidKeyForCurrentRelease(organizationSummaryEntry.Key))
                    {
                        multiValuedProperty.Add(organizationSummaryEntry.Clone());
                    }
                }
                multiValuedProperty.ResetChangeTracking();
                adorganizationConfig.OrganizationSummary = multiValuedProperty;
                adorganizationConfig.ResetChangeTracking();
            }
            ADSessionSettings sessionSettings;

            if (this.AccountPartition == null)
            {
                sessionSettings = ADSessionSettings.RescopeToSubtree(base.OrgWideSessionSettings);
            }
            else
            {
                PartitionId partitionId = RecipientTaskHelper.ResolvePartitionId(this.AccountPartition, new Task.TaskErrorLoggingDelegate(base.WriteError));
                sessionSettings = ADSessionSettings.FromAccountPartitionRootOrgScopeSet(partitionId);
            }
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 109, "WriteResult", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\organization\\GetOrganization.cs");

            tenantOrRootOrgRecipientSession.UseConfigNC = true;
            ADMicrosoftExchangeRecipient admicrosoftExchangeRecipient = MailboxTaskHelper.FindMicrosoftExchangeRecipient(tenantOrRootOrgRecipientSession, (IConfigurationSession)base.DataSession);

            if (admicrosoftExchangeRecipient == null)
            {
                if (adorganizationConfig.SharedConfigurationInfo == null)
                {
                    if (!this.IsOnlyGatewayServerRoleExist())
                    {
                        this.WriteError(new InvalidOperationException(Strings.ErrorMicrosoftExchangeRecipientNotFound), ErrorCategory.ReadError, adorganizationConfig.Identity, false);
                    }
                    else
                    {
                        base.WriteVerbose(Strings.MicrosoftExchangeRecipientNotFoundOnGatewayServerRole);
                    }
                }
            }
            else
            {
                ValidationError[] array = admicrosoftExchangeRecipient.Validate();
                for (int i = 0; i < array.Length; i++)
                {
                    this.WriteWarning(array[i].Description);
                }
                adorganizationConfig.MicrosoftExchangeRecipientEmailAddresses            = admicrosoftExchangeRecipient.EmailAddresses;
                adorganizationConfig.MicrosoftExchangeRecipientReplyRecipient            = admicrosoftExchangeRecipient.ForwardingAddress;
                adorganizationConfig.MicrosoftExchangeRecipientEmailAddressPolicyEnabled = admicrosoftExchangeRecipient.EmailAddressPolicyEnabled;
                adorganizationConfig.MicrosoftExchangeRecipientPrimarySmtpAddress        = admicrosoftExchangeRecipient.PrimarySmtpAddress;
                adorganizationConfig.ResetChangeTracking();
            }
            bool flag = !OrganizationId.ForestWideOrgId.Equals(adorganizationConfig.OrganizationId);

            if (flag)
            {
                MultiValuedProperty <string> multiValuedProperty2 = this.AcceptedDomainNamesGetter(adorganizationConfig);
                if (multiValuedProperty2 != null)
                {
                    adorganizationConfig.AcceptedDomainNames = multiValuedProperty2;
                }
            }
            if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled)
            {
                adorganizationConfig.HierarchicalAddressBookRoot = this.GetHierarchicalAddressBookRootFromOU(adorganizationConfig.OrganizationId.OrganizationalUnit);
            }
            base.WriteResult(new OrganizationConfig(adorganizationConfig, flag));
            TaskLogger.LogExit();
        }
Ejemplo n.º 52
0
 public void AddItem(IConfigurable Config)
 {
     items.Add(new PluginConfiuration(name, Config));
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Gets the configuration.
 /// </summary>
 /// <param name="source">The source image</param>
 /// <returns>Returns the bounds of the image</returns>
 private static Configuration GetConfiguration(IConfigurable source)
 => source?.Configuration ?? Configuration.Default;
Ejemplo n.º 54
0
 public void SaveConfig(IConfigSetting x, IConfigurable c)
 {
     c.SaveConfig(x);
 }
Ejemplo n.º 55
0
 public PluginConfiuration(Plugin instance, IConfigurable config)
 {
     this.instance = instance;
     this.config   = config;
     ForceLoad();
 }
Ejemplo n.º 56
0
 public void SendObjectTCP(IConfigurable obj)
 {
     string data = _objectStringConverter.ObjectToString(obj);
     byte[] bytes = System.Text.Encoding.ASCII.GetBytes(data);
     var keys = _clientsAndUdpEndPoints.Keys.ToArray();
     for (int j = keys.Length - 1; j >= 0; --j)
     {
         TcpClient tcpClient = keys[j];
         NetworkStream stream = tcpClient.GetStream();
         try
         {
             stream.BeginWrite(bytes, 0, bytes.Length, OnTcpDataSent, tcpClient);
         }
         /* If we can't write to this stream something is seriously wrong.
          * I don't think we can redeem this client, so let's shut it down.
          * When the client discovers that its connection is gone it will try
          * to make a new one. If the new connection succeeds everything should
          * be fine.
          */
         catch
         {
             tcpClient.Close();
             lock (_clientsAndBytes)
             {
                 _clientsAndBytes.Remove(tcpClient);
             }
             if (_clientsAndUdpEndPoints.ContainsKey(tcpClient))
             {
                 _clientsAndUdpEndPoints.Remove(tcpClient);
             }
         }
     }
 }
Ejemplo n.º 57
0
 public PluginConfiuration(Plugin instance, IConfigurable config) : this(instance.Name, config)
 {
     this.instance = instance;
 }
Ejemplo n.º 58
0
 public void SendObjectTcpToClient(IConfigurable obj, IPAddress clientAddress)
 {
     TcpClient client = null;
     foreach (var item in _clientsAndUdpEndPoints)
     {
         if (item.Value.Address.Equals(clientAddress))
         {
             client = item.Key;
             SendObjectTcpToClient(obj, client);
             return;
         }
     }
 }
Ejemplo n.º 59
0
 public void SendObjectUDP(IConfigurable obj)
 {
     string data = _objectStringConverter.ObjectToString(obj);
     byte[] bytes = System.Text.Encoding.ASCII.GetBytes(data);
     foreach (var kvp in _clientsAndUdpEndPoints)
     {
         _udpClient.BeginSend(bytes, bytes.Length, kvp.Value, OnUdpDataSent, _udpClient);
     }
 }
Ejemplo n.º 60
0
 void ConfigureTarget(IConfigurable target)
 {
     target.Configure(config);
 }