public bool ImportPackages(GameModel model)
        {
            if (model == null)
            {
                throw new ArgumentException("model argument cannot be null");
            }
            if (Directory.Exists(ConfigurationManager.GetImportPath(model)))
            {
                IFileSystemManager fs = GetFileSystem(model);
                bool IsOpened         = false;
                try {
                    IsOpened = fs.Open(FileAccess.Write, 16, ConfigurationManager.GetHFPath(model), ConfigurationManager.GetPFPath(model));
                } catch {
                    IsOpened = false;
                }

                if (!IsOpened)
                {
                    OnFileSystemOpenError();
                    return(false);
                }
                try {
                    return(fs.WriteDirectory(ConfigurationManager.GetImportPath(model), true));
                } finally {
                    fs.Close();
                }
            }
            return(true);
        }
Esempio n. 2
0
 /// <summary>
 /// Активация страницы. При активации нам необходимо проверить не загружено ли изображение.
 /// Если не загружено и загружен список ресурсов - загружаем изображение
 /// </summary>
 protected override void OnShow()
 {
     try {
         GameModel model = ProfileManager.CurrentProfile.GameModel;
         FileSystem.Open(FileAccess.ReadWrite, 16, ConfigurationManager.GetHFPath(model), ConfigurationManager.GetPFPath(model));
         if (!IsGameImageLoaded && ItemsComboBox.Items.Count > 0)
         {
             if (ItemsComboBox.SelectedIndex == 0)
             {
                 OnSelectionChanged(ItemsComboBox, null);
             }
             else
             {
                 ItemsComboBox.SelectedIndex = 0;
             }
         }
     } catch {
         DialogManager.ShowMessageDialog(LanguageManager.Model.PleaseCloseGame, LanguageManager.Model.GameFilesInUse);
     }
 }