Пример #1
0
        public string GetApplicationUrl()
        {
            var applicationUrl = CurrentProfile.TryGetApplicationUrl();

            if (applicationUrl != null)
            {
                return(applicationUrl);
            }

            return("http://localhost:5000");
        }
Пример #2
0
 void ShowUserProfileDialog()
 {
     using (UserProfileForm form = new UserProfileForm(CurrentProfile))
     {
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             CurrentProfile.Assign(form.CurrentUser);
             VirtualAssistant.Plugins.GetPluginByType <SimlPlugin>().Bot.MainUser.Settings["Name"].Value = CurrentProfile.FirstName;
         }
     }
 }
Пример #3
0
 void Awake()
 {
     if (currentProfile == null)
     {
         DontDestroyOnLoad(gameObject);
         currentProfile = this;
     }
     else if (currentProfile != this)
     {
         Destroy(gameObject);
     }
 }
Пример #4
0
        private string GetDllPath()
        {
            var exename = "libsneshawk-32-" + CurrentProfile.ToLower() + ".dll";

            string dllPath = Path.Combine(CoreComm.CoreFileProvider.DllPath(), exename);

            if (!File.Exists(dllPath))
            {
                throw new InvalidOperationException("Couldn't locate the DLL for SNES emulation for profile: " + CurrentProfile + ". Please make sure you're using a fresh dearchive of a BizHawk distribution.");
            }

            return(dllPath);
        }
Пример #5
0
        private async Task DeleteIfExistsAsync(Hotkey hotkey)
        {
            if (CurrentProfile.DeleteHotkeyIfExisting(hotkey))
            {
                await _profileManager.SaveProfileAsync(CurrentProfile).ConfigureAwait(false);

                await _eventAggregator.PublishOnUIThreadAsync(new HotkeyModifiedEvent
                {
                    Hotkey        = hotkey,
                    ModifiedEvent = EHotkeyModifiedEvent.Deleted
                });
            }
        }
Пример #6
0
 public ApiFriendController(
     IProfileRepository profileRepo,
     IFriendRepository friendRepo,
     IImageRepository imageRepo,
     SessionResults sessionResults,
     CurrentProfile currentProfile)
 {
     this.profileRepo    = profileRepo;
     this.friendRepo     = friendRepo;
     this.imageRepo      = imageRepo;
     this.sessionResults = sessionResults;
     this.currentProfile = currentProfile;
 }
Пример #7
0
        /// <summary>
        /// On save click - beware some funky logic included here if user is trying to UPDATE an existing profile...
        /// </summary>
        private void btnSaveChanges_Click(object sender, EventArgs e)
        {
            updateProfileDataSource();
            updateFaultListDataSource();

            Page.Validate("MinimumProfileDetails");
            if (Page.IsValid)
            {
                try
                {
                    // get the currently Assigned vehicles (if any)
                    Fleetwood.BlueSphere.BusinessLogic.VehicleList assignedVehicles = CurrentProfile.VehicleList;

                    //when profiels are updated this actually creates a new one
                    Guid newProfileID = CurrentProfile.Update();
                    CurrentProfile = new Fleetwood.BlueSphere.BusinessLogic.SafetyCheckProfile(newProfileID);
                    foreach (Fleetwood.BlueSphere.BusinessLogic.FaultType item in CurrentProfileFaultList)
                    {
                        if (item.SafetyCheckProfileID != new Guid("00000000-0000-0000-0000-000000000000"))
                        {
                            Fleetwood.BlueSphere.BusinessLogic.FaultType clonedFault = item.Clone();
                            clonedFault.SafetyCheckProfileID = CurrentProfile.ID;
                            clonedFault.IsDeleted            = false;
                            clonedFault.Update();
                        }
                        else
                        {
                            item.SafetyCheckProfileID = CurrentProfile.ID;
                            item.Update();
                        }
                    }

                    // Now we need to re-ssign any vehicles that had the old Id to the new one.
                    ArrayList assignments = new ArrayList();
                    foreach (Fleetwood.BlueSphere.BusinessLogic.Vehicle v in assignedVehicles)
                    {
                        assignments.Add(v.ID);
                    }

                    CurrentProfile.AssignVehicles(assignments);

                    saveProfileError.Visible = false;
                    Response.Redirect(Request.RawUrl);
                }
                catch (Exception ex)
                {
                    saveProfileError.Visible   = true;
                    saveProfileError.InnerText = ex.Message;
                }
            }
        }
