示例#1
0
文件: Program.cs 项目: yukseljunk/wps
        public void Publish(WpsConsoleCommandLineOptions options)
        {
            try
            {
                var programOptionsFactory = new ProgramOptionsFactory();
                _options = programOptionsFactory.Get(options.BlogConfigPath);
                var postDal = new PostDal(new Dal(MySqlConnectionString));

                PostOrder postOrder = PostOrder.NewestFirst;
                switch (options.Strategy)
                {
                    case "newest":
                        postOrder = PostOrder.NewestFirst;
                        break;
                    case "oldest":
                        postOrder = PostOrder.OldestFirst;
                        break;
                    case "random":
                        postOrder = PostOrder.Random;
                        break;
                    default:
                        break;
                }

                IList<Post> posts = new List<Post>();// postDal.GetPosts(postOrder, options.NumberToPublish);
                if (options.Strategy == "selected")
                {
                    posts = postDal.GetPosts(options.PostIdsInt);
                }
                else
                {
                    posts = postDal.GetPosts(postOrder, options.NumberToPublish);
                }
                if (posts == null)
                {
                    Console.WriteLine("No posts found to publish!");
                    return;
                }

                foreach (var post in posts)
                {
                    try
                    {
                        Console.WriteLine(string.Format("Publishing '{0}'", post.Title));
                        postDal.PublishPost(post);
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                    }
                }

            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
            }
            Console.WriteLine("Publishing done.");
        }
示例#2
0
 public static ProgramOptions ProgramOptionsForBlog(string blog)
 {
     var fileName = BlogsSettings.ProgramSettingsFolder + "/" + blog + ".xml";
     var programOptionsFactory= new ProgramOptionsFactory();
     var programOptions = new ProgramOptions();
     if (File.Exists(fileName))
     {
         programOptions = programOptionsFactory.Get(fileName);
     }
     return programOptions;
 }
示例#3
0
        private void frmOptions_Load(object sender, EventArgs e)
        {
            var programOptionsFactory = new ProgramOptionsFactory();
            var options = programOptionsFactory.Get();

            FixEmptyNumericUpDown(numMerge);
            FixEmptyNumericUpDown(numThumbnailSize);
            FixEmptyNumericUpDown(numMaxImageDimension);
            FixEmptyNumericUpDown(numTitleContainsKeyword);
            FixEmptyNumericUpDown(numTitleStartsKeyword);
            FixEmptyNumericUpDown(numContentContainsKeyword);
            FixEmptyNumericUpDown(numFirst100Content);
            FixEmptyNumericUpDown(numKeywordContentRatio);
            FixEmptyNumericUpDown(numNEContentContainsKeyword);
            FixEmptyNumericUpDown(numNETitleContainsKeyword);
            FixEmptyNumericUpDown(numNEKeywordContentRatio);

            chkFeatureImage.Checked = options.MakeFirstImageAsFeature;
            chkTagsAsText.Checked = options.TagsAsText;
            numMerge.Value = options.MergeBlockSize;
            numThumbnailSize.Value = options.ThumbnailSize;
            chkResizeImages.Checked = options.ResizeImages;
            numMaxImageDimension.Value = options.ResizeSize;
            chkNoAPI.Checked = options.UseFtp;

            chkCache.Checked = options.UseCache;
            chkShowMessageBox.Checked = options.ShowMessageBoxes;
            chkScrambleLeadPosts.Checked = options.ScrambleLeadPosts;

            numTitleContainsKeyword.Value = options.TitleContainsKeywordScore;
            numTitleStartsKeyword.Value = options.TitleStartsWithKeywordScore;
            numContentContainsKeyword.Value = options.ContentContainsKeywordScore;
            numFirst100Content.Value = options.ContentFirst100ContainsKeywordScore;
            numKeywordContentRatio.Value = options.KeywordRatioScore;

            numNETitleContainsKeyword.Value = options.NonExactTitleContainsKeywordScore;
            numNEContentContainsKeyword.Value = options.NonExactContentContainsKeywordScore;
            numNEKeywordContentRatio.Value = options.NonExactKeywordRatioScore;
            chkUseRemoteDownloading.Checked = options.UseRemoteDownloading;
            chkSkipSearchingPosted.Checked = options.SkipSearchingPosted;
            txtPriceSign.Text = string.IsNullOrEmpty(options.PriceSign) ? "$":options.PriceSign;
            toolTip.SetToolTip(lblKeywordContentRatio, "For every percentage, give this much of score");
        }
