public void Init()
 {
     // MAKE SURE before you run this test, you MUST change the API key to yours; otherwise the test fails.
     this._settings = ConverterSettings.CreateInstance();
     this._formats = new Formats();
     this._wrapper = new ConverterWrapper(this._settings);
     
     this._input = new InputParameters()
                   {
                       InputFormat = this._formats.Website.Website,
                       InputMethod = InputMethod.Url,
                       Filepath = "http://www.google.com"
                   };
     this._output = new OutputParameters()
                    {
                        DownloadMethod = DownloadMethod.False,
                        OutputStorage = OutputStorage.None,
                        Wait = true
                    };
     this._conversion = new ConversionParameters()
                        {
                            OutputFormat = this._formats.Document.Pdf,
                            ConverterOptions = null
                        };
 }
Esempio n. 2
0
        public void Init()
        {
            // MAKE SURE before you run this test, you MUST change the API key to yours; otherwise the test fails.
            this._settings = ConverterSettings.CreateInstance();
            this._formats  = new Formats();
            this._wrapper  = new ConverterWrapper(this._settings);

            this._input = new InputParameters()
            {
                InputFormat = this._formats.Website.Website,
                InputMethod = InputMethod.Url,
                Filepath    = "http://www.google.com"
            };
            this._output = new OutputParameters()
            {
                DownloadMethod = DownloadMethod.False,
                OutputStorage  = OutputStorage.None,
                Wait           = true
            };
            this._conversion = new ConversionParameters()
            {
                OutputFormat     = this._formats.Document.Pdf,
                ConverterOptions = null
            };
        }
 /// <summary>
 /// Returns path to the properly located default settings file, if it not there copies it or if nowhere to find - creates a new one
 /// </summary>
 /// <param name="fileLocation"></param>
 /// <param name="defaultSettings"></param>
 public static void EnsureDefaultSettingsFilePresent(out string fileLocation,IConverterSettings defaultSettings)
 {
     SettingsLocation locationDetected;
     if (LocateDefaultSettings(out fileLocation,out locationDetected))
     {
         switch (locationDetected)
         {
             case SettingsLocation.UserAppDataFolder:
                 if (!IsValidFileVersion(fileLocation))
                 {
                     break;
                 }
                 return;
             case SettingsLocation.AppDataFolder:
             case SettingsLocation.ProgramFolder:
                 CopySettingsFileToUserAppDataFolder(fileLocation);
                 return;
         }
     }
     fileLocation    =   GetProperSettingsLocation();
     ConverterSettingsFile settingsFile = new ConverterSettingsFile();
     settingsFile.Settings.CopyFrom(defaultSettings);
     Directory.CreateDirectory(Path.GetDirectoryName(fileLocation));
     settingsFile.Save(fileLocation);
 }
        public void Init()
        {
            // MAKE SURE before you run this test, you MUST change the API key to yours; otherwise the test fails.
            this._settings = ConverterSettings.CreateInstance();
            this._formats  = new Formats();
            this._wrapper  = new ConverterWrapper(this._settings);

            this._input = new InputParameters()
            {
                InputFormat = this._formats.Document.Md,
                InputMethod = InputMethod.Download,
                Filepath    = "https://raw.githubusercontent.com/aliencube/CloudConvert.NET/dev/README.md",
                Filename    = "README.md",
            };
            this._output = new OutputParameters()
            {
                DownloadMethod = DownloadMethod.False,
                OutputStorage  = OutputStorage.OneDrive,
            };
            this._conversion = new ConversionParameters()
            {
                OutputFormat     = this._formats.Document.Docx,
                ConverterOptions = new MarkdownConverterOptions()
                {
                    InputMarkdownSyntax = MarkdownSyntaxType.Auto
                },
            };
        }
        /// <summary>
        /// Returns path to the properly located default settings file, if it not there copies it or if nowhere to find - creates a new one
        /// </summary>
        /// <param name="fileLocation"></param>
        /// <param name="defaultSettings"></param>
        public static void EnsureDefaultSettingsFilePresent(out string fileLocation, IConverterSettings defaultSettings)
        {
            SettingsLocation locationDetected;

            if (LocateDefaultSettings(out fileLocation, out locationDetected))
            {
                switch (locationDetected)
                {
                case SettingsLocation.UserAppDataFolder:
                    if (!IsValidFileVersion(fileLocation))
                    {
                        break;
                    }
                    return;

                case SettingsLocation.AppDataFolder:
                case SettingsLocation.ProgramFolder:
                    CopySettingsFileToUserAppDataFolder(fileLocation);
                    return;
                }
            }
            fileLocation = GetProperSettingsLocation();
            ConverterSettingsFile settingsFile = new ConverterSettingsFile();

            settingsFile.Settings.CopyFrom(defaultSettings);
            Directory.CreateDirectory(Path.GetDirectoryName(fileLocation));
            settingsFile.Save(fileLocation);
        }
        /// <summary>
        /// Used to load settings object into a dialog/control
        /// </summary>
        /// <param name="settings"></param>
        public override void LoadSettings(IConverterSettings settings)
        {
            SuspendLayout();

            LoadUsedPlatformsFromSettings(settings.V2Settings.AppleConverterEPubSettings.Platforms);

            ResumeLayout();
        }
