Esempio n. 1
0
        internal HMDManager(IFactory factory, IDeviceManager manager)
        {
            if (factory == null)
                throw new ArgumentNullException();

            if (manager == null)
                throw new ArgumentNullException();

            _factory = factory;
            _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
            _manager = manager;
            _handler = new InternalMessageHandler(this);
            _manager.MessageHandler = _handler;
            _nativeResources = new Dictionary<DeviceKey, DeviceResources>();
            _devices = new Dictionary<DeviceKey, HMD>();
            _defaultprofile = manager.DeviceDefaultProfile;

            // Initially, we must to enumerate all devices, which are currently attached
            // to the computer.
            using (var handles = _manager.HMDDevices)
            {
                foreach (var handle in handles)
                {
                    AddDevice(handle);
                }
            }
        }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
            this.eventManager = eventManager;
            this.profile = profile;
            this.eventManager.Subscribe(typeof(IntervalSync), OnInterval);

            logger = new Logger(eventManager);
        }
 // Copy config.cfg to csgo\cfg folder.
 public string CopyProfileConfig(IProfile profile)
 {
     string destCfg = SteamPaths.CfgFolder + "config.cfg";
     File.Copy(profile.FolderPath + profile.Config, destCfg, true);
     Changes++;
     return profile.Config + " succesfully created. \n";
 }
 public virtual void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
     folderFilterPattern = config["Filter"].InnerText;
     suiteName = config["SuiteName"].InnerText;
     monitor = new RecyclingFileMonitor(profile, config["Watch"].InnerText, folderFilterPattern, Process);
     this.eventManager = eventManager;
     this.eventManager.Subscribe(EventSinkType, monitor.ProcessFolder);
 }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile)
        {
            string reposServer = config["RepositoryServer"].InnerText;
            _profile = profile;
            _respostoryPath =reposServer + config["RepositoryPath"].InnerText;

            if (!_usernames.ContainsKey(reposServer))
            {
                Console.Write(String.Format("Please enter {0} Username : "******"Please enter {0} Password : ", reposServer));
                _passwords[reposServer] = Console.ReadLine();
            }

            _connector.SetAuthentication(_usernames[reposServer],  _passwords[reposServer]);

            _eventManager = eventManager;
            _eventManager.Subscribe(PubType, PokeRepository);

            _connector.Revision += _connector_Revision;
            _connector.Error += _connector_Error;

            InernalInitialize(config, eventManager, profile);
        }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile)
        {
            eventManager.Subscribe(typeof(LogMessage), HandleLogMessage);
            eventManager.Subscribe(typeof(ServiceHostState), HandleServiceHostStateMessage);

            ConfigureAppenders(config);
        }
 public virtual void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
     Config = config;
     EventManager = eventManager;
     Logger = new Logger(eventManager);
     
     Logger.LogVersionOneConfiguration(LogMessage.SeverityType.Info, Config["Settings"]);
 }
		public SearchCommand(QueryRunner queryRunner, IProfile profile, DocumentIndexRebuilder documentIndexRebuilder, IActivityLogger logger)
		{
			_queryRunner = queryRunner;
			_profile = profile;
			_documentIndexRebuilder = documentIndexRebuilder;
			_logger = logger;
		}
        public UserSettingsService(ISecurityService securityService, IProfile profileRepository)
        {
            Security = securityService;



            Repository = profileRepository;
        }
 public void SerializeProfiles(IProfile profile)
 {
     using (StreamWriter writer = new StreamWriter(@"..\..\Database\Users\Profiles.txt", true))
     {
         writer.WriteLine();
         writer.Write(profile);
     }
 }
Esempio n. 11
0
 public void Submit(IProfile profile)
 {
     var message = string.Format("{0}\n{1}\n{2}",
         profile.Name,
         profile.Age,
         profile.Mail);
     MessageBox.Show(message, "送信");
 }
		public BuildSearchIndexesCommand(ITpBus bus, IProfileCollection profileCollection, IProfile profile, IPluginContext pluginContext, IPluginMetadata pluginMetadata)
		{
			_bus = bus;
			_profileCollection = profileCollection;
			_profile = profile;
			_pluginContext = pluginContext;
			_pluginMetadata = pluginMetadata;
		}
 private IDisposable QueryContacts(IProfile profile)
 {
     //TODO: What to do when a failure occurs?
     return _contactQueryAggregator.Search(profile)
                                   .SubscribeOn(_schedulerProvider.Concurrent)
                                   .ObserveOn(_schedulerProvider.Dispatcher)
                                   .Subscribe(_contact);
 }
        protected override void InternalInitialize(XmlElement config, IEventManager eventmanager, IProfile profile) 
        {
            ReferenceExpression = config[ReferenceExpressionField].InnerText;
            repositoryFriendlyNameSpec = config[RepositoryFriendlyNameSpecField].InnerText;
            LoadLinkInfo(config[LinkNode]);

            svnInfo = connector.GetSvnInformation(RepositoryPath);
        }
        private VirtualNode(IProfile rootnode, IProfile node)
        {
            if (!node.Path.StartsWith(rootnode.Path))
                throw new ArgumentOutOfRangeException("node");

            _rootnode = rootnode;
            _node = node;
        }
