Example #1
0
 static void LoadDoW2UCS()
 {
     if (File.Exists(DoW2UCSPath))
     {
         LoggingManager.SendMessage("UCSManager - UCS file for vanilla DoW2 found.");
         if (s_dow2UCS == null)
         {
             FileStream ucs = null;
             try
             {
                 ucs       = File.Open(DoW2UCSPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                 s_dow2UCS = UCSReader.Read(ucs);
             }
             catch (CopeDoW2Exception ex)
             {
                 LoggingManager.HandleException(ex);
                 UIHelper.ShowError(ex.Message);
                 ModManager.RequestAppExit(ex.Message);
             }
             finally
             {
                 if (ucs != null)
                 {
                     ucs.Close();
                 }
             }
         }
     }
     else
     {
         LoggingManager.SendMessage("UCSManager - UCS file for vanilla DoW2 not found; we might operate in some strange place other than the DoW2 directory.");
     }
 }
Example #2
0
 static void OnModUnloaded()
 {
     SaveUCS();
     if (s_modUCS != null)
     {
         s_modUCS.StringAdded    -= OnStringAdded;
         s_modUCS.StringModified -= OnStringModified;
         s_modUCS.StringRemoved  -= OnStringRemoved;
         s_modUCS = null;
     }
     s_nextIndex = 0;
 }
Example #3
0
        static void LoadModUCS()
        {
            LoggingManager.SendMessage(
                "UCSManager - UCS file for current mod " + (File.Exists(ModUCSPath)
                                                                ? "found."
                                                                : "not found, will create a new one."));
            FileStream ucs = null;

            try
            {
                if (File.Exists(ModUCSPath))
                {
                    ucs      = File.Open(ModUCSPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                    s_modUCS = UCSReader.Read(ucs);
                }
                else
                {
                    s_modUCS = new UCSStrings();
                }
            }
            catch (CopeDoW2Exception ex)
            {
                LoggingManager.HandleException(ex);
                UIHelper.ShowError(ex.Message);
                ModManager.RequestAppExit(ex.Message);
            }
            finally
            {
                if (ucs != null)
                {
                    ucs.Close();
                }
            }

            if (s_modUCS.NextIndex > s_nextIndex)
            {
                s_nextIndex = s_modUCS.NextIndex;
            }
            else
            {
                s_modUCS.NextIndex = s_nextIndex;
            }
            s_modUCS.StringAdded    += OnStringAdded;
            s_modUCS.StringModified += OnStringModified;
            s_modUCS.StringRemoved  += OnStringRemoved;
        }
Example #4
0
 static void OnModLanguageChanged(object sender, string language)
 {
     s_dow2UCS = null;
 }
Example #5
0
 static void OnModUnloaded()
 {
     SaveUCS();
     if (s_modUCS != null)
     {
         s_modUCS.StringAdded -= OnStringAdded;
         s_modUCS.StringModified -= OnStringModified;
         s_modUCS.StringRemoved -= OnStringRemoved;
         s_modUCS = null;
     }
     s_nextIndex = 0;
 }
Example #6
0
 static void LoadDoW2UCS()
 {
     if (File.Exists(DoW2UCSPath))
     {
         LoggingManager.SendMessage("UCSManager - UCS file for vanilla DoW2 found.");
         if (s_dow2UCS == null)
         {
             FileStream ucs = null;
             try
             {
                 ucs = File.Open(DoW2UCSPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                 s_dow2UCS = UCSReader.Read(ucs);
             }
             catch (CopeDoW2Exception ex)
             {
                 LoggingManager.HandleException(ex);
                 UIHelper.ShowError(ex.Message);
                 ModManager.RequestAppExit(ex.Message);
             }
             finally
             {
                 if (ucs != null)
                     ucs.Close();
             }
         }
     }
     else
         LoggingManager.SendMessage("UCSManager - UCS file for vanilla DoW2 not found; we might operate in some strange place other than the DoW2 directory.");
 }
Example #7
0
        static void LoadModUCS()
        {
            LoggingManager.SendMessage(
                "UCSManager - UCS file for current mod " + (File.Exists(ModUCSPath)
                                                                ? "found."
                                                                : "not found, will create a new one."));
            FileStream ucs = null;
            try
            {
                if (File.Exists(ModUCSPath))
                {
                    ucs = File.Open(ModUCSPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                    s_modUCS = UCSReader.Read(ucs);
                }
                else
                    s_modUCS = new UCSStrings();
            }
            catch (CopeDoW2Exception ex)
            {
                LoggingManager.HandleException(ex);
                UIHelper.ShowError(ex.Message);
                ModManager.RequestAppExit(ex.Message);
            }
            finally
            {
                if (ucs != null)
                    ucs.Close();
            }

            if (s_modUCS.NextIndex > s_nextIndex)
                s_nextIndex = s_modUCS.NextIndex;
            else
                s_modUCS.NextIndex = s_nextIndex;
            s_modUCS.StringAdded += OnStringAdded;
            s_modUCS.StringModified += OnStringModified;
            s_modUCS.StringRemoved += OnStringRemoved;
        }
Example #8
0
 static void OnModLanguageChanged(object sender, string language)
 {
     s_dow2UCS = null;
 }