示例#4
0
        private void btnCleanup_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure to want to delete ALL POSTS and UPLOADS, including IMAGES from the blog?",
                         "Confirm Delete!!",
                         MessageBoxButtons.YesNo);
            if (confirmResult != DialogResult.Yes) return;

            var programOptionsFactory = new ProgramOptionsFactory();
            _options = programOptionsFactory.Get();
            if (string.IsNullOrEmpty(_options.FtpUrl))
            {
                MessageBox.Show("In order to delete images, please set up FTP account from settings.");
                return;
            }
            _ftp = new Ftp.Ftp(FtpConfiguration);
            if (!string.IsNullOrEmpty(_ftp.TestConnection()))
            {
                MessageBox.Show("Cannot connect to FTP, please check your settings.");
                return;
            }
            try
            {
                _ftp.DirectoryListingProgressing += FtpDirectoryListingProgressing;
                _ftp.DirectoryListingFetchFinished += FtpDirectoryListingFetchFinished;
                _ftp.DirectoryDeletionProgressing += FtpDirectoryDeletionProgress;
                _ftp.DirectoryDeletionFinished += FtpDirectoryDeletionFinished;
                EnDis(false);
                _ftp.DeleteDirectory("wp-content/uploads/");

            }
            catch (Exception exception)
            {
                EnDis(true);

                MessageBox.Show(exception.ToString());
                Logger.LogExceptions(exception);
            }
        }
示例#5
0
文件: Item.cs 项目: yukseljunk/wps
        public virtual string PostBody(int thumbnailSize, bool includePriceAndSource = true, bool tagsAsText = true)
        {
            var programOptionsFactory = new ProgramOptionsFactory();
            var programOptions = programOptionsFactory.Get();
            var converterFunctions = new ConverterFunctions();
            var content = new StringBuilder("");
            if (ItemImages.Count > 0)
            {
                content.Append(string.Format("<div style=\"width: {0}px; margin-right: 10px;\">", (2 * thumbnailSize + 30)));
                foreach (var itemImage in ItemImages)
                {
                    content.Append(string.Format(
                        "<div style=\"width: {3}px; height: {3}px; float: left; margin-right: 15px; margin-bottom: 3px;\"><a href=\"{0}\"><img src=\"{1}\" alt=\"{2}\" title=\"{2}\" /></a></div>",
                        itemImage.Link, itemImage.NewSource, Title, thumbnailSize));

                }
                content.Append("</div>");

            }

            if (((int)(Price * 100)) > 0 && includePriceAndSource)
            {
                content.Append(string.Format("<h4>Price:{1}{0}</h4>", Price, programOptions.PriceSign));
            }
            content.Append(string.Format("<h2>{0}</h2>", Title));
            content.Append(converterFunctions.ArrangeContent(Content));
            if (!string.IsNullOrEmpty(Url) && includePriceAndSource)
            {
                content.Append(SourceStatement());
            }

            if (Tags != null && Tags.Count > 0 && tagsAsText && includePriceAndSource)
            {
                content.Append("<br/>Tags: ");
                content.Append(string.Join(", ", Tags));
            }
            return content.ToString();
        }
示例#6
0
文件: frmMain.cs 项目: yukseljunk/wps
 private void PrepareTemplates()
 {
     var programOptionsFactory = new ProgramOptionsFactory();
     _options = programOptionsFactory.Get();
     if (string.IsNullOrEmpty(_options.FtpUrl))
     {
         MessageBox.Show("In order to update wp files, please set up FTP account from settings.");
         return;
     }
     var ftp = new Ftp(FtpConfiguration);
     if (!string.IsNullOrEmpty(ftp.TestConnection()))
     {
         MessageBox.Show("Cannot connect to FTP, please check your settings.");
         return;
     }
     var frmPrepareTemplate = new frmPrepareTemplate();
     frmPrepareTemplate.ShowDialog();
 }
示例#7
0
文件: frmMain.cs 项目: yukseljunk/wps
        private void NoSourceFound(object sender, string e)
        {
            SetStatus(e);

            var programOptionsFactory = new ProgramOptionsFactory();
            _options = programOptionsFactory.Get();

            if (_options.ShowMessageBoxes)
            {
                MessageBox.Show(e);
            }
        }
示例#8
0
 private void frmAuthors_Load(object sender, EventArgs e)
 {
     var optionsFactory = new ProgramOptionsFactory();
     _options = optionsFactory.Get();
 }