Esempio n. 16
0
 public void SaveCommit(IProfile profile, out bool success)
 {
     using (IUnitOfWork u = UnitOfWork.Begin())
     {
         Save(profile, out success);
         if (success)
             u.Commit();
     }
 }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
            this.eventManager = eventManager;
            this.eventManager.Subscribe(typeof(V1TestReady), CreateQCTest);
            this.eventManager.Subscribe(typeof(WorkitemCreationResult), OnDefectCreated);
            this.eventManager.Subscribe(typeof(WorkitemStateChangeCollection), OnDefectStateChange);
            this.eventManager.Subscribe(typeof(ServiceHostState), HostStateChanged);

            logger = new Logger(eventManager);
        }
 public virtual bool AreEqual(IProfileModel model, IProfile entity)
 {
     return NameableEntityMapper.AreEqual(model, entity)
         // Profile Properties
         // <None>
         // Related Objects
         // <None>
         ;
 }
Esempio n. 19
0
        public void DeleteCommit(IProfile profile)
        {
            Checks.Argument.IsNotNull(profile, "profile");

            using (IUnitOfWork u = UnitOfWork.Begin())
            {
                _repo.Remove(profile);
                u.Commit();
            }
        }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
            if(!double.TryParse(config["Interval"].InnerText, out interval)) {
                interval = -1;
            }

            publishtype = Type.GetType(config["PublishClass"].InnerText);
            eventmanager = eventManager;
            eventmanager.Subscribe(typeof(ServiceHostState), HostStateChanged);
            logger = new Logger(eventManager);
        }
        public void Initialize(XmlElement configElement, IEventManager manager, IProfile profile) {
            eventManager = manager;
            this.profile = profile;
            logger = new Logger(eventManager);
            this.configElement = configElement;

            ConfigurationReader.ReadConfigurationValues(configuration, configElement);

            InitializeComponents();
        }
 public DocumentIndexRebuilder(IDocumentIndexProvider documentIndexProvider, DocumentIndexSetup documentIndexSetup, ITpBus bus, IPluginContext pluginContext, IPluginMetadata pluginMetadata, IProfileCollection profileCollection, IProfile profile, IActivityLogger logger)
 {
     _documentIndexProvider = documentIndexProvider;
     _documentIndexSetup = documentIndexSetup;
     _bus = bus;
     _pluginContext = pluginContext;
     _pluginMetadata = pluginMetadata;
     _profileCollection = profileCollection;
     _profile = profile;
     _logger = logger;
 }
        public IObservable<IContactProfile> Search(IProfile profile)
        {
            var queryResults = from provider in _contactQueryProviders.ToObservable()
                               from contact in provider.LoadContact(profile)
                               select contact;

            var aggergateContact = queryResults.Scan(NullContactProfile.Instance,
                                                     (acc, cur) => new AggregatedContact(acc, cur));

            return aggergateContact;
        }
 public virtual IProfileModel MapToModelListing(IProfile entity, int currentDepth = 1)
 {
     currentDepth++;
     var model = NameableEntityMapper.MapToModelListing<IProfile, ProfileModel>(entity);
     // Profile Properties
     // <None>
     // Related Objects
     // <None>
     // Return Entity
     return model;
 }
Esempio n. 25
0
        private void ShowProfile(IProfile profile)
        {
            var windowRegion = _regionManager.Regions[RegionNames.WindowRegion];
            var view = _profileDashboardViewFactory();
            
            view.ViewModel.CloseCommand = new DelegateCommand(() => windowRegion.Remove(view));
            view.ViewModel.Load(profile);

            windowRegion.Add(view);
            windowRegion.Activate(view);
        }
 public SecureboxFileExplorer(IProfile[] profiles, IEntryModel[] rootDirs, string mask, string selectedPath = "c:\\")
 {
     InitializeComponent();
     Securebox.CenterWindowOnScreen(this);
     _profiles = profiles;
     _rootDirs = rootDirs;
     _filterStr = mask;
     _selectedPath = selectedPath;
     
     
 }
 public void Load(IProfile profile)
 {
     ActivatedIdentity = profile.Identifiers.Where(id => id.IdentifierType == "phone")
                                .Concat(profile.Identifiers)
                                .Select(id => id.Value)
                                .FirstOrDefault();
     _querySubscriptions.Add(QueryContacts(profile));
     _querySubscriptions.Add(QueryMessages(profile));
     _querySubscriptions.Add(QueryPictureAlbums(profile));
     _querySubscriptions.Add(QueryCalendars(profile));
 }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
            EventManager = eventManager;
            Logger = new Logger(eventManager);
            var c = new V1Central(config["Settings"]);
            c.Validate();
            v1Server = c;

            LoadProjectMap(config["TestPublishProjectMap"], config["BaseQueryFilter"]);

            EventManager.Subscribe(typeof(IntervalSync), OnInterval);
        }
        public ITradePriceMonitor Get(IProfile profile)
        {
            var monitor = Get(profile.MonitorType);
            monitor.PriceType = profile.PriceType;
            monitor.TargetCurrency = monitor.SupportedCurrencies.Contains(profile.TargetCurrency)
                ? profile.TargetCurrency
                : monitor.SupportedCurrencies.First();
            monitor.Frequency = profile.Frequency;

            return monitor;
        }
