Пример #1
0
        /// <summary>
        /// Runs Elsword Directly.
        /// This is an blocking call that has to run in an separate thread from Els_kom's main thread.
        /// NEVER UNDER ANY CIRCUMSTANCES RUN THIS IN THE MAIN THREAD, YOU WILL DEADLOCK ELS_KOM!!!.
        /// </summary>
        internal static void RunElswordDirectly()
        {
            ExecutingElsword = true;
            if (File.Exists(SettingsFile.Path))
            {
                SettingsFile.Settingsxml?.ReopenFile();
                ElsDir = SettingsFile.Settingsxml?.TryRead("ElsDir");
                if (ElsDir.Length > 0)
                {
                    if (File.Exists(ElsDir + "\\data\\x2.exe"))
                    {
                        RunningElswordDirectly = true;
                        Shell(ElsDir + "\\data\\x2.exe", "pxk19slammsu286nfha02kpqnf729ck", false, false, false, false, ProcessWindowStyle.Normal, ElsDir + "\\data\\", true);
                        RunningElswordDirectly = false;
                    }
                    else
                    {
                        MessageManager.ShowError("Can't find '" + ElsDir + "\\data\\x2.exe'. Make sure the File Exists and try to Test your mods Again!", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                    }
                }
                else
                {
                    MessageManager.ShowError("The Elsword Directory Setting is not set. Make sure to Set your Elsword Directory Setting and try to Test your mods Again!", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                }
            }
            else
            {
                MessageManager.ShowError("The Elsword Directory Setting is not set. Make sure to Set your Elsword Directory Setting and try to Test your mods Again!", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
            }

            // avoid bad UI bug.
            ExecutingElsword = ExecutingElsword ? false : ExecutingElsword;
        }
Пример #2
0
 /// <summary>
 /// Runs Elsword Directly.
 /// This is an blocking call that has to run in an separate thread from Els_kom's main thread.
 /// NEVER UNDER ANY CIRCUMSTANCES RUN THIS IN THE MAIN THREAD, YOU WILL DEADLOCK ELS_KOM!!!
 /// </summary>
 public static void RunElswordDirectly()
 {
     if (System.IO.File.Exists(System.Windows.Forms.Application.StartupPath + "\\Settings.ini"))
     {
         INIObject settingsini = new INIObject(System.Windows.Forms.Application.StartupPath + "\\Settings.ini");
         ElsDir = settingsini.Read("Settings.ini", "ElsDir");
         if (ElsDir.Length > 0)
         {
             if (System.IO.File.Exists(ElsDir + "\\data\\x2.exe"))
             {
                 RunningElswordDirectly = true;
                 Shell(ElsDir + "\\data\\x2.exe", "pxk19slammsu286nfha02kpqnf729ck", false, false, false, false, System.Diagnostics.ProcessWindowStyle.Normal, ElsDir + "\\data\\", true);
                 RunningElswordDirectly = false;
             }
             else
             {
                 MessageManager.ShowError("Can't find '" + ElsDir + "\\data\\x2.exe'. Make sure the File Exists and try to Test your mods Again!", "Error!");
             }
         }
         else
         {
             MessageManager.ShowError("The Elsword Directory Setting is not set. Make sure to Set your Elsword Directory Setting and try to Test your mods Again!", "Error!");
         }
     }
     else
     {
         MessageManager.ShowError("The Elsword Directory Setting is not set. Make sure to Set your Elsword Directory Setting and try to Test your mods Again!", "Error!");
     }
 }
Пример #3
0
        /// <summary>
        /// Packs KOM files by invoking the packer.
        /// </summary>
        internal static void PackKoms()
        {
            PackingState = true;
            var di = new DirectoryInfo(Application.StartupPath + "\\koms");

            foreach (var dri in di.GetDirectories())
            {
                var kom_data_folder = dri.Name;
                var kom_ver         = CheckFolderVersion(Application.StartupPath + "\\koms\\" + kom_data_folder);
                if (kom_ver != 0)
                {
                    var kom_file = kom_data_folder + ".kom";

                    // pack kom based on the version of kom supplied.
                    if (kom_ver != -1)
                    {
                        foreach (var komplugin in KOMStream.Komplugins)
                        {
                            try
                            {
                                if (kom_ver == komplugin.SupportedKOMVersion)
                                {
                                    komplugin.Pack(Application.StartupPath + "\\koms\\" + kom_data_folder, Application.StartupPath + "\\koms\\" + kom_file, kom_file);

                                    // delete unpacked kom folder data.
                                    komplugin.Delete(Application.StartupPath + "\\koms\\" + kom_data_folder, true);
                                }
                            }
                            catch (NotPackableException)
                            {
                                // do not delete kom data folder.
                                using (File.Create(Application.StartupPath + "\\koms\\" + kom_data_folder + "\\KOMVERSION." + komplugin.SupportedKOMVersion))
                                {
                                }

                                MessageManager.ShowError("Packing an folder to an KOM file failed.", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                            }
                            catch (NotImplementedException)
                            {
                                using (File.Create(Application.StartupPath + "\\koms\\" + kom_data_folder + "\\KOMVERSION." + komplugin.SupportedKOMVersion))
                                {
                                }

                                MessageManager.ShowError("The KOM V" + komplugin.SupportedKOMVersion + " plugin does not implement an packer function yet. Although it should.", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                            }
                        }
                    }
                    else
                    {
                        MessageManager.ShowError("An error occured while packing the file(s) to an KOM file.", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                    }
                }
                else
                {
                    MessageManager.ShowError("Unknown KOM version Detected. Please send this KOM to the Els_kom Developers file for inspection.", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                }
            }

            PackingState = false;
        }
Пример #4
0
        /// <summary>
        /// Runs Elsword Launcher.
        /// This is an blocking call that has to run in an separate thread from Els_kom's main thread.
        /// NEVER UNDER ANY CIRCUMSTANCES RUN THIS IN THE MAIN THREAD, YOU WILL DEADLOCK ELS_KOM!!!.
        /// </summary>
        internal static void RunElswordLauncher()
        {
            // for the sake of sanity and the need to disable the pack, unpack, and test mods
            // buttons in UI while updating game.
            ExecutingElsword = true;
            if (File.Exists(SettingsFile.Path))
            {
                SettingsFile.Settingsxml?.ReopenFile();
                ElsDir = SettingsFile.Settingsxml?.TryRead("ElsDir");
                if (ElsDir.Length > 0)
                {
                    if (File.Exists(ElsDir + "\\voidels.exe"))
                    {
                        RunningElsword = true;
                        Shell(ElsDir + "\\voidels.exe", string.Empty, false, false, false, false, ProcessWindowStyle.Normal, ElsDir, true);
                        RunningElsword = false;
                    }
                    else
                    {
                        if (File.Exists(ElsDir + "\\elsword.exe"))
                        {
                            RunningElsword = true;
                            Shell(ElsDir + "\\elsword.exe", string.Empty, false, false, false, false, ProcessWindowStyle.Normal, ElsDir, true);
                            RunningElsword = false;
                        }
                        else
                        {
                            MessageManager.ShowError("Can't find '" + ElsDir + "\\elsword.exe'. Make sure the File Exists and try to update Elsword Again!", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                        }
                    }
                }
                else
                {
                    MessageManager.ShowError("The Elsword Directory Setting is not set. Make sure to Set your Elsword Directory Setting and try to update Elsword Again!", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                }
            }
            else
            {
                MessageManager.ShowError("The Elsword Directory Setting is not set. Make sure to Set your Elsword Directory Setting and try to update Elsword Again!", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
            }

            // avoid bad UI bug.
            ExecutingElsword = ExecutingElsword ? false : ExecutingElsword;
        }
Пример #5
0
 /// <summary>
 /// Runs Elsword Launcher.
 /// This is an blocking call that has to run in an separate thread from Els_kom's main thread.
 /// NEVER UNDER ANY CIRCUMSTANCES RUN THIS IN THE MAIN THREAD, YOU WILL DEADLOCK ELS_KOM!!!
 /// </summary>
 public static void RunElswordLauncher()
 {
     if (System.IO.File.Exists(System.Windows.Forms.Application.StartupPath + "\\Settings.ini"))
     {
         INIObject settingsini = new INIObject(System.Windows.Forms.Application.StartupPath + "\\Settings.ini");
         ElsDir = settingsini.Read("Settings.ini", "ElsDir");
         if (ElsDir.Length > 0)
         {
             if (System.IO.File.Exists(ElsDir + "\\voidels.exe"))
             {
                 RunningElsword = true;
                 Shell(ElsDir + "\\voidels.exe", "", false, false, false, false, System.Diagnostics.ProcessWindowStyle.Normal, ElsDir, true);
                 RunningElsword = false;
             }
             else
             {
                 if (System.IO.File.Exists(ElsDir + "\\elsword.exe"))
                 {
                     RunningElsword = true;
                     Shell(ElsDir + "\\elsword.exe", "", false, false, false, false, System.Diagnostics.ProcessWindowStyle.Normal, ElsDir, true);
                     RunningElsword = false;
                 }
                 else
                 {
                     MessageManager.ShowError("Can't find '" + ElsDir + "\\elsword.exe'. Make sure the File Exists and try to update Elsword Again!", "Error!");
                 }
             }
         }
         else
         {
             MessageManager.ShowError("The Elsword Directory Setting is not set. Make sure to Set your Elsword Directory Setting and try to update Elsword Again!", "Error!");
         }
     }
     else
     {
         MessageManager.ShowError("The Elsword Directory Setting is not set. Make sure to Set your Elsword Directory Setting and try to update Elsword Again!", "Error!");
     }
 }
Пример #6
0
        /// <summary>
        /// Unpacks KOM files by invoking the extractor.
        /// </summary>
        internal static void UnpackKoms()
        {
            UnpackingState = true;
            var di = new DirectoryInfo(Application.StartupPath + "\\koms");

            foreach (var fi in di.GetFiles("*.kom"))
            {
                var kom_file = fi.Name;
                var kom_ver  = GetHeaderVersion(kom_file);
                if (kom_ver != 0)
                {
                    // remove ".kom" on end of string.
                    var kom_data_folder = Path.GetFileNameWithoutExtension(Application.StartupPath + "\\koms\\" + kom_file);
                    foreach (var komplugin in KOMStream.Komplugins)
                    {
                        try
                        {
                            if (kom_ver == komplugin.SupportedKOMVersion)
                            {
                                komplugin.Unpack(Application.StartupPath + "\\koms\\" + kom_file, Application.StartupPath + "\\koms\\" + kom_data_folder, kom_file);
                            }
                            else
                            {
                                // loop until the right plugin for this kom version is found.
                                continue;
                            }

                            // make the version dummy file for the packer.
                            try
                            {
                                using (File.Create(Application.StartupPath + "\\koms\\" + kom_data_folder + "\\KOMVERSION." + kom_ver))
                                {
                                }
                            }
                            catch (DirectoryNotFoundException)
                            {
                                // cannot create this since nothing was written or made.
                            }

                            // delete original kom file.
                            komplugin.Delete(Application.StartupPath + "\\koms\\" + kom_file, false);
                        }
                        catch (NotUnpackableException)
                        {
                            // do not delete kom file.
                            MessageManager.ShowError("Unpacking this KOM file failed.", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                        }
                        catch (NotImplementedException)
                        {
                            MessageManager.ShowError("The KOM V" + komplugin.SupportedKOMVersion + " plugin does not implement an unpacker function yet. Although it should.", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                        }
                    }
                }
                else
                {
                    MessageManager.ShowError("Unknown KOM version Detected. Please send this KOM to the Els_kom Developers file for inspection.", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                }
            }

            UnpackingState = false;
        }