示例#9
0
文件: frmMain.cs 项目: yukseljunk/wps
        private void fixFeatureImageErrorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!_blogSelected)
            {
                MessageBox.Show("First connect to blog from File>Connect!");
                return;
            }
            var thumbnailMetaData = new Dictionary<int, string>();
            var programOptionsFactory = new ProgramOptionsFactory();
            _options = programOptionsFactory.Get();
            using (var dal = new Dal(MySqlConnectionString))
            {
                var postDal = new PostDal(dal);
                var allYoastMeta = postDal.GetAllPostMeta("_yoast_wpseo_focuskw_text_input");
                if (allYoastMeta.Tables.Count == 0) return;
                if (allYoastMeta.Tables[0].Rows.Count == 0) return;

                var thumbnailMeta = postDal.GetAllPostMeta("_thumbnail_id");
                if (thumbnailMeta.Tables.Count > 0)
                {
                    if (thumbnailMeta.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow row in thumbnailMeta.Tables[0].Rows)
                        {
                            var postId = Int32.Parse(row["post_id"].ToString());
                            var meta_value = row["meta_value"].ToString();
                            if (!thumbnailMetaData.ContainsKey(postId))
                            {
                                thumbnailMetaData.Add(postId, meta_value);
                            }
                        }
                    }
                }

                barStatus.Maximum = allYoastMeta.Tables[0].Rows.Count;
                barStatus.Visible = true;
                foreach (DataRow row in allYoastMeta.Tables[0].Rows)
                {
                    barStatus.PerformStep();

                    var postId = Int32.Parse(row["post_id"].ToString());
                    var meta_value = row["meta_value"].ToString();
                    if (thumbnailMetaData.ContainsKey(postId) && !string.IsNullOrEmpty(thumbnailMetaData[postId]))
                    {
                        continue;
                    }
                    Application.DoEvents();
                    SetStatus(string.Format("Fixing {0} ", postId));
                    postDal.SetPostMetaData(postId, "_thumbnail_id", meta_value);
                }

                barStatus.Visible = false;

            }
            MessageBox.Show("Finished");
        }
示例#10
0
文件: frmMain.cs 项目: yukseljunk/wps
        private void GettingSourceItemsFinished(object sender, EventArgs e)
        {
            ResetBarStatus();
            EnDis(true);
            btnGo.Enabled = lvItems.Items.Count > 0;
            Cursor.Current = Cursors.Default;
            SetStatus("Getting source items finished");

            var programOptionsFactory = new ProgramOptionsFactory();
            _options = programOptionsFactory.Get();

            if (_options.ShowMessageBoxes)
            {
                MessageBox.Show("Getting source items finished");
            }
            _stopWatch.Stop();
            var timeTook = _stopWatch.Elapsed.TotalMinutes.ToString("0.00");
            lblDateTime.Text = string.Format("Took {0} mins", timeTook);

            _sourceItemFactory.NoSourceFound -= NoSourceFound;
            _sourceItemFactory.GettingSourceItemsStopped -= GettingSourceItemsStopped;
            _sourceItemFactory.ProcessFinished -= GettingSourceItemsFinished;
            _sourceItemFactory.SourceItemGot -= SourceItemGot;
            _sourceItemFactory.TotalResultsFound -= TotalResultsFound;
            _sourceItemFactory.SourceItemsGot -= SourceItemsGot;

            _sourceItemFactory = null;
        }