Esempio n. 30
0
 public ExtensionProfile(IProfile profile)
 {
     ID = profile.ID;
     CompanyID = profile.CompanyID;
     EntityID = profile.EntityID;
     ExtensionID = profile.ExtensionID;
     Name = profile.Name;
     Description = profile.Description;
     Active = profile.Active;
     Rules = profile.Rules;
     Country = profile.Country;
 }
Esempio n. 31
0
        public void SetUp()
        {
            _profile       = Substitute.For <IProfile>();
            _hash          = Substitute.For <IHash>();
            _otpService    = Substitute.For <IOtpService>();
            _failedCounter = Substitute.For <IFailedCounter>();
            _notification  = Substitute.For <INotification>();
            _logger        = Substitute.For <ILogger>();

            //先初始化一個最基本的Service
            var authentication = new AuthenticationService(_profile, _hash, _otpService);

            //然後裝飾他,越後面越先執行
            var notificationDecorator  = new NotificationDecorator(authentication, _notification);
            var failedCounterDecorator = new FailedCounterDecorator(notificationDecorator, _failedCounter);

            _authentication = new LogFailedCountDecorator(failedCounterDecorator, _failedCounter, _logger);
        }
Esempio n. 32
0
 public AltinnApp(
     IAppResources appResourcesService,
     ILogger <AltinnApp> logger,
     IData dataService,
     IProcess processService,
     IPDF pdfService,
     IProfile profileService,
     IRegister registerService,
     IPrefill prefillService,
     IInstance instanceService,
     IOptions <GeneralSettings> settings,
     IText textService,
     IHttpContextAccessor httpContextAccessor) : base(appResourcesService, logger, dataService, processService, pdfService, prefillService, instanceService, registerService, settings, profileService, textService, httpContextAccessor)
 {
     _validationHandler    = new ValidationHandler();
     _calculationHandler   = new CalculationHandler();
     _instantiationHandler = new InstantiationHandler(profileService, registerService);
 }
        public void Setup()
        {
            _logger        = Substitute.For <ILogger>();
            _profile       = Substitute.For <IProfile>();
            _optService    = Substitute.For <IOtp>();
            _hash          = Substitute.For <IHash>();
            _notification  = Substitute.For <INotification>();
            _failedCounter = Substitute.For <IFailedCounter>();
            _apiCountQuota = Substitute.For <IApiCountQuota>();

            var authenticationService = new AuthenticationService(_profile, _hash, _optService);
            var notificationDecorator = new NotificationDecorator(authenticationService, _notification);
            var failedCountDecorator  = new FailedCountDecorator(notificationDecorator, _failedCounter);
            var logDecorator          = new LogDecorator(failedCountDecorator, _logger, _failedCounter);
            var apiCallQuotaDecorator = new ApiCallQuotaDecorator(logDecorator, _apiCountQuota);

            _authentication = apiCallQuotaDecorator;
        }
Esempio n. 34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstanceController"/> class
 /// </summary>
 /// <param name="authorizationService">The authorizationService (set in Startup.cs)</param>
 /// <param name="logger">The logger (set in Startup.cs)</param>
 /// <param name="profileService">The profile service (set in Startup.cs)</param>
 /// <param name="registerService">The registerService (set in Startup.cs)</param>
 /// <param name="erService">The erService (set in Startup.cs)</param>
 /// <param name="formService">The form</param>
 /// <param name="repositoryService">The repository service (set in Startup.cs)</param>
 /// <param name="serviceExecutionService">The serviceExecutionService (set in Startup.cs)</param>
 /// <param name="archiveService">The archive service</param>
 /// <param name="httpContextAccessor">The http context accessor</param>
 /// <param name="testDataService">the test data service handler</param>
 /// <param name="workflowSI">the workflow service handler</param>
 /// <param name="instanceSI">the instance service handler</param>
 /// <param name="eventSI">the instance event service handler</param>
 /// <param name="platformSI">the platform service handler</param>
 /// <param name="dataSI">the data service handler</param>
 /// <param name="application">the application service handler</param>
 /// <param name="prefill">The prefill service handler</param>
 /// <param name="repositorySettings">the repository settings</param>
 /// <param name="generalSettings">the general settings</param>
 public InstanceController(
     IAuthorization authorizationService,
     ILogger <InstanceController> logger,
     IProfile profileService,
     IRegister registerService,
     IER erService,
     IForm formService,
     IRepository repositoryService,
     IExecution serviceExecutionService,
     IArchive archiveService,
     ITestdata testDataService,
     IHttpContextAccessor httpContextAccessor,
     IWorkflow workflowSI,
     IInstance instanceSI,
     IInstanceEvent eventSI,
     IPlatformServices platformSI,
     IData dataSI,
     IApplication application,
     IPrefill prefill,
     IOptions <ServiceRepositorySettings> repositorySettings,
     IOptions <GeneralSettings> generalSettings)
 {
     _authorization       = authorizationService;
     _logger              = logger;
     _profile             = profileService;
     _register            = registerService;
     _er                  = erService;
     _form                = formService;
     _repository          = repositoryService;
     _execution           = serviceExecutionService;
     _userHelper          = new UserHelper(profileService, _register, generalSettings);
     _archive             = archiveService;
     _testdata            = testDataService;
     _httpContextAccessor = httpContextAccessor;
     _workflowSI          = workflowSI;
     _instance            = instanceSI;
     _event               = eventSI;
     _platformSI          = platformSI;
     _data                = dataSI;
     _prefill             = prefill;
     _application         = application;
     _settings            = repositorySettings.Value;
     _generalSettings     = generalSettings.Value;
 }