Пример #8
0
        public void UpdateTree()
        {
            if (!Initialized)
            {
                return;
            }

            tree = CurrentProfile.GenerateSimpleTree(new Random(seed));

            if (TreeUpdated != null)
            {
                TreeUpdated(this, EventArgs.Empty);
            }
        }
 public void selectProfile()
 {
     try
     {
         string         name           = profileDrop.options[profileDrop.value].text;
         CurrentProfile currentProfile = GameObject.Find("CurrentProfile").GetComponent <CurrentProfile>();
         currentProfile.profile = ProfileManagement.LoadProfile(name);
         profileMenu.SetActive(false);
         GameModeMenu.SetActive(true);
     }
     catch
     {
         StartCoroutine(EmptyName(5.0f));
     }
 }
Пример #10
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var scope = FocusManager.GetFocusScope(tabPanel);

            FocusManager.SetFocusedElement(scope, null);
            Keyboard.ClearFocus();

            if (CurrentSave != null)
            {
                CurrentSave.Save();
            }
            if (CurrentProfile != null)
            {
                CurrentProfile.Save();
            }
        }
Пример #11
0
 public void UpdateProfileFromCurrentModelSettings()
 {
     foreach (var account in this.KnownUserAccounts)
     {
         CurrentProfile.StoreAccountState(account.AccountName, account.AccountLaunchable);
         foreach (var server in account.Servers)
         {
             var charSetting = new CharacterSetting();
             charSetting.AccountName     = account.AccountName;
             charSetting.ServerName      = server.ServerName;
             charSetting.Active          = server.ServerSelected;
             charSetting.ChosenCharacter = server.ChosenCharacter;
             CurrentProfile.StoreCharacterSetting(charSetting);
         }
     }
 }
Пример #12
0
        public void Start()
        {
            if (CurrentProfile == null)
            {
                throw new InvalidOperationException("No profile has been selected");
            }

            CurrentProfile.Validate();

            if (!_active)
            {
                _active       = true;
                _mainLoopTask = new Task(MainLoop);
                _mainLoopTask.Start();
            }
        }
Пример #13
0
        public ActionResult NotificationLink(Guid Id)
        {
            Notification Not = reposetory.NotificationRead(Id, CurrentProfile.PersonID);

            if (Not != null)
            {
                CurrentProfile.Clear();
                switch (Not.Type)
                {
                case NotificationType.Folder:
                    return(RedirectToAction("FolderPlanning", "Planning", new { id = Not.Link, Area = "" }));

                    break;

                case NotificationType.Team:
                    return(RedirectToAction("View", "Planning", new { id = Not.Link, Area = "" }));

                    break;

                case NotificationType.Person:
                    return(RedirectToAction("View", "People", new { id = Not.Link, Area = "" }));

                    break;

                case NotificationType.NewVersion:
                    return(RedirectToAction("About", "Home", new { Area = "" }));

                    break;

                case NotificationType.Association:
                    return(RedirectToAction("Index", "Association", new { id = Not.Link, Area = "" }));

                    break;

                case NotificationType.Content:
                    return(RedirectToAction("Content", "Home", new { id = Not.Link, Area = "" }));

                    break;

                case NotificationType.AssociationNote:
                    return(RedirectToAction("View", "Association", new { id = Not.Link, Area = "Admin" }));

                    break;
                }
            }
            return(RedirectToAction("MyNotifications", "Notification", new { id = Not.NotificationID, Area = "" }));
        }
