コード例 #1
0
ファイル: Form1.cs プロジェクト: frostsergei/MovieParser
        /// <summary>
        /// Initializes a new instance of the <see cref="Form1" /> class.
        /// </summary>
        public Form1()
        {
            this.InitializeComponent();
            ProcessXML.LoadXML("Movies.xml", dataSet);
            pageText = LibParse.ProcesParse.LoadPage(@"https://www.kinopoisk.ru/top/");
            if (pageText == null)
            {
                pageText = LibParse.ProcesParse.LoadLocalHtml();
                if (pageText == null)
                {
                    buttonSearch.Enabled   = false;
                    buttonSave.Enabled     = false;
                    comboBoxMovies.Enabled = false;
                    textBoxName.Enabled    = false;
                    richTextBoxInfo.Text  += "Application has no data to process!\n";
                }
                else
                {
                    richTextBoxInfo.Text += "Application works in offline mode!\n";
                }
            }
            else
            {
                richTextBoxInfo.Text += "Application works in online mode!\n";
            }

            dataGridViewMovies.RowCount = 1;
        }
コード例 #2
0
ファイル: UnitTests.cs プロジェクト: frostsergei/MovieParser
        public void EqualStringsTest()
        {
            string checker = "qwerty";

            string[] data = new string[3];
            data[0] = "querty";
            data[1] = "qwerty";
            data[2] = "werty";
            Assert.IsTrue(ProcessXML.CheckStrings(checker, data));
        }
コード例 #3
0
ファイル: Process.cs プロジェクト: secondhandbuddah/maestro
        internal string GetAssociation(string nodeId, string nodeVariableName)
        {
            var node    = ProcessXML.Elements().Where(e => e.Attribute("id").Value == nodeId);
            var inputId = node.Elements(NS + "ioSpecification").Elements(NS + "dataInput")
                          .Where(e => e.Attribute("name").Value == nodeVariableName).FirstOrDefault().Attribute("id").Value;
            var propertyId = node.Elements(NS + "dataInputAssociation")
                             .Where(d => d.Element(NS + "targetRef").Value == inputId).Elements(NS + "sourceRef").FirstOrDefault().Value;
            var propertyName = ProcessXML.Elements(NS + "property")
                               .Where(e => e.Attribute("id").Value == propertyId).Attributes("name").FirstOrDefault().Value;

            return(propertyName);
        }
コード例 #4
0
ファイル: Process.cs プロジェクト: secondhandbuddah/maestro
        public ProcessInstance NewProcessInstance()
        {
            var current         = ProcessXML.Element(NS + "startEvent");
            var node            = new ProcessNode(current.Attribute("id").Value, current.Name.LocalName);
            var nodes           = BuildNodes(ProcessXML);
            var processInstance = new ProcessInstance(this);

            BuildLinkedNodes(current, ref node, nodes, processInstance);
            processInstance.Id        = Guid.NewGuid().ToString();
            processInstance.StartNode = node;
            processInstance.Nodes     = nodes.ToImmutableDictionary();

            return(processInstance);
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: frostsergei/MovieParser
        /// <summary>
        /// Save selected movie in XML file.
        /// </summary>
        /// <param name="sender">Standart WinForms object parameter.</param>
        /// <param name="e">Standart WinForms EventArgs parameter.</param>
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            if (comboBoxMovies.Items.Count == 0)
            {
                return;
            }

            DataGridViewRow row = (DataGridViewRow)dataGridViewMovies.Rows[0].Clone();

            row.Cells[0].Value = this.movies[comboBoxMovies.SelectedIndex].Name;
            row.Cells[1].Value = this.movies[comboBoxMovies.SelectedIndex].Year;
            row.Cells[2].Value = this.movies[comboBoxMovies.SelectedIndex].Origin;
            row.Cells[3].Value = this.movies[comboBoxMovies.SelectedIndex].Rating;
            row.Cells[4].Value = this.movies[comboBoxMovies.SelectedIndex].Votes;

            dataGridViewMovies.Rows.Add(row);
            string temp = string.Empty;

            for (int i = 0; i < 5; i++)
            {
                if ((i == 1) || (i == 4))
                {
                    temp += "(";
                }

                temp += row.Cells[i].Value.ToString();
                if (!((i == 1) || (i == 4)))
                {
                    temp += " ";
                }

                if ((i == 1) || (i == 4))
                {
                    temp += ") ";
                }
            }

            temp = temp.Replace("  ", " ");
            if (!ProcessXML.CheckStrings(temp, xmlVal))
            {
                this.richTextBoxInfo.Text += "Saved data to XML!\n";
                ProcessXML.AddRow(dataSet, this.movies[comboBoxMovies.SelectedIndex]);
                ProcessXML.SaveDataSetXML("Movies.xml", dataSet);
            }
            else
            {
                richTextBoxInfo.Text += "Did not saved data to XML! Data already exists!\n";
            }
        }
コード例 #6
0
        public static GameData GetGame(string name, string platform = null)
        {
            var getGameURL = baseURL + "/GetGame.php";
            var getGameAPI = new RestSharp.RestClient(getGameURL);
            var apiRequest = new RestSharp.RestRequest(Method.POST);

            apiRequest.AddQueryParameter("name", name);

            if (!string.IsNullOrEmpty(platform))
            {
                apiRequest.AddQueryParameter("platform", platform);
            }

            apiRequest.RequestFormat = DataFormat.Xml;

            var response = getGameAPI.Execute(apiRequest);
            var gameData = ProcessXML.ParseXMLToModel <GameData>(response.Content);

            return(gameData);
        }
コード例 #7
0
 public FileMover()
 {
     processXML = new ProcessXML();
 }