Esempio n. 35
0
        public static ICurve TopCentreline(this IFramingElement element)
        {
            if (element == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot query the top centreline of a null framing element.");
                return(null);
            }

            ICurve location = element.Location;

            Vector normal = null;

            try
            {
                normal = BH.Engine.Physical.Query.Normal(element);
            }
            catch
            {
                Engine.Reflection.Compute.RecordError("IFramingElement must have linear location line.");
                return(null);
            }

            if (normal == null)
            {
                Engine.Reflection.Compute.RecordError("Was not able to compute element normal.");
                return(null);
            }

            if (element.Property is ConstantFramingProperty)
            {
                ConstantFramingProperty constantProperty = element.Property as ConstantFramingProperty;

                IProfile profile = constantProperty.Profile;

                BoundingBox profileBounds = profile.Edges.Bounds();

                return(location.ITranslate(normal * profileBounds.Max.Y));
            }
            else
            {
                Engine.Reflection.Compute.RecordError("Element does not have a suitable framing property, so the section height could not be calculated.");
                return(null);
            }
        }
        public static void AddSymbolInProfile(string symbol, IProfile profile)
        {
            InitializeIfNeeded();
            ScriptDefineSymbolManagerSettings settings = GetSettings();

            if (settings.Symbols.Any((s) => s.Name == symbol) || s_codeProvidedSymbols.Any((s) => s.Name == symbol))
            {
                if (profile is Profile p)
                {
                    p.Symbols.AddUnique(symbol);
                }
            }
            else
            {
                Debug.LogError($"Symbol {symbol} doesn't exist.");
            }

            EditorUtility.SetDirty(settings);
        }
Esempio n. 37
0
        /// <summary>
        /// Define o perfil
        /// </summary>
        /// <param name="profile"></param>
        /// <param name="ignoreTokenProvider">Identifica se é para ignora a definição no provedor do token.</param>
        public static void SetCurrentProfile(IProfile profile, bool ignoreTokenProvider)
        {
            var principal = UserContext.Current.Principal;

            Context.Profile = profile;
            if (principal == null)
            {
                Context.Profile     = null;
                Context.ProfileInfo = null;
                return;
            }
            var identity = principal.Identity;

            if (identity == null)
            {
                Context.Profile     = null;
                Context.ProfileInfo = null;
                return;
            }
            if (identity.IsAuthenticated && profile != null)
            {
                if (!ignoreTokenProvider)
                {
                    var setProfileResult = Tokens.SetProfile(UserContext.Current.Token, profile.ProfileId);
                    if (!setProfileResult.Success)
                    {
                        throw new Exception(ResourceMessageFormatter.Create(() => Properties.Resources.SetProfileError, profile.FullName, UserContext.Current.Token, setProfileResult.FailureMessage).Format());
                    }
                }
                Context.ProfileInfo = profile.GetInfo();
            }
            else
            {
                Context.ProfileInfo = null;
                Context.Profile     = null;
            }
            if (CurrentProfileChanged != null)
            {
                CurrentProfileChanged(null, new CurrentProfileChangedEventArgs {
                    ProfileInfo = Context.ProfileInfo
                });
            }
        }
Esempio n. 38
0
        public static async Task <IEntryModel> LookupAsync(this IProfile profile, string path, CancellationToken ct)
        {
            string      curPath = path;
            IEntryModel retVal  = await profile.ParseAsync(path);

            while (retVal == null && curPath != null)
            {
                curPath = profile.Path.GetDirectoryName(curPath);
                retVal  = await profile.ParseAsync(curPath);
            }

            if (retVal != null && curPath != path && path.StartsWith(curPath, StringComparison.CurrentCultureIgnoreCase))
            {
                string[] trailingPaths = path.Substring(curPath.Length).Split(new char[] { '\\', '/' }, StringSplitOptions.RemoveEmptyEntries);
                return(await LookupAsync(retVal.Profile, retVal, trailingPaths, CancellationToken.None, 0));
            }

            return(retVal);
        }
        public IObservable <ICalendarEvent> LoadCalendar(IProfile activeProfile)
        {
            return(Observable.Create <ICalendarEvent>(o =>
            {
                var x = new CalendarEvent
                {
                    Start = DateTimeOffset.UtcNow.Date.AddDays(3).AddHours(10),
                    End = DateTimeOffset.UtcNow.Date.AddDays(3).AddHours(12),
                    Name = "Lunch with Lee",
                    Provider = GoogleCalendarProvider.Instance
                };
                o.OnNext(x);

                x = new CalendarEvent
                {
                    Start = DateTimeOffset.UtcNow.Date.AddDays(1).AddHours(18),
                    End = DateTimeOffset.UtcNow.Date.AddDays(1).AddHours(19.5),
                    Name = "Training",
                    Provider = GoogleCalendarProvider.Instance
                };
                o.OnNext(x);

                x = new CalendarEvent
                {
                    Start = DateTimeOffset.UtcNow.Date.AddHours(18),
                    End = DateTimeOffset.UtcNow.Date.AddHours(19.5),
                    Name = "Document review",
                    Provider = GoogleCalendarProvider.Instance
                };
                o.OnNext(x);

                x = new CalendarEvent
                {
                    Start = DateTimeOffset.UtcNow.Date.AddDays(-10).AddHours(18),
                    End = DateTimeOffset.UtcNow.Date.AddDays(-10).AddHours(19.5),
                    Name = "Document design session",
                    Provider = GoogleCalendarProvider.Instance
                };
                o.OnNext(x);
                o.OnCompleted();
                return Disposable.Empty;
            }));
        }