Esempio n. 7
0
        /// <summary>
        /// Used to load settings object into a dialog/control
        /// </summary>
        /// <param name="settings"></param>
        public override void LoadSettings(IConverterSettings settings)
        {
            SuspendLayout();

            LoadUsedPlatformsFromSettings(settings.V2Settings.AppleConverterEPubSettings.Platforms);

            ResumeLayout();
        }
 /// <summary>
 /// Saves current state to settings
 /// </summary>
 /// <param name="settings"></param>
 public override void SaveToSettings(IConverterSettings settings)
 {
     settings.V2Settings.AppleConverterEPubSettings.Platforms.Clear();
     foreach (var platform in _used.Values)
     {
         var createdSettings = new AppleEPub2PlatformSettings();
         createdSettings.CopyFrom(platform);
         settings.V2Settings.AppleConverterEPubSettings.Platforms.Add(createdSettings);
     }
     base.SaveToSettings(settings);
 }
Esempio n. 9
0
 /// <summary>
 /// Saves current state to settings
 /// </summary>
 /// <param name="settings"></param>
 public override void SaveToSettings(IConverterSettings settings)
 {
     settings.V2Settings.AppleConverterEPubSettings.Platforms.Clear();
     foreach (var platform in _used.Values)
     {
         var createdSettings = new AppleEPub2PlatformSettings();
         createdSettings.CopyFrom(platform);
         settings.V2Settings.AppleConverterEPubSettings.Platforms.Add(createdSettings);
     }
     base.SaveToSettings(settings);
 }
Esempio n. 10
0
        /// <summary>
        /// Initialises a new instance of the <c>ConverterWrapper</c> class.
        /// </summary>
        /// <param name="settings"></param>
        public ConverterWrapper(IConverterSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            this._settings = settings;

            this.InitialiseMapper();
        }
Esempio n. 11
0
        /// <summary>
        /// Initialises a new instance of the <c>ConverterWrapper</c> class.
        /// </summary>
        /// <param name="settings"></param>
        public ConverterWrapper(IConverterSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            this._settings = settings;
            MapperConfiguration mapperConfig = this.InitializeMapper();

            mapperConfig.AssertConfigurationIsValid();
            this._mapper = mapperConfig.CreateMapper();
        }
Esempio n. 12
0
        public static IFb2EPubConverterEngine CreateConverterEngine(IConverterSettings converterSettings)
        {
            switch (converterSettings.StandardVersion)
            {
            case EPubVersion.V2:
                return(new Fb2EPubConverterEngineV2 {
                    Settings = converterSettings
                });

            case EPubVersion.V3:
                return(new Fb2EPubConverterEngineV3 {
                    Settings = converterSettings
                });
            }
            throw new InvalidEnumArgumentException(string.Format("Unknown EPubVersion enum: {0}", converterSettings.StandardVersion));
        }
Esempio n. 13
0
        public void CopyFrom(IConverterSettings temp)
        {
            if (temp == null)
            {
                throw new ArgumentNullException("temp");
            }
            if (temp == this)
            {
                return;
            }

            _outputPath      = temp.OutPutPath;
            _resourcesPath   = temp.ResourcesPath;
            _standardVersion = temp.StandardVersion;
            _conversionSettings.CopyFrom(temp.ConversionSettings);
            _v2Settings.CopyFrom(temp.V2Settings);
            _v3Settings.CopyFrom(temp.V3Settings);
            _commonSettings.CopyFrom(temp.CommonSettings);
        }
        public void Handle(IConverterSettings message)
        {
            Options.CurrentConverter = message;

            // A new converter has been set. This means we can add the rest of the view models for that converter to the list of steps
            if (Options.CurrentConverter.Categories != null)
            {
                IList<IStep> steps = new List<IStep>();

                foreach (var category in Options.CurrentConverter.Categories)
                {
                    steps.Add(new PreferencesViewModel(EventAggregator, Options, category));
                }

                steps.Add(new ConvertViewModel(EventAggregator, Options, new OperationProvider(EventAggregator)));

                EventAggregator.PublishOnUIThread(new PreferenceStepOperationArgs(PreferenceOperation.Clear, null));
                EventAggregator.PublishOnUIThread(new PreferenceStepOperationArgs(PreferenceOperation.AddSteps, steps));
            }
        }
