Esempio n. 1
0
        public void SaveDefaultProfile(string profile_name)
        {
            profile_name = GetValidFilename(profile_name);

            if (Profiles.ContainsKey(profile_name))
            {
                MessageBoxResult result = MessageBox.Show("Profile already exists. Would you like to replace it?", "Aurora", MessageBoxButton.YesNo);

                if (result != MessageBoxResult.Yes)
                {
                    return;
                }

                Type setting_type = Settings.GetType();

                Profiles[profile_name] = (ProfileSettings)JsonConvert.DeserializeObject(
                    JsonConvert.SerializeObject(Settings, setting_type, new JsonSerializerSettings {
                }),
                    setting_type,
                    new JsonSerializerSettings {
                    ObjectCreationHandling = ObjectCreationHandling.Replace
                }
                    ); //I know this is bad. You can laugh at me for this one. :(
            }
            else
            {
                Profiles.Add(profile_name, Settings);
            }

            SaveProfiles();
        }
Esempio n. 2
0
        private InfoLinkNode ConvertLink(InfoLinkNode link)
        {
            var newLink = Profiles.ContainsKey(link.TargetId) ? link.WithType(InfoLinkKind.Profile) : link;

            if (link.Modifiers.Any())
            {
                MessagesCore.Add(new ConverterMessage(link, "The rule link has modifiers, all of which were copied without conversion and may cause problems."));
            }
            return(newLink);
        }
 public static Profile LoadProfile(string profileName)
 {
     if (Profiles.ContainsKey(profileName))
     {
         // Update default and save to system
         DefaultProfile = profileName;
         SaveProfilesToSystem();
         return(Profiles[profileName]);
     }
     return(null);
 }
Esempio n. 4
0
 /// <summary>
 /// Starts the profile with the given name.
 /// </summary>
 /// <param name="name">The name of the profile.</param>
 public static void Start(string name)
 {
     lock ( _instance )
     {
         if (!Profiles.ContainsKey(name))
         {
             Profiles.Add(name, new Profile());
         }
         Profiles[name].Start();
     }
 }
 public void AddNewProfile(string forgeVersion, string installationName)
 {
     if (Profiles.ContainsKey("BuddyPals") == false)
     {
         LauncherProfile newProfile = new LauncherProfile("Furnace", "2019-11-27T01:40:56.781Z", forgeVersion, installationName, "custom", javaArgs: "-Xmx4G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M");
         Profiles.Add("BuddyPals", newProfile);
     }
     else
     {
         Profiles["BuddyPals"].UpdateForge(forgeVersion, installationName);
     }
 }
 public static void SaveProfile(string name, Profile profile)
 {
     VerifyLegalName(name);
     if (Profiles.ContainsKey(name))
     {
         Profiles[name] = profile;
     }
     else
     {
         Profiles.Add(name, profile);
     }
     DefaultProfile = name;
     SaveProfilesToSystem();
 }
Esempio n. 7
0
 /// <summary>
 /// Starts the profile with the given name.
 /// </summary>
 /// <param name="name">The name of the profile.</param>
 public static void Stop(string name)
 {
     lock ( _instance )
     {
         if (Profiles.ContainsKey(name))
         {
             Profile profile = Profiles[name];
             if (profile.IsRunning)
             {
                 profile.Stop();
             }
         }
     }
 }
        internal void FixPortNumbers()
        {
            if (Profiles.ContainsKey(defaultNamespace))
            {
                var applicationUrl = DefaultProfile.OtherSettings ["applicationUrl"] as string;

                if (ShouldGenerateNewPort(applicationUrl))
                {
                    applicationUrl = applicationUrl.Replace(defaultHttpUrl, "http://localhost:" + GetNextFreePort());
                    applicationUrl = applicationUrl.Replace(defaultHttpsUrl, "https://localhost:" + GetNextFreePort());
                    DefaultProfile.OtherSettings ["applicationUrl"] = applicationUrl;
                    SaveLaunchSettings();
                }
            }
        }
 public static void DeleteProfile(string profileName)
 {
     if (Profiles.ContainsKey(profileName))
     {
         Profiles.Remove(profileName);
         if (DefaultProfile == profileName)
         {
             if (Profiles.Count > 0)
             {
                 DefaultProfile = Profiles.Keys.First();
             }
             else
             {
                 DefaultProfile = "";
             }
         }
         SaveProfilesToSystem();
     }
 }
Esempio n. 10
0
        public Player(int _id, string _name)
        {
            Id   = _id;
            Name = _name;
            Vote = -1;

            if (Profiles.ContainsKey(Name))
            {
                Profile p = Profiles[Name];
                IsMod = p.IsMod;
            }
            else
            {
                IsMod = false;

                Profiles.Add(Name, new Profile(Name));
                saveProfiles();
            }
        }
        public override void LoadProfiles()
        {
            string profiles_path = GetProfileFolderPath();

            if (Directory.Exists(profiles_path))
            {
                this.LoadScripts(profiles_path);

                foreach (string profile in Directory.EnumerateFiles(profiles_path, "*.json", SearchOption.TopDirectoryOnly))
                {
                    string profile_name = Path.GetFileNameWithoutExtension(profile);

                    if (profile_name.Equals("app_info"))
                    {
                        continue;
                    }

                    ProfileSettings profile_settings = LoadProfile(profile);

                    if (profile_settings != null)
                    {
                        this.InitalizeScriptSettings(profile_settings);

                        if (profile_name.Equals("default"))
                        {
                            Settings = profile_settings;
                        }
                        else
                        {
                            if (!Profiles.ContainsKey(profile_name))
                            {
                                Profiles.Add(profile_name, profile_settings);
                            }
                        }
                    }
                }
            }
            else
            {
                Global.logger.LogLine(string.Format("Profiles directory for {0} does not exist.", Name), Logging_Level.Info, false);
            }
        }
Esempio n. 12
0
        public void SwitchToProfile(string profile_name)
        {
            if (Profiles.ContainsKey(profile_name))
            {
                Type setting_type = Profiles[profile_name].GetType();

                Settings = (ProfileSettings)JsonConvert.DeserializeObject(
                    JsonConvert.SerializeObject(Profiles[profile_name], setting_type, new JsonSerializerSettings {
                }),
                    setting_type,
                    new JsonSerializerSettings {
                    ObjectCreationHandling = ObjectCreationHandling.Replace
                }
                    ); //I know this is bad. You can laugh at me for this one. :(

                if (ProfileChanged != null)
                {
                    ProfileChanged(this, new EventArgs());
                }
            }
        }