Esempio n. 40
0
        public void Save(IProfile profile, out bool success)
        {
            Checks.Argument.IsNotNull(profile, "profile");

            success = false;

            if (null == _repo.FindByProfileId(profile.ProfileId))
            {
                try
                {
                    _repo.Add(profile);
                    success = true;
                }
                catch (Exception ex)
                {
                    success = false;
                }
            }
        }
Esempio n. 41
0
        public static double Area(this IProfile profile)
        {
            if (profile is TaperedProfile)
            {
                Engine.Reflection.Compute.RecordWarning("The sectional area of TaperedProfiles vary along their length. The average area of the TaperedProfile has been returned, assuming that the section varies linearly.");
                TaperedProfile taperedProfile = profile as TaperedProfile;
                double         sum            = 0;
                for (int i = 0; i < taperedProfile.Profiles.Count - 1; i++)
                {
                    double temArea = (taperedProfile.Profiles.ElementAt(i).Value.Area() + taperedProfile.Profiles.ElementAt(i + 1).Value.Area()) / 2;
                    sum += temArea * System.Convert.ToDouble(taperedProfile.Profiles.ElementAt(i + 1).Key - taperedProfile.Profiles.ElementAt(i).Key);
                }
                return(sum);
            }

            List <PolyCurve> curvesZ = Engine.Geometry.Compute.IJoin(profile.Edges.ToList());

            int[] depth = new int[curvesZ.Count];
            if (curvesZ.Count > 1)
            {
                // find which is in which
                for (int i = 0; i < curvesZ.Count; i++)
                {
                    for (int j = 0; j < curvesZ.Count; j++)
                    {
                        if (i != j)
                        {
                            if (curvesZ[i].IsContaining(new List <Point>()
                            {
                                curvesZ[j].IStartPoint()
                            }))
                            {
                                depth[j]++;
                            }
                        }
                    }
                }
            }

            // Using region integration as the Curves are defined on the XY-Plane.
            depth = depth.Select(x => x % 2 == 0 ? 1 : -1).ToArray();   // positive area as 1 and negative area as -1
            return(curvesZ.Select((x, i) => Math.Abs(x.IIntegrateRegion(0)) * depth[i]).Sum());
        }
Esempio n. 42
0
        private void profilesList_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            int index = profilesList.IndexFromPoint(e.Location);

            if (index != ListBox.NoMatches)
            {
                IProfile selectedItem = profilesList.Items[index] as IProfile;
                if (selectedItem != null)
                {
                    engine.Profiles.Remove(selectedItem);
                    profilesList.DataSource = engine.Profiles.ToArray();
                }
            }
        }
Esempio n. 43
0
        public void UpdateSelected(IProfile profile)
        {
            var selected = _profiles.FirstOrDefault(p => p.Selected);

            if (selected != null)
            {
                selected.RemotingEnabled = profile.RemotingEnabled;
                selected.RemoteHost      = profile.RemoteHost;
                selected.RemoteUsername  = profile.RemoteUsername;
                selected.RemotePassword  = profile.RemotePassword;
                selected.ProfileName     = profile.ProfileName;
                selected.Prefix          = profile.Prefix;
                selected.Webroot         = profile.Webroot;
                selected.Website         = profile.Website;
                selected.Solr            = profile.Solr;
                selected.SqlServer       = profile.SqlServer;
                selected.Parameters      = profile.Parameters;
            }
        }