Пример #14
0
        public SaveTabViewModel(ITokenButtonFunctionProvider buttonFunctionProvider, ISelectedProfileProvider selectedProfileProvider,
                                ITranslationUpdater translationUpdater, EditionHelper editionHelper, ITokenHelper tokenHelper,
                                ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
            : base(translationUpdater, selectedProfileProvider, dispatcher)
        {
            AllowSkipPrintDialog    = !editionHelper.IsFreeEdition;
            _buttonFunctionProvider = buttonFunctionProvider;
            _tokenHelper            = tokenHelper;
            _tokenViewModelFactory  = tokenViewModelFactory;

            translationUpdater?.RegisterAndSetTranslation(tf => SetTokenViewModels());

            CurrentProfile?.MountRaiseConditionsForNotSupportedFeatureSections((s, a) =>
            {
                RaisePropertyChanged(nameof(HasNotSupportedSettingsForSavingTempOnly));
            });
        }
Пример #15
0
        public ConvertPdfViewModel(ITranslationUpdater translationUpdater, ISelectedProfileProvider selectedProfile,
                                    EditionHelper editionHelper, IDispatcher dispatcher) : base(translationUpdater, selectedProfile, dispatcher)
        {
            _editionHelper = editionHelper;
            CurrentProfileChanged += (sender, args) =>
            {
                RaiseIsPdfOutputChanged();
                CurrentProfile.PropertyChanged += RaiseIsPdfOutputChanged;
                CurrentProfile.SetRaiseConditionsForNotSupportedFeatureSections(RaiseIsPdfOutputChanged);
            };

            if (CurrentProfile == null)
                return;

            CurrentProfile.PropertyChanged += RaiseIsPdfOutputChanged;
            CurrentProfile.SetRaiseConditionsForNotSupportedFeatureSections(RaiseIsPdfOutputChanged);
        }
Пример #16
0
 public ApiCommentController(
     ICommentRepository commentRepo,
     IProfileRepository profileRepo,
     IImageRepository imageRepo,
     IFriendRepository friendRepo,
     ILikeRepository likeRepo,
     IPostRepository postRepo,
     SessionResults sessionResults,
     CurrentProfile currentProfile)
 {
     this.commentRepo    = commentRepo;
     this.profileRepo    = profileRepo;
     this.imageRepo      = imageRepo;
     this.friendRepo     = friendRepo;
     this.likeRepo       = likeRepo;
     this.postRepo       = postRepo;
     this.sessionResults = sessionResults;
     this.currentProfile = currentProfile;
 }
Пример #17
0
        private void AddProfileExcecute(object obj)
        {
            var name = QueryProfileName(null);

            if (name == null)
            {
                return;
            }

            var newProfile = CurrentProfile.Copy();

            newProfile.Guid = Guid.NewGuid().ToString();
            newProfile.Name = name;
            newProfile.Properties.Deletable = true;
            newProfile.Properties.Editable  = true;
            newProfile.Properties.Renamable = true;
            _profileCollection.ObservableCollection.Add(newProfile);
            ConversionProfilesView.MoveCurrentTo(newProfile);
        }
        private void AddProfileExcecute(object obj)
        {
            var name = QueryProfileName(null);

            if (name == null)
            {
                return;
            }

            var newProfile = CurrentProfile.Copy();

            newProfile.Guid = Guid.NewGuid().ToString();
            newProfile.Name = name;
            newProfile.Properties.Deletable = true;
            newProfile.Properties.Editable  = true;
            newProfile.Properties.Renamable = true;
            ProfileCollection.ObservableCollection.Add(newProfile);
            CurrentProfile = newProfile;
            RaisePropertyChanged(nameof(CurrentProfile));
        }
Пример #19
0
        internal bool UsingHttps()
        {
            var applicationUrl = CurrentProfile.TryGetApplicationUrl();

            if (!string.IsNullOrEmpty(applicationUrl))
            {
                return(applicationUrl.IndexOf("https://", StringComparison.OrdinalIgnoreCase) >= 0);
            }

            var environmentVariables = (IDictionary <string, string>)EnvironmentVariables;

            if (environmentVariables.TryGetValue("ASPNETCORE_URLS", out string applicationUrls))
            {
                if (applicationUrls != null)
                {
                    return(applicationUrls.IndexOf("https://", StringComparison.OrdinalIgnoreCase) >= 0);
                }
            }

            return(false);
        }
Пример #20
0
        private readonly IHostingEnvironment env; // Used to deal with server files.

        public ApiImageController(
            IImageRepository imageRepo,
            IPostRepository postRepo,
            ICommentRepository commentRepo,
            IProfileRepository profileRepo,
            ILikeRepository likeRepo,
            IFriendRepository friendRepo,
            SessionResults sessionResults,
            CurrentProfile currentProfile,
            IHostingEnvironment env)
        {
            this.imageRepo      = imageRepo;
            this.postRepo       = postRepo;
            this.commentRepo    = commentRepo;
            this.profileRepo    = profileRepo;
            this.likeRepo       = likeRepo;
            this.friendRepo     = friendRepo;
            this.sessionResults = sessionResults;
            this.currentProfile = currentProfile;
            this.env            = env;
        }
Пример #21
0
        private async Task <bool> DownloadCurrentProfileAsync()
        {
            var gameReleases = await CurrentProfile.GetAvailableReleasesAsync();

            if (gameReleases.Any())
            {
                var onlineRelease = gameReleases.First(release => release.Version == CurrentProfile.Version);

                switch (MessageBox.Show(string.Format(LocalizationUI.GetString("NotDownloaded"), CurrentProfile.Name), LocalizationUI.GetString("NotDownloadedTitle"), MessageBoxButtons.YesNo))
                {
                case DialogResult.Yes:
                    using (var directUpdater = new ReleaseDownloaderForm(onlineRelease.ReleaseAsset, CurrentProfile.Folder))
                    {
                        var state = directUpdater.ShowDialog();
                        return(state != DialogResult.Abort && state != DialogResult.Cancel);
                    }
                }
            }

            return(false);
        }
Пример #22
0
        //[ValidateAntiForgeryToken]
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
            {
                LogFile.Write(model.UserName.ToUpper() + " loged in < < <");
                CurrentProfile.Clear();
                if (!string.IsNullOrWhiteSpace(returnUrl) && Url.IsLocalUrl(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }

            // If we got this far, something failed, redisplay form
            LogFile.Write(model.UserName.ToUpper() + " failed login < < <");
            ModelState.AddModelError("", General.LoginError);
            return(View(model));
        }
Пример #23
0
        private async Task SaveOrEditAsync(Hotkey hotkey)
        {
            int result = CurrentProfile.AddOrEditHotkeyIfExisting(hotkey);

            if (result >= 0)
            {
                await _profileManager.SaveProfileAsync(CurrentProfile).ConfigureAwait(false);
            }

            switch (result)
            {
            case -1:
                CustomMessageDialog messageDialog
                    = new CustomMessageDialog("No more hotkey is available");
                messageDialog.ShowDialog();
                break;

            case 0:
                await _eventAggregator.PublishOnUIThreadAsync(new HotkeyModifiedEvent
                {
                    Hotkey        = hotkey,
                    ModifiedEvent = EHotkeyModifiedEvent.Modified
                });

                break;

            case 1:
                await _eventAggregator.PublishOnUIThreadAsync(new HotkeyModifiedEvent
                {
                    Hotkey        = hotkey,
                    ModifiedEvent = EHotkeyModifiedEvent.Added
                });

                break;

            default:
                break;
            }
        }
Пример #24
0
        public bool CopyProfile(string name)
        {
            Profile profile = (Profile)CurrentProfile.Clone();

            profile.Name = name;

            if (ProfileList.ContainsKey(profile.Name))
            {
                return(false);
            }

            ProfileList.Add(profile.Name, profile);

            if (!_profileHandler.Save(profile, AppDomain.CurrentDomain.BaseDirectory + "profiles\\" + profile.Name))
            {
                EventOnIOProfileFail.Invoke("Cannot save profile file: <" + profile.Name + ">",
                                            "Load profile exception");
                return(false);
            }

            return(true);
        }
        private void LoadProfile(string profileName)
        {
            string         previousProfileName = CurrentProfileName;
            ProfileManager mgr = new ProfileManager();

            try
            {
                if (string.IsNullOrEmpty(profileName))
                {
                    profileName = "Default";
                }
                CurrentProfile = mgr.Load(profileName);
                if (CurrentProfile == null && profileName != "Default")
                {
                    profileName    = "Default";
                    CurrentProfile = mgr.Load(profileName);
                }
                CurrentProfile.ActivateProfile();
            }
            catch
            {
                if (CurrentProfile == null)
                {
                    CurrentProfile = new Profile();
                }
            }
            finally
            {
                if (CurrentProfile == null)
                {
                    CurrentProfile = new Profile();
                }
            }
            ApplyCurrentProfileToModel();
            if (previousProfileName != CurrentProfileName)
            {
                OnPropertyChanged("CurrentProfileName");
            }
        }
Пример #26
0
        public ActionResult Setup(Person CU)
        {
            Person dbPerson = reposetory.GetPersonComplete(CurrentProfile.PersonID);

            if (CU == null | dbPerson.PersonID != CurrentProfile.PersonID)
            {
                return(HttpNotFound());
            }

            dbPerson.ListLines = CU.ListLines < 10 ? 10 : CU.ListLines;
            if (dbPerson.CurrentAssociation != CU.CurrentAssociation)
            {
                dbPerson.CurrentAssociation = CU.CurrentAssociation;
            }

            reposetory.SavePerson(dbPerson);
            CurrentProfile.Clear();
            ModelState.Clear();
            ViewBag.FormSucces = true;

            var Associations = dbPerson.Memberships.Select(d => new SelectListItem {
                Value = d.AssociationID.ToString(), Text = d.Association.Name
            }).ToList();

            if (Associations == null)
            {
                Associations = new List <SelectListItem>();
                Associations.Insert(0, new SelectListItem {
                    Value = Guid.Empty.ToString(), Text = General.DropDownEmpty
                });
            }
            if (Associations != null)
            {
                ViewBag.Associations = Associations;
            }
            return(View(CU));
        }
Пример #27
0
        public ActionResult Access(AccessModel access, string Action)
        {
            AccessModel dbAccess = reposetory.GetAccess(access.AssociationID);

            access.SelectPersons = dbAccess.SelectPersons;
            if (Action == "add")
            {
                if (access.Form == null)
                {
                    access.Form = new List <PersonAccess>();
                }
                if (!access.Form.Where(f => f.FunctionID == access.AddPerson).Any())
                {
                    access.Form.Add(new PersonAccess
                    {
                        FunctionID = access.AddPerson,
                    });
                }
            }


            foreach (PersonAccess p in access.Form)
            {
                p.FullName = access.SelectPersons.Find(ps => ps.FunctionID == p.FunctionID).FullName;
            }
            access.SelectPersons.RemoveAll(item => access.Form.Exists(p => p.FunctionID == item.FunctionID));

            if (Action == "Access" & ModelState.IsValid)
            {
                reposetory.SaveAccess(access.Form);
                ViewBag.FormSucces = true;
                CurrentProfile.Clear();
            }

            return(View(access));
        }
Пример #28
0
        protected override void Write(IPropertySet pset)
        {
            base.Write(pset);

            pset.SetValue(nameof(ExternalConsole), ExternalConsole, false);
            if (EnvironmentVariables.Count == 1 && EnvironmentVariables.ContainsKey("ASPNETCORE_ENVIRONMENT") && EnvironmentVariables ["ASPNETCORE_ENVIRONMENT"] == "Development")
            {
                pset.RemoveProperty(nameof(EnvironmentVariables));
            }

            if (CurrentProfile == null)
            {
                return;
            }

            CurrentProfile.EnvironmentVariables.Clear();
            foreach (var pair in EnvironmentVariables)
            {
                CurrentProfile.EnvironmentVariables [pair.Key] = pair.Value;
            }

            OnSaveRequested();

#pragma warning disable CS0618
            // persist values to Run Configuration for backward compatibility
            pset.SetValue(nameof(LaunchBrowser), CurrentProfile.LaunchBrowser, true);
            pset.SetValue(nameof(LaunchUrl), string.IsNullOrWhiteSpace(CurrentProfile.LaunchUrl) ? null : CurrentProfile.LaunchUrl, null);
            var appUrl = CurrentProfile.TryGetApplicationUrl();
            if (!string.IsNullOrEmpty(appUrl))
            {
                pset.SetValue(nameof(ApplicationURL), appUrl, "http://localhost:5000/");
            }
#pragma warning restore CS0618

            IsDirty = false;
        }
Пример #29
0
 public void ApplyCurrentProfileToModel()
 {
     foreach (var account in KnownUserAccounts)
     {
         account.AccountLaunchable = CurrentProfile.RetrieveAccountState(account.AccountName);;
         foreach (var server in account.Servers)
         {
             var charSetting = CurrentProfile.RetrieveCharacterSetting(accountName: account.AccountName, serverName: server.ServerName);
             if (charSetting != null)
             {
                 var    state        = _gameSessionMap.GetGameSessionStateByServerAccount(server.ServerName, account.AccountName);
                 string statusSymbol = GetStatusSymbol(state);
                 server.SetAccountServerStatus(state, statusSymbol);
                 server.ServerSelected  = charSetting.Active;
                 server.ChosenCharacter = charSetting.ChosenCharacter;
                 if (string.IsNullOrEmpty(server.ChosenCharacter))
                 {
                     server.ChosenCharacter = "None";
                 }
             }
         }
     }
     OnPropertyChanged("KnownUserAccounts");
 }
Пример #30
0
        public void Save()
        {
            Directory.CreateDirectory("profiles");
            Dictionary <string, object> value = new Dictionary <string, object>
            {
                {
                    "ST_Delay",
                    ST_Delay
                },
                {
                    "ST_ReconnectInterruptEnable",
                    ST_ReconnectInterruptEnable
                },
                {
                    "ST_ReconnectInterruptInterval",
                    ST_ReconnectInterruptInterval
                },
                {
                    "ST_EnableHotTimeProfile",
                    ST_EnableHotTimeProfile
                },
                {
                    "ST_EnableAutoProfile",
                    ST_EnableAutoProfile
                },
                {
                    "ST_EnableAutoShutdown",
                    ST_EnableAutoShutdown
                },
                {
                    "AD_Pause100",
                    AD_Pause100
                },
                {
                    "AD_NoHeroUp",
                    AD_NoHeroUp
                },
                {
                    "ST_EnableTelegram",
                    ST_EnableTelegram
                },
                {
                    "ST_EnableTelegramMsg1",
                    ST_EnableTelegramMsg1
                },
                {
                    "ST_TelegramWarnHT",
                    ST_TelegramWarnHT
                },
                {
                    "ST_TelegramWarnBoost",
                    ST_TelegramWarnBoost
                },
                {
                    "ST_HotTimeProfile",
                    ST_HotTimeProfile
                },
                {
                    "ST_BlueStacksForceActive",
                    ST_BlueStacksForceActive
                },
                {
                    "ST_TelegramToken",
                    ST_TelegramToken
                },
                {
                    "ST_LDTitle",
                    ST_LDTitle
                },
                {
                    "ST_TelegramChatID",
                    ST_TelegramChatID
                },
                {
                    "ST_ForegroundMode",
                    ST_ForegroundMode
                }
            };
            string data = JsonConvert.SerializeObject(value);

            File.WriteAllText(AIProfiles.FILE_PATH, data);
            CurrentProfile.Save(CurrentKey);
        }