Example #1
0
        public static bool DeleteModFromDataFolder(string?fileName)
        {
            try
            {
                if (fileName == null)
                {
                    return(false);
                }

                Shrek2Utils.EnsureAddedModsFolderExists();

                var filePath = Path.Combine(Shrek2Utils.GetAddedModsFolderPath(), fileName);

                if (File.Exists(filePath) == false)
                {
                    return(true);
                }

                File.Delete(filePath);

                return(true);
            }
            catch (Exception ex)
            {
                Shrek2Utils.LogError(ex);
                return(false);
            }
        }
Example #2
0
        public static bool CopyModToDataFolder(string filePath, string uuid)
        {
            try
            {
                Shrek2Utils.EnsureAddedModsFolderExists();

                File.Copy(filePath, Path.Combine(Shrek2Utils.GetAddedModsFolderPath(), $"{uuid}{Path.GetExtension(filePath)}"));

                return(true);
            }
            catch (Exception ex)
            {
                Shrek2Utils.LogError(ex);
                return(false);
            }
        }