Esempio n. 44
0
        /// <summary>
        /// Save program options into persistence.
        /// See <seealso cref="SaveOptions"/> to save program options on program end.
        /// </summary>
        /// <param name="sessionDataFileName"></param>
        /// <returns></returns>
        void ISettingsManager.LoadSessionData(string sessionDataFileName)
        {
            Profile profileDataModel = null;

            try
            {
                if (System.IO.File.Exists(sessionDataFileName))
                {
                    // Create a new file stream for reading the XML file
                    using (FileStream readFileStream = new System.IO.FileStream(sessionDataFileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        try
                        {
                            // Create a new XmlSerializer instance with the type of the test class
                            XmlSerializer serializerObj = new XmlSerializer(typeof(Profile));

                            // Load the object saved above by using the Deserialize function
                            profileDataModel = (Profile)serializerObj.Deserialize(readFileStream);
                        }
                        catch (Exception e)
                        {
                            logger.Error(e);
                        }

                        // Cleanup
                        readFileStream.Close();
                    }
                }

                _SessionData = profileDataModel;
            }
            catch (Exception exp)
            {
                logger.Error(exp);
            }
            finally
            {
                if (profileDataModel == null)
                {
                    profileDataModel = new Profile();                      // Just get the defaults if serilization wasn't working here...
                }
            }
        }
        public RecyclingFileMonitor(IProfile profile, string watchFolder, string filterPattern, ProcessFileBatchDelegate processor)
        {
            this.processor = processor;
            this.profile   = profile;
            WatchFolder    = watchFolder;
            FilterPattern  = filterPattern;

            if (string.IsNullOrEmpty(FilterPattern))
            {
                FilterPattern = "*.*";
            }

            var path = Path.GetFullPath(WatchFolder);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
        }
        public FileBasedDragDropHandler(IProfile profile, Func <IEntryModel, bool> getIsVirtualFunc = null)
        {
            _profile    = profile;
            _fsiProfile = profile is FileSystemInfoProfile ? (FileSystemInfoProfile)profile :
                          new FileSystemInfoProfile(profile.Events);
            _getIsVirtualFunc = getIsVirtualFunc ?? (em => true);

            TransferCommand =
                new DiskTransfer();
            //new FileExplorer.Script.TransferCommand((effect, source, destDir) =>
            //    source.Profile is IDiskProfile ?
            //        IOScriptCommands.DiskTransfer(source, destDir, effect == DragDropEffectsEx.Move, true)
            //        : ResultCommand.Error(new NotSupportedException())
            //    );

            converter        = LambdaValueConverter.ConvertUsingCast <IDraggable, IEntryModel>();
            dataObjConverter = new LambdaValueConverter <IEnumerable <IEntryModel>, IDataObject>(
                ems => getDataObject(ems), da => getEntryModels(da));
        }
Esempio n. 47
0
        /// <summary>
        /// Method should be called on application start-up to read MRU
        /// data from persisted session object into its associated viewmodel.
        /// </summary>
        /// <param name="sessionData"></param>
        public void ReadMruFromSession(IProfile sessionData)
        {
            try  // Read back MRU data information
            {
                List.Entries.Clear();
                foreach (var item in sessionData.LastActiveSourceFiles)
                {
                    IMRUEntryViewModel mruItem =
                        MRULib.MRU_Service.Create_Entry(item.path,
                                                        item.LastTimeOfEdit);
                    mruItem.SetIsPinned(item.IsPinned);

                    List.UpdateEntry(mruItem);
                }
            }
            catch
            {
            }
        }
Esempio n. 48
0
        protected FingerprintStore(IProfile profile, string matchSourceName)
        {
            FingerprintSize = DEFAULT_FINGERPRINT_SIZE;
            Threshold       = DEFAULT_THRESHOLD;
            this.profile    = profile;
            store           = new Dictionary <AudioTrack, List <SubFingerprintHash> >();

            // Dictionary is faster, SQLite needs less memory
            collisionMap = new DictionaryCollisionMap(); // new SQLiteCollisionMap();

            /*
             * TODO to support processing of huge datasets (or machines with low memory),
             * the store could also be moved from Dictionary/Lists to SQLite, the database
             * written to disk (instead of in-memory like now) and the user given the
             * choice between them (or automatically chosen depending on the amount of data).
             */

            this.matchSourceName = matchSourceName;
        }
Esempio n. 49
0
        public void SetUp()
        {
            _profile        = Substitute.For <IProfile>();
            _otp            = Substitute.For <IOtp>();
            _hash           = Substitute.For <IHash>();
            _notification   = Substitute.For <INotification>();
            _logger         = Substitute.For <ILogger>();
            _failedCounter  = Substitute.For <IFailedCounter>();
            _apiUserQuotaV2 = Substitute.For <IApiUserQuotaV2>();
            var authenticationService =
                new AuthenticationService(_profile, _hash, _otp);

            var checkUseTimeDecorator  = new ApiCheckTimeDecorator(authenticationService, _apiUserQuotaV2);
            var notificationDecorator  = new NotificationDecorator(checkUseTimeDecorator, _notification, _logger);
            var failedCounterDecorator = new FailedCounterDecorator(notificationDecorator, _failedCounter);
            var logDecorator           = new LogDecorator(failedCounterDecorator, _failedCounter, _logger);

            _authentication = logDecorator;
        }
Esempio n. 50
0
        /// <summary>
        /// Edits the profile view.
        /// </summary>
        /// <param name="profileInfo">The profile information.</param>
        /// <param name="userDetail">The user detail.</param>
        /// <param name="genderCollection">The gender collection.</param>
        /// <param name="countryCollection">The country collection.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">genderCollection</exception>
        /// <exception cref="ArgumentNullException">
        /// profileInfo
        /// or
        /// userDetail
        /// </exception>
        public IProfileView EditProfileView(IProfile profileInfo, IUserDetail userDetail, IList <IYourGender> genderCollection, IList <ICountry> countryCollection, string processingMessage)
        {
            if (genderCollection == null)
            {
                throw new ArgumentException(nameof(genderCollection));
            }

            if (profileInfo == null)
            {
                throw new ArgumentNullException(nameof(profileInfo));
            }

            if (userDetail == null)
            {
                throw new ArgumentNullException(nameof(userDetail));
            }

            var genderDLL  = GetDropDownList.GenderListItems(genderCollection, profileInfo.GenderId);
            var CountryDLL = GetDropDownList.CountryListItem(countryCollection, profileInfo.CountryId);

            var viewModel = new ProfileModelView
            {
                User                 = userDetail,
                ProfileId            = profileInfo.ProfileId,
                CountryId            = profileInfo.CountryId,
                Address              = profileInfo.Address,
                DateOfBirth          = profileInfo.DateOfBirth,
                Nationality          = profileInfo.Nationality,
                StateOfOrigin        = profileInfo.StateOfOrigin,
                Gender               = profileInfo.Gender,
                GenderId             = profileInfo.GenderId,
                ProfileSummary       = profileInfo.ProfileSummary,
                DateCreated          = profileInfo.DateCreated,
                PictureDigitalFileId = profileInfo.PictureDigitalFileId,
                CVDigitalFileId      = profileInfo.CVDigitalFileId,
                GenderDropDown       = genderDLL,
                CountryDropDown      = CountryDLL,
                ProcessingMessage    = processingMessage ?? string.Empty
            };

            return(viewModel);
        }
Esempio n. 51
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            IEventAggregator _events        = new EventAggregator();
            IWindowManager   _windowManager = new AppWindowManager();
            IProfile         _exProfile     = new FileSystemInfoExProfile(_events, _windowManager);
            IProfile         _ioProfile     = new FileSystemInfoProfile(_events);

            IProfile[]    _profiles = new IProfile[] { _exProfile, _ioProfile };
            IEntryModel[] _rootDirs = new IEntryModel[] { AsyncUtils.RunSync(() => _exProfile.ParseAsync("")) };

            explorer.WindowManager         = _windowManager;
            explorer.ViewModel.Initializer =
                new ScriptCommandInitializer()
            {
                OnModelCreated    = ScriptCommands.Run("{OnModelCreated}"),
                OnViewAttached    = ScriptCommands.Run("{OnViewAttached}"),
                RootModels        = _rootDirs,
                WindowManager     = _windowManager,
                StartupParameters = new ParameterDic()
                {
                    { "Profiles", _profiles },
                    { "RootDirectories", _rootDirs },
                    { "GlobalEvents", _events },
                    { "WindowManager", _windowManager },
                    { "StartupPath", "" },
                    { "ViewMode", "List" },
                    { "ItemSize", 16 },
                    { "EnableDrag", true },
                    { "EnableDrop", true },
                    { "FileListNewWindowCommand", NullScriptCommand.Instance },      //Disable NewWindow Command.
                    { "EnableMultiSelect", true },
                    { "ShowToolbar", true },
                    { "ShowGridHeader", true },
                    { "OnModelCreated", IOInitializeHelpers.Explorer_Initialize_Default },
                    { "OnViewAttached", UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot() }
                }
            };

            cbCommand.ItemsSource = ScriptCommandDictionary.CommandList;
        }