示例#11
0
文件: frmMain.cs 项目: yukseljunk/wps
        private void btnRelevanceScramble_Click(object sender, EventArgs e)
        {
            //relevance e gore sirala
            var ccea = new ColumnClickEventArgs(2);

            lvItems_ColumnClick(null, ccea);
            ccea = new ColumnClickEventArgs(12);
            lvItems_ColumnClick(null, ccea);
            lvItems_ColumnClick(null, ccea);
            lvItems.ListViewItemSorter = null;

            var programOptionsFactory = new ProgramOptionsFactory();
            var programOptions = programOptionsFactory.Get();
            var mergeBlockSize = programOptions.MergeBlockSize;

            //zero relevance baslayan yeri bul
            var zeroRelevanceStartIndex = -1;
            for (int i = 0; i < lvItems.Items.Count; i++)
            {
                var item = lvItems.Items[i];
                var relevanceScore = int.Parse(item.SubItems[12].Text);
                if (relevanceScore == 0)
                {
                    zeroRelevanceStartIndex = i;
                    break;
                }
            }
            if (zeroRelevanceStartIndex == -1)
            {
                MessageBox.Show("No 0 relevance item found, scramble not to be done!");
                return;
            }

            // mergeBlockSize indan buyuk olan herhangi bir eleman her zaman tek basina gidecek.... bunu unuttun...
            try
            {
                if (programOptions.ScrambleLeadPosts)
                {
                    ScrambleBlock(0, zeroRelevanceStartIndex);
                }
                ScrambleBlock(zeroRelevanceStartIndex, lvItems.Items.Count);

                var primaryPostIndex = 0;
                var cumulativeWordCount = 0;
                var itemBlockIndex = 0;
                for (int i = 0; i < lvItems.Items.Count; i++)
                {
                    var item = lvItems.Items[i];
                    var wordCount = int.Parse(item.SubItems[10].Text);
                    cumulativeWordCount += wordCount;

                    if (cumulativeWordCount >= mergeBlockSize)
                    {
                        //finish this block, start a new block
                        primaryPostIndex = i + 1;
                        cumulativeWordCount = 0;
                        itemBlockIndex = 0;
                    }
                    else
                    {
                        if (zeroRelevanceStartIndex >= lvItems.Items.Count) continue; //can be break?

                        //continue to this block
                        itemBlockIndex++;

                        while (true)
                        {
                            if (zeroRelevanceStartIndex >= lvItems.Items.Count) break;
                            var itemToMove = lvItems.Items[zeroRelevanceStartIndex];
                            var zeroRelWordCount = int.Parse(itemToMove.SubItems[10].Text);
                            if (zeroRelWordCount < mergeBlockSize)
                            {
                                lvItems.Items.RemoveAt(zeroRelevanceStartIndex);
                                lvItems.Items.Insert(primaryPostIndex + itemBlockIndex, itemToMove);
                                zeroRelevanceStartIndex++;
                                break;
                            }
                            zeroRelevanceStartIndex++;
                        }
                    }

                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.ToString());
                Logger.LogExceptions(exception);
            }

            ArrangeOrder();
        }
示例#12
0
文件: frmMain.cs 项目: yukseljunk/wps
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (txtUrl.Text == "")
            {
                MessageBox.Show("Enter Keyword!");
                return;
            }
            var sitesCount = chkSites.CheckedItems.Count;
            if (sitesCount == 0)
            {
                MessageBox.Show("Select sites!");
                return;
            }
            EnDis(false);
            numPage_ValueChanged(null, null);
            Cursor.Current = Cursors.WaitCursor;
            ResetBarStatus(true);
            btnGo.Enabled = false;
            lblTotalResults.Text = "";

            var pageStart = (int)numPage.Value;
            var pageEnd = chkAllPages.Checked ? (int)numPageTo.Maximum : (int)numPageTo.Value;
            ///barStatus.Maximum = pageEnd - pageStart;
            barStatus.Maximum = 0;
            lblDateTime.Text = "";
            _stopWatch = new Stopwatch();
            _stopWatch.Start();
            var programOptionsFactory = new ProgramOptionsFactory();
            _options = programOptionsFactory.Get();
            HashSet<string> existingIds = null;
            if (_options.SkipSearchingPosted)
            {
                using (var dal = new Dal(MySqlConnectionString))
                {
                    _blogCache = new BlogCache(dal);
                    if (_options.UseCache)
                    {
                        SetStatus("Loading present posts and tags in the blog(this may take some time)...");
                        Application.DoEvents();
                        existingIds = _blogCache.IdsPresent(_options.BlogUrl);
                        Application.DoEvents();
                    }
                }

            }
            _sourceItemFactory = new SourceItemFactory();
            _sourceItemFactory.NoSourceFound += NoSourceFound;
            _sourceItemFactory.GettingSourceItemsStopped += GettingSourceItemsStopped;
            _sourceItemFactory.ProcessFinished += GettingSourceItemsFinished;
            _sourceItemFactory.SourceItemGot += SourceItemGot;
            _sourceItemFactory.TotalResultsFound += TotalResultsFound;
            _sourceItemFactory.SourceItemsGot += SourceItemsGot;
            _sourceItemFactory.ExceptionOccured += ExceptionOccuredWhileGettingItems;
            var checkedSites = (from object checkedItem in chkSites.CheckedItems select checkedItem.ToString()).ToList();
            _sourceItemFactory.GetSourceItems(checkedSites, txtUrl.Text, pageStart, pageEnd, lvItems.Items.Count + 1, existingIds);
        }
