コード例 #1
0
 internal string GetPath()
 {
     if (CountryAdministrator.ConsiderOldAddOnFileStructure(_isAddOn))
     {
         return(EMPath.Folder_AddOns(EM_AppContext.FolderEuromodFiles));
     }
     else
     {
         return(EMPath.AddSlash((_isAddOn ? EMPath.Folder_AddOns(EM_AppContext.FolderEuromodFiles) : EMPath.Folder_Countries(EM_AppContext.FolderEuromodFiles)) + _shortName));
     }
 }
コード例 #2
0
        internal static bool CopyXMLFiles(string shortName, out string errorMessage,
                                          string sourceFolder = "", string destinationFolder = "", int addOn = -1)
        {
            try
            {
                bool   isAddOn       = addOn == -1 ? CountryAdministrator.IsAddOn(shortName) : (addOn == 0 ? false : true);
                string defaultFolder = isAddOn ? EMPath.Folder_AddOns(EM_AppContext.FolderEuromodFiles) : EMPath.Folder_Countries(EM_AppContext.FolderEuromodFiles);
                if (!CountryAdministrator.ConsiderOldAddOnFileStructure(isAddOn))
                {
                    defaultFolder += shortName;
                }

                if (destinationFolder == string.Empty)
                {
                    destinationFolder = defaultFolder;
                }
                if (sourceFolder == string.Empty)
                {
                    sourceFolder = defaultFolder;
                }

                File.Copy(EMPath.AddSlash(sourceFolder) + GetCountryXMLFileName(shortName),
                          EMPath.AddSlash(destinationFolder) + GetCountryXMLFileName(shortName), true);
                if (!isAddOn)
                {
                    File.Copy(EMPath.AddSlash(sourceFolder) + GetDataConfigXMLFileName(shortName),
                              EMPath.AddSlash(destinationFolder) + GetDataConfigXMLFileName(shortName), true);
                }

                errorMessage = string.Empty;
                return(true);
            }
            catch (Exception exception)
            {
                errorMessage = exception.Message;
                return(false);
            }
        }