Esempio n. 52
0
        public virtual async Task <TResponse> ExecuteAsync(
            [NotNull] IProfile profile,
            [NotNull] string url,
            [NotNull] IResponseParser <TCommand, TResponse> parser,
            CancellationToken token)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            if (parser == null)
            {
                throw new ArgumentNullException("parser");
            }

            try
            {
                string response = await Requester.GetResponseAsync(url, profile, token);

                if (response == null)
                {
                    return(default(TResponse));
                }

                token.ThrowIfCancellationRequested();

                return(await parser.ParseAsync(response, profile.Enigma));
            }
            catch (Exception ex)
            {
                if (ex is KnownException || ex is OperationCanceledException)
                {
                    throw;
                }

                throw new CommandException(string.Format("Command failed for profile {0}", profile.Name), ex);
            }
        }
Esempio n. 53
0
 public App(
     IAppResources appResourcesService,
     ILogger <App> logger,
     IData dataService,
     IProcess processService,
     IPDF pdfService,
     IProfile profileService,
     IRegister registerService,
     IPrefill prefillService,
     IInstance instanceService,
     ISiriusApi siriusService,
     IHttpContextAccessor accessor) : base(appResourcesService, logger, dataService, processService, pdfService, prefillService, instanceService)
 {
     _logger               = logger;
     _validationHandler    = new ValidationHandler(instanceService);
     _calculationHandler   = new CalculationHandler();
     _instantiationHandler = new InstantiationHandler(profileService, registerService);
     _dataService          = dataService;
     _siriusApi            = siriusService;
 }
Esempio n. 54
0
        /// <summary>
        /// Sets the player to a red mario
        /// </summary>
        /// <param name="player">The player</param>
        private void SetPlayerToMarioTwo(IPlayer player)
        {
            IProfile marioProfile = new IProfile()
            {
                Gender     = Gender.Male,
                Head       = new IProfileClothingItem("Cap", "ClothingRed"),
                ChestOver  = new IProfileClothingItem("Suspenders", "ClothingYellow", "ClothingYellow"),
                ChestUnder = new IProfileClothingItem("TrainingShirt", "ClothingRed"),
                Hands      = new IProfileClothingItem("Gloves", "ClothingWhite"),
                Accesory   = new IProfileClothingItem("Belt", "ClothingLightGray", "ClothingLightGray"),
                Legs       = new IProfileClothingItem("Pants", "ClothingWhite"),
                Feet       = new IProfileClothingItem("Boots", "ClothingBrown")
            };

            player.GiveWeaponItem(WeaponItem.KNIFE);
            player.GiveWeaponItem(WeaponItem.PISTOL45);
            player.GiveWeaponItem(WeaponItem.STRENGTHBOOST);
            player.SetProfile(marioProfile);
            _Marios.Add(player);
        }
