예제 #1
0
        public void LoadAllModsInDirectory()
        {
            var directories = Directory.GetDirectories(Path.GetDirectoryName(ConfigHolder.GetProcessPath()));

            foreach (string s in directories)
            {
                if (ConfigHolder.IsModFolder(ConfigHolder.ShortenModPath(s)))
                {
                    if (AddMod(s))
                    {
                        window.AddItemToList(window.ModList, ConfigHolder.ShortenModPath(s));
                    }
                }
            }
        }
예제 #2
0
        public void LoadGUI()
        {
            window.ProcessTextBox.Text              = ConfigHolder.GetProcessPath();
            window.KillNonRespProcessBox.IsChecked  = ConfigHolder.killNonRespProcess;
            window.StartServerWithToolBox.IsChecked = ConfigHolder.startServerOnStartup;

            foreach (string s in ConfigHolder.GetParameters())
            {
                window.AddItemToList(window.ParameterList, s);
            }
            foreach (string s in ConfigHolder.GetMods())
            {
                window.AddItemToList(window.ModList, ConfigHolder.ShortenModPath(s));
            }
            WriteToConsole("Config files loaded");
        }
예제 #3
0
        public static string GetProcessName()
        {
            string name    = Path.GetFileName(ConfigHolder.GetProcessPath());
            string newName = "";

            for (int i = 0; i < name.Length; i++)
            {
                if (name[i] == char.Parse("."))
                {
                    break;
                }
                else
                {
                    newName += name[i];
                }
            }

            return(newName);
        }
예제 #4
0
        public static string StartServer()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.FileName  = ConfigHolder.GetProcessPath();
            startInfo.Arguments = ReadParameters() + " " + ReadMods();

            Process process = new Process();

            process.StartInfo = startInfo;
            process.Start();

            if (!process.Responding)
            {
                process.Kill();
            }

            Logger.WriteToLogFile("Starting server with parameters: " + ReadParameters() + " " + ReadMods());

            return(ReadParameters() + " " + ReadMods());
        }
예제 #5
0
 public void PrintProcessDirectory()
 {
     WriteToConsole(Path.GetFullPath(ConfigHolder.GetProcessPath()));
 }
예제 #6
0
 private string GetProcessDirectory()
 {
     return(Path.GetDirectoryName(ConfigHolder.GetProcessPath()) + @"\");
 }