Esempio n. 15
0
        public void Handle(IConverterSettings message)
        {
            Options.CurrentConverter = message;

            // A new converter has been set. This means we can add the rest of the view models for that converter to the list of steps
            if (Options.CurrentConverter.Categories != null)
            {
                IList <IStep> steps = new List <IStep>();

                foreach (var category in Options.CurrentConverter.Categories)
                {
                    steps.Add(new PreferencesViewModel(EventAggregator, Options, category));
                }

                steps.Add(new ConvertViewModel(EventAggregator, Options, new OperationProvider(EventAggregator)));

                EventAggregator.PublishOnUIThread(new PreferenceStepOperationArgs(PreferenceOperation.Clear, null));
                EventAggregator.PublishOnUIThread(new PreferenceStepOperationArgs(PreferenceOperation.AddSteps, steps));
            }
        }
Esempio n. 16
0
        /// <summary>
        ///     Constructs the string that will be saved to disk as the config file.
        /// </summary>
        /// <returns></returns>
        public string BuiltOutputString(IConverterSettings converterSettings, IDirectoryHelper directoryHelper)
        {
            var sb = new StringBuilder();

            sb.AppendLine(ReadTextFile(environmentProxy.GetFrontendWorkingDirectory() + "\\Docs\\license.txt"));

            sb.AppendLine("configuration =");
            sb.AppendLine("{");

            // TODO: Mod support
            // Output source and target game settings

            // Why the "where clause": Some entries in the requireditems list is only used by the frontend.
            // Those that needs to go into configuration.txt has the "TagName" attribute check, the others don't.
            foreach (var folder in converterSettings.RequiredItems.OfType <IRequiredFolder>()
                     .Where(f => !string.IsNullOrEmpty(f.TagName)))
            {
                sb.AppendLine("\t# " + folder.FriendlyName + ": " + folder.Description);
                sb.AppendLine("\t" + folder.TagName + " = \"" + folder.SelectedValue + "\"");
                sb.AppendLine();
            }

            foreach (var file in converterSettings.RequiredItems.OfType <IRequiredFile>()
                     .Where(f => string.IsNullOrEmpty(f.InternalTagName)).Where(f => !f.IsHidden))
            {
                sb.AppendLine("\t# " + file.FriendlyName + ": " + file.Description);
                sb.AppendLine("\t" + file.TagName + " = \"" + file.SelectedValue + "\"");
                sb.AppendLine();
            }

            // Preferences
            foreach (var category in converterSettings.Categories)
            {
                category.Preferences.ForEach(p => sb.AppendLine("\t" + p.ToString()));
            }

            sb.AppendLine("}");
            return(sb.ToString());
        }
 public string GetConverterWorkingDirectory(IConverterSettings currentConverter)
 {
     return(Path.GetDirectoryName(currentConverter.AbsoluteConverter.SelectedValue));
 }
Esempio n. 18
0
 public virtual void LoadSettings(IConverterSettings settings)
 {
 }
Esempio n. 19
0
 public virtual void LoadSettings(IConverterSettings settings) { }
Esempio n. 20
0
 public virtual void SaveToSettings(IConverterSettings settings) { }
 public void Reset(IConverterSettings newSettings)
 {
 }
Esempio n. 22
0
 public void Init()
 {
     this._settings = ConverterSettings.CreateInstance();
 }
Esempio n. 23
0
 public ImportExportForm(IConverterSettings settings)
 {
     _settings = settings;
     InitializeComponent();
 }
Esempio n. 24
0
 public ImportExportForm(IConverterSettings settings)
 {
     _settings = settings;
     InitializeComponent();
 }
Esempio n. 25
0
 public static IFb2EPubConverterEngine CreateConverterEngine(IConverterSettings converterSettings)
 {
     switch (converterSettings.StandardVersion)
     {
         case EPubVersion.V2:
             return new Fb2EPubConverterEngineV2 { Settings = converterSettings };
         case EPubVersion.V3:
             return new Fb2EPubConverterEngineV3 { Settings = converterSettings };
     }
     throw new InvalidEnumArgumentException(string.Format("Unknown EPubVersion enum: {0}",converterSettings.StandardVersion));
 }
Esempio n. 26
0
 public virtual void SaveToSettings(IConverterSettings settings)
 {
 }
 public void Reset(IConverterSettings newSettings)
 {
 }
Esempio n. 28
0
        public void CopyFrom(IConverterSettings temp)
        {
            if (temp == null)
            {
                throw new ArgumentNullException("temp");
            }
            if (temp == this)
            {
                return;
            }

            _outputPath = temp.OutPutPath;
            _resourcesPath = temp.ResourcesPath;
            _standardVersion = temp.StandardVersion;
            _conversionSettings.CopyFrom(temp.ConversionSettings);
            _v2Settings.CopyFrom(temp.V2Settings);
            _v3Settings.CopyFrom(temp.V3Settings);
            _commonSettings.CopyFrom(temp.CommonSettings);
        }
 public string GetConverterWorkingDirectory(IConverterSettings currentConverter)
 {
     return Path.GetDirectoryName(currentConverter.AbsoluteConverter.SelectedValue);
 }