public Config(string filePath)
        {
            Instance = this;
            FilePath = filePath;

            if (!Directory.Exists(Path.GetDirectoryName(FilePath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(FilePath));
            }

            if (File.Exists(FilePath))
            {
                Load();

                if (File.ReadAllText(FilePath).Contains("TwitchChannel="))
                {
                    var oldConfig = new OldConfigOptions();
                    ConfigSerializer.LoadConfig(oldConfig, FilePath);

                    TwitchChannelName = oldConfig.TwitchChannel;
                }
            }
            CorrectConfigSettings();
            Save();

            _configWatcher = new FileSystemWatcher(Path.Combine(Environment.CurrentDirectory, "UserData"))
            {
                NotifyFilter        = NotifyFilters.LastWrite,
                Filter              = "EnhancedTwitchChat.ini",
                EnableRaisingEvents = true
            };
            _configWatcher.Changed += ConfigWatcherOnChanged;
        }
        public PreviousConfig(string filePath)
        {
            FilePath = filePath;

            if (!Directory.Exists(Path.GetDirectoryName(FilePath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(FilePath));
            }

            if (File.Exists(FilePath))
            {
                ConfigSerializer.LoadConfig(this, FilePath);
            }
        }
Exemple #3
0
        private void AppendToBlacklist(string path)
        {
            string text = File.ReadAllText(path);

            if (text.Contains("SongBlacklist="))
            {
                var oldConfig = new OldBlacklistOption();
                ConfigSerializer.LoadConfig(oldConfig, path);

                if (oldConfig.SongBlacklist.Length > 0)
                {
                    File.AppendAllText(Path.Combine(Globals.DataPath, "SongBlacklistMigration.list"), oldConfig.SongBlacklist + ",");
                }
            }
        }
        public void Load()
        {
            ConfigSerializer.LoadConfig(this, FilePath);
            if (TwitchChannel.Length > 0)
            {
                TwitchChannel = TwitchChannel.ToLower().Replace(" ", "");
            }
            //else {
            //TwitchChannel = TwitchUsername;
            //}
            if (BackgroundPadding < 0)
            {
                BackgroundPadding = 0;
            }

            if (MaxMessages < 1)
            {
                MaxMessages = 1;
            }
        }
Exemple #5
0
        public Config(string filePath)
        {
            FilePath = filePath;

            if (!Directory.Exists(Path.GetDirectoryName(FilePath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(FilePath));
            }

            if (File.Exists(FilePath))
            {
                Load();
                var text = File.ReadAllText(FilePath);
                if (!text.Contains("fitToCanvas") && Path.GetFileName(FilePath) == "cameraplus.cfg")
                {
                    fitToCanvas = true;
                }
                if (text.Contains("rotx"))
                {
                    var oldRotConfig = new OldRotConfig();
                    ConfigSerializer.LoadConfig(oldRotConfig, FilePath);

                    var euler = new Quaternion(oldRotConfig.rotx, oldRotConfig.roty, oldRotConfig.rotz, oldRotConfig.rotw).eulerAngles;
                    angx = euler.x;
                    angy = euler.y;
                    angz = euler.z;
                }
            }
            Save();

            _configWatcher = new FileSystemWatcher(Path.GetDirectoryName(FilePath))
            {
                NotifyFilter        = NotifyFilters.LastWrite,
                Filter              = Path.GetFileName(FilePath),
                EnableRaisingEvents = true
            };
            _configWatcher.Changed += ConfigWatcherOnChanged;
        }
Exemple #6
0
        public RootConfig(string filePath)
        {
            FilePath = filePath;

            if (!Directory.Exists(Path.GetDirectoryName(FilePath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(FilePath));
            }

            if (File.Exists(FilePath))
            {
                ConfigSerializer.LoadConfig(this, FilePath);
            }

            PluginConfig.Instance.ProfileSceneChange    = ProfileSceneChange;
            PluginConfig.Instance.MenuProfile           = MenuProfile;
            PluginConfig.Instance.GameProfile           = GameProfile;
            PluginConfig.Instance.RotateProfile         = RotateProfile;
            PluginConfig.Instance.MultiplayerProfile    = MultiplayerProfile;
            PluginConfig.Instance.ProfileLoadCopyMethod = ProfileLoadCopyMethod;
            PluginConfig.Instance.CameraQuadLayer       = CameraQuadLayer;
            PluginConfig.Instance.ScreenFillBlack       = ScreenFillBlack;
        }
Exemple #7
0
        public Config(string filePath)
        {
            FilePath = filePath;

            if (File.Exists(FilePath))
            {
                Load();
                var text = File.ReadAllText(FilePath);
                if (text.Contains("rotx"))
                {
                    var oldRotConfig = new OldRotConfig();
                    ConfigSerializer.LoadConfig(oldRotConfig, FilePath);

                    var euler = new Quaternion(oldRotConfig.rotx, oldRotConfig.roty, oldRotConfig.rotz,
                                               oldRotConfig.rotw)
                                .eulerAngles;
                    angx = euler.x;
                    angy = euler.y;
                    angz = euler.z;

                    Save();
                }
            }
            else
            {
                Save();
            }

            _configWatcher = new FileSystemWatcher(Environment.CurrentDirectory)
            {
                NotifyFilter        = NotifyFilters.LastWrite,
                Filter              = "cameraplus.cfg",
                EnableRaisingEvents = true
            };
            _configWatcher.Changed += ConfigWatcherOnChanged;
        }
Exemple #8
0
 public void Load()
 {
     ConfigSerializer.LoadConfig(this, FilePath);
 }
Exemple #9
0
        public void Load()
        {
            ConfigSerializer.LoadConfig(this, FilePath);

            CorrectConfigSettings();
        }
Exemple #10
0
        public ChatConfig()
        {
            Instance       = this;
            _configWatcher = new FileSystemWatcher();
            Task.Run(() =>
            {
                while (!Directory.Exists(Path.GetDirectoryName(FilePath)))
                {
                    Thread.Sleep(100);
                }

                Plugin.Log("FilePath exists! Continuing initialization!");

                string oldFilePath   = Path.Combine(Environment.CurrentDirectory, "UserData", "EnhancedTwitchChat.ini");
                string newerFilePath = Path.Combine(Globals.DataPath, "EnhancedTwitchChat.ini");
                if (File.Exists(newerFilePath))
                {
                    // Append the data to the blacklist, if any blacklist info exists, then dispose of the old config file.
                    AppendToBlacklist(newerFilePath);
                    if (!File.Exists(FilePath))
                    {
                        File.Move(newerFilePath, FilePath);
                    }
                    else
                    {
                        File.Delete(newerFilePath);
                    }
                }
                else if (File.Exists(oldFilePath))
                {
                    // Append the data to the blacklist, if any blacklist info exists, then dispose of the old config file.
                    AppendToBlacklist(oldFilePath);
                    if (!File.Exists(FilePath))
                    {
                        File.Move(oldFilePath, FilePath);
                    }
                    else
                    {
                        File.Delete(oldFilePath);
                    }
                }

                if (File.Exists(FilePath))
                {
                    Load();

                    var text = File.ReadAllText(FilePath);
                    if (text.Contains("TwitchUsername="******"{Plugin.ModuleName.Replace(" ", "")}.ini";
                _configWatcher.EnableRaisingEvents = true;

                _configWatcher.Changed += ConfigWatcherOnChanged;
            });
        }
 public void Load()
 {
     ConfigSerializer.LoadConfig(this, FilePath);
     CompileChargeCostString();
 }
Exemple #12
0
 public void Load()
 {
     ConfigSerializer.LoadConfig(this, FilePath);
     Console.WriteLine(Plugin.modLog + "BeFit UserConfigs Loaded");
 }