Esempio n. 55
0
        internal void GetSessionData(IProfile sessionData)
        {
            if (sessionData.LastActiveTargetFile != TargetFile.FileName)
            {
                sessionData.LastActiveTargetFile = TargetFile.FileName;
            }

            sessionData.LastActiveSourceFiles = new List <SettingsModel.Models.FileReference>();
            if (SourceFiles != null)
            {
                foreach (var item in SourceFiles)
                {
                    sessionData.LastActiveSourceFiles.Add(new SettingsModel.Models.FileReference()
                    {
                        path = item.FileName
                    }
                                                          );
                }
            }
        }
Esempio n. 56
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstanceController"/> class
 /// </summary>
 /// <param name="authorizationService">The authorizationService (set in Startup.cs)</param>
 /// <param name="logger">The logger (set in Startup.cs)</param>
 /// <param name="registerService">The registerService (set in Startup.cs)</param>
 /// <param name="formService">The form</param>
 /// <param name="repositoryService">The repository service (set in Startup.cs)</param>
 /// <param name="viewRepository">The view repository</param>
 /// <param name="serviceExecutionService">The serviceExecutionService (set in Startup.cs)</param>
 /// <param name="profileService">The profileService (set in Startup.cs)</param>
 /// <param name="archiveService">The archive service</param>
 public InstanceController(IAuthorization authorizationService,
                           ILogger <InstanceController> logger,
                           IRegister registerService,
                           IForm formService,
                           IRepository repositoryService,
                           IExecution serviceExecutionService,
                           IProfile profileService,
                           IArchive archiveService,
                           ITestdata testDataService)
 {
     _authorization = authorizationService;
     _logger        = logger;
     _register      = registerService;
     _form          = formService;
     _repository    = repositoryService;
     _execution     = serviceExecutionService;
     _userHelper    = new UserHelper(profileService, _register);
     _archive       = archiveService;
     _testdata      = testDataService;
 }
Esempio n. 57
0
        /// <summary>
        /// The data controller is responsible for adding business logic to the data elements.
        /// </summary>
        /// <param name="generalSettings">settings </param>
        /// <param name="logger">logger</param>
        /// <param name="registerService">register service</param>
        /// <param name="instanceService">instance service to store instances</param>
        /// <param name="dataService">dataservice</param>
        /// <param name="executionService">execution service to execute data element logic</param>
        /// <param name="profileService">profile service to access profile information about users and parties</param>
        /// <param name="platformService">platform</param>
        /// <param name="appService">application service for accessing application metadata.</param>
        public DataController(
            IOptions <GeneralSettings> generalSettings,
            ILogger <DataController> logger,
            IRegister registerService,
            IInstance instanceService,
            IData dataService,
            IExecution executionService,
            IProfile profileService,
            IPlatformServices platformService,
            IApplication appService)
        {
            this.logger = logger;

            this.instanceService  = instanceService;
            this.dataService      = dataService;
            this.executionService = executionService;
            this.platformService  = platformService;
            this.appService       = appService;
            this.userHelper       = new UserHelper(profileService, registerService, generalSettings);
        }
Esempio n. 58
0
        public static TimberSection TimberSectionFromProfile(IProfile profile, Timber material = null, string name = "")
        {
            if (profile.IsNull())
            {
                return(null);
            }
            //Run pre-process for section create. Calculates all section constants and checks name of profile
            var preProcessValues = PreProcessSectionCreate(name, profile);

            name    = preProcessValues.Item1;
            profile = preProcessValues.Item2;
            Dictionary <string, double> constants = preProcessValues.Item3;

            TimberSection section = new TimberSection(profile,
                                                      constants["Area"], constants["Rgy"], constants["Rgz"], constants["J"], constants["Iy"], constants["Iz"], constants["Iw"], constants["Wely"],
                                                      constants["Welz"], constants["Wply"], constants["Wplz"], constants["CentreZ"], constants["CentreY"], constants["Vz"],
                                                      constants["Vpz"], constants["Vy"], constants["Vpy"], constants["Asy"], constants["Asz"]);

            return(PostProcessSectionCreate(section, name, material, MaterialType.Timber));
        }
Esempio n. 59
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessController"/>
        /// </summary>
        public ProcessController(
            ILogger <ProcessController> logger,
            IInstance instanceService,
            IProcess processService,
            IProfile profileService,
            IRegister registerService,
            IOptions <GeneralSettings> generalSettings,
            IAltinnApp altinnApp,
            IValidation validationService,
            IPDP pdp)
        {
            _logger            = logger;
            _instanceService   = instanceService;
            _processService    = processService;
            _altinnApp         = altinnApp;
            _validationService = validationService;
            _pdp = pdp;

            userHelper = new UserHelper(profileService, registerService, generalSettings);
        }
Esempio n. 60
0
        internal RemoverScriptGenerator(IBackupRemoverViewModel model, IProfile profile) : base(model, profile)
        {
            Script = Path.Combine(Folders.Cache, $"Cleaner_{profile.Website}_{DateTime.Now:yyyy-MM-dd}.ps1");

            executionScript = GenerateParameters(CommerceSitesParameters);

            if (model.WebsiteChecked)
            {
                GenerateFilesystemScript();
            }

            if (model.ProcessDatabases)
            {
                GenerateDatabaseScript();
            }

            ShowFinalOutput("Instance clean-up");

            SaveScriptToCacheFile();
        }