示例#13
0
 private void frmPublish_Load(object sender, EventArgs e)
 {
     cbCriteria.Items.Clear();
     cbCriteria.Items.AddRange(new object[] { "Newest", "Oldest", "Random" });
     cbCriteria.SelectedIndex = 0;
     txtStatus.Text = "";
     if (_posts != null)
     {
         cbCriteria.Items.Add("Selected Items");
         cbCriteria.Enabled = false;
         cbCriteria.SelectedIndex = 3;
         numNumberOfPosts.Enabled = false;
         numNumberOfPosts.Value = _posts.Count;
     }
     var programOptionsFactory = new ProgramOptionsFactory();
     _options = programOptionsFactory.Get();
     #if DEBUG
     btnGetGoogleToken.Visible = true;
     txtRefreshToken.Visible = true;
     #endif
     txtYoutubeDescription.Text = string.Format("See more on {0}\nMusic by http://www.bensound.com/ royalty free license", _options.BlogUrl);
 }
示例#14
0
文件: frmMain.cs 项目: yukseljunk/wps
        private void btnGo_Click(object sender, EventArgs e)
        {
            if (!_blogSelected)
            {
                MessageBox.Show("First connect to blog from File>Connect!");
                return;
            }

            if (lvItems.SelectedItems.Count == 0)
            {
                MessageBox.Show("Select items to transfer!");
                return;
            }
            var programOptionsFactory = new ProgramOptionsFactory();
            _options = programOptionsFactory.Get();

            _stopWatch = new Stopwatch();
            _stopWatch.Start();

            EnDisItems(false);

            lblDateTime.Text = "Started at " + DateTime.Now.ToLongTimeString();

            using (var dal = new Dal(MySqlConnectionString))
            {
                _blogCache = new BlogCache(dal);

                if (_options.UseCache)
                {
                    SetStatus("Loading present posts and tags in the blog(this may take some time)...");
                    Application.DoEvents();
                    _blogCache.Start(_options.BlogUrl);
                    Application.DoEvents();
                }
                SetStatus("Ready");
                ResetBarStatus(true);
                barStatus.Maximum = lvItems.SelectedItems.Count;
                _postFactory = new PostFactory(
                        SiteConfig,
                        new Ftp(FtpConfiguration),
                        _blogCache,
                        dal,
                        _options);
                var items = ItemsFromListView(lvItems.SelectedItems);
                _postFactory.PostCreated += PostCreated;
                _postFactory.PostBeingCreated += PostBeingCreated;
                _postFactory.PostsCreated += PostsCreated;
                _postFactory.PostCreationStopped += PostCreationStopped;
                _postFactory.Create(items);
            }
        }
示例#15
0
        private void SetPluginData()
        {
            var checkedSites = (from object checkedItem in lstPlugins.CheckedItems select checkedItem.ToString()).ToList();
            var programOptionsFactory = new ProgramOptionsFactory();
            _options = programOptionsFactory.Get();

            using (var dal = new Dal(MySqlConnectionString))
            {
                var optionsDal = new OptionsDal(dal);
                var currentActivePluginsValue = optionsDal.GetValue("active_plugins");
                var currentActivePlugins = new HashSet<string>(PhpSerializer.Deserialize(currentActivePluginsValue));
                var pluginsToPut = new HashSet<string>();

                var pluginPaths = GetPluginFiles();
                var pluginNames = GetPluginNames();
                for (int i = 0; i < pluginNames.Count; i++)
                {
                    if (checkedSites.Contains(pluginNames[i]))
                    {
                        pluginsToPut.Add(pluginPaths[i]);
                    }
                }

                currentActivePlugins.UnionWith(pluginsToPut);
                var newActivePluginData = PhpSerializer.Serialize(currentActivePlugins.ToList());
                optionsDal.SetValue("active_plugins", newActivePluginData);

                var optionFiles = Directory.EnumerateFiles("blog", "*.bosf", SearchOption.AllDirectories);
                foreach (var optionFile in optionFiles)
                {
                    var optionFileInfo = new FileInfo(optionFile);

                    if (optionFileInfo.Directory.Name == "plugins")
                    {
                        var fileName = Path.GetFileNameWithoutExtension(optionFile);
                        if (!checkedSites.Contains(fileName))
                        {
                            continue;
                        }
                    }

                    var contentLines = File.ReadAllLines(optionFileInfo.FullName);
                    foreach (var content in contentLines)
                    {
                        var splitted = content.Split('\t');
                        if (splitted.Length > 0)
                        {
                            optionsDal.SetValue(splitted[0], splitted[1]);
                        }
                        else
                        {
                            optionsDal.SetValue(content, "");
                        }
                    }
                }

            }
        }
示例#16
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            var checkedSites = (from object checkedItem in lstPlugins.CheckedItems select checkedItem.ToString()).ToList();
            var directoriesCreated = new HashSet<string>();
            var programOptionsFactory = new ProgramOptionsFactory();
            _options = programOptionsFactory.Get();
            DeleteLocallyExtractedPlugins();
            if (!chkRemoteUnzip.Checked)
            {
                UnzipPluginsLocally(checkedSites);
            }
            var ftp = new Ftp.Ftp(FtpConfiguration);

            var fileUploaded = 0;

            foreach (var file in _files)
            {
                fileUploaded++;
                if ((bw.CancellationPending))
                {
                    e.Cancel = true;
                    break;
                }
                var fileInfo = new FileInfo(file);
                var dir = fileInfo.Directory;
                if (dir == null)
                {
                    continue;
                }
                var ftpDir = dir.FullName.Replace(Helper.AssemblyDirectory + "\\blog", "").Replace("\\", "/");
                if (ftpDir.StartsWith("/"))
                {
                    ftpDir = ftpDir.Substring(1);
                }
                try
                {
                    if (!directoriesCreated.Contains(ftpDir))
                    {
                        ftp.MakeFtpDir(ftpDir);
                        bw.ReportProgress(fileUploaded, "Creating Ftp Directory " + ftpDir);
                        directoriesCreated.Add(ftpDir);
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString());
                    return;
                }

                try
                {
                    var uploadFile = true;
                    //upload ewww folder only if ewww-image-optimizer selected
                    if (!checkedSites.Contains("ewww-image-optimizer") && fileInfo.Directory.Name == "ewww")
                    {
                        continue;
                    }
                    var fileName = Path.GetFileNameWithoutExtension(file);

                    if (IsPluginFile(fileInfo))
                    {
                        if (chkRemoteUnzip.Checked) //if remotely unzipping, then upload only zip files for checked plugins
                        {
                            if (!checkedSites.Contains(fileName) || Path.GetExtension(file) != ".zip")
                            {
                                uploadFile = false;
                            }
                        }
                        else//if locally unzipping, then upload only extracted files for checked plugins
                        {
                            if (fileInfo.Directory.Name == "plugins")
                            {
                                uploadFile = false;
                            }
                        }
                    }
                    else
                    {
                        uploadFile = chkUploadAllExceptPlugin.Checked;
                    }

                    if (!uploadFile) continue;

                    ftp.UploadFileFtp(file, ftpDir);
                    bw.ReportProgress(fileUploaded, "Uploading " + file);

                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString());
                }
            }

            if (chkRemoteUnzip.Checked)
            {
                try
                {
                    UnzipPluginsRemotely(fileUploaded);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString());
                    return;
                }
            }

            try
            {
                SetPluginData();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.ToString());
                return;
            }
        }
示例#17
0
 public RelevanceCalculator()
 {
     var programOptionsFactory = new ProgramOptionsFactory();
     _programOptions = programOptionsFactory.Get();
 }
示例#18
0
文件: Site.cs 项目: yukseljunk/wps
 public Site()
 {
     var programOptionsFactory = new ProgramOptionsFactory();
     _options = programOptionsFactory.Get();
 }
示例#19
0
        private void loadSettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lvSites.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select a site from sites list.");
                return;
            }

            openSettingFile.Filter = "Xml files (*.xml)|*.xml|All files (*.*)|*.*";
            openSettingFile.FilterIndex = 1;
            openSettingFile.RestoreDirectory = true;
            openSettingFile.FileName = "";

            if (openSettingFile.ShowDialog() != DialogResult.OK) return;
            if (string.IsNullOrEmpty(openSettingFile.FileName)) return;

            var programOptionsFactory = new ProgramOptionsFactory();
            var options = programOptionsFactory.Get(openSettingFile.FileName);

            _sitesSettings[lvSites.SelectedItems[0].Text] = options;

            FillValues(options);
        }