コード例 #1
0
        public async Task <List <string> > RecognizeAsync(List <StorageFile> pickedFiles)
        {
            List <string> results = new List <string>();
            // OcrEngine engine = OcrEngine.TryCreateFromLanguage(new Windows.Globalization.Language("en-US"));
            OcrEngine engine = OcrEngine.TryCreateFromLanguage(new Windows.Globalization.Language("pl"));
            int       i      = 0;

            foreach (StorageFile file in pickedFiles)
            {
                Informator.Log("    OCR - " + i + " out of " + pickedFiles.Count);
                StringBuilder text   = new StringBuilder();
                var           stream = await file.OpenAsync(FileAccessMode.Read);

                BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream);

                SoftwareBitmap softwareBitmap = await decoder.GetSoftwareBitmapAsync();

                OcrResult ocrResult = await engine.RecognizeAsync(softwareBitmap);

                foreach (OcrLine line in ocrResult.Lines)
                {
                    text.Append(line.Text + "\n");
                }
                results.Add(text.ToString());
                i++;
            }
            return(results);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            SquareMatrix<int> squareMatrix = new SquareMatrix<int>(new int[2,2]);
            Informator informator = new Informator(squareMatrix);

            squareMatrix.ChangeElement(2, 3);
        }
コード例 #3
0
ファイル: MSSQL_Manager.cs プロジェクト: Lootero4eg/UBureau
        public void AddCardInformatorInfo(int card_id, Informator inf)
        {
            _cmd = CreateCommand("AddCardInformatorInfo");
            _param = CreateParameter("@card_id", DbType.Int32, 4);
            _param.Value = card_id;
            _cmd.Parameters.Add(_param);

            _param = CreateParameter("@informator_id", DbType.Int32, 4);
            _param.Value = inf.Id;
            _cmd.Parameters.Add(_param);

            _param = CreateParameter("@reg_time", DbType.DateTime, 8);
            _param.Value = inf.Time;
            _cmd.Parameters.Add(_param);
            ExecuteCommand(_cmd.ExecuteNonQuery);
        }
コード例 #4
0
        private void AddInformator(object sender, EventArgs e)
        {
            sqlmgr.Reconnect();
            var infs = sqlmgr.GetInformatorsDict();
            sqlmgr.Disconnect();

            var test2 = InputComboBox.Show("Выберите информатора", 300, 40, ComboBoxStyle.DropDownList,
                new Font("Times New Roman", 12),
                infs, "Name");

            if (!string.IsNullOrEmpty(test2.ToString()))
            {
                int inf_id = -1;
                foreach (var item in infs)
                {
                    if (item.Name == test2.ToString())
                    {
                        inf_id = item.Id;
                        break;
                    }
                }

                DateTime dt = DateTime.Now;
                ListViewItem li = new ListViewItem(dt.ToShortTimeString());
                ListViewItem.ListViewSubItem si = new ListViewItem.ListViewSubItem(li, test2.ToString());
                li.SubItems.Add(si);
                _lviews[1].Items.Add(li);
                Informator inf = new Informator();
                inf.Id = inf_id;
                inf.InformatorName = test2.ToString();
                inf.Time = dt;
                if (_lviews[1].DataSource == null)
                    _lviews[1].DataSource = new Informators();
                (_lviews[1].DataSource as Informators).Add(inf);
                _lviews[1].RefreshDataSource();
                sqlmgr.Reconnect();
                sqlmgr.AddCardInformatorInfo(_card_id, inf);
                sqlmgr.Disconnect();
            }
        }
コード例 #5
0
ファイル: MSSQL_Manager.cs プロジェクト: Lootero4eg/UBureau
        private void GetCardInformators(DeceasedCard card)
        {
            _cmd = CreateCommand("GetCardInformators");
            _param = CreateParameter("@card_id", DbType.Int32, 4);
            _param.Value = card.CardId;
            _cmd.Parameters.Add(_param);
            _DR = ExecuteDataReader(_cmd.ExecuteReader);

            while (_DR.Read())
            {
                Informator inf = new Informator();
                inf.Id = Convert.ToInt32(_DR["informator_id"]);
                inf.InformatorName = _DR["informator"].ToString();
                inf.Time = (DateTime)_DR["reg_time"];
                inf.Money = (double)_DR["informator_money"];
                card.Informators.Add(inf);
            }

            _DR.Close();
        }
コード例 #6
0
        public static void Main(string[] args)
        {
            Speaker    speak   = null;
            Informator info    = null;
            Creature   unicorn = new Unicorn("Saint", 100, 60);

            Console.WriteLine();
            Creature dragon = new Dragon("Fire", 200, 50);

            Console.WriteLine();
            Dragon special = new Dragon("Morroh", 200, 80, "black dragon", "Rise!");

            Console.WriteLine();
            Manticore manticore = new Manticore();

            Console.WriteLine();
            Creature phoenix = new Phoenix("Taurus", 100, 60);

            Console.WriteLine();
            Phoenix derek = new Phoenix("Derek", 120, 70);

            derek.Age = 55;
            Console.WriteLine();
            Gargoyle howley = new Gargoyle("Howley", 100, 60);

            Console.WriteLine();
            Unicorn trevor = new Unicorn("Trevor", 100, 60);

            Console.WriteLine();
            Pegasus rash = new Pegasus("Rash", 120, 70);

            Console.WriteLine();

            ArrayList creatures = new ArrayList();

            creatures.Add(unicorn);
            creatures.Add(derek);
            creatures.Add(special);
            creatures.Add(howley);
            creatures.Add(dragon);
            creatures.Add(phoenix);
            creatures.Add(trevor);
            creatures.Add(rash);

            foreach (Creature c in creatures)
            {
                react += c.React;
                speak += c.Say;
                info  += c.Print;
            }

            info();
            Console.WriteLine();
            speak();
            Console.WriteLine();
            Console.WriteLine();
            try
            {
                trevor.Fight(manticore);
                Console.WriteLine("{0}: {1}", manticore.Name, manticore.Health);
                trevor.Enchant(dragon);
                trevor.Fight(null);
            }
            catch (AttackingMonsterException e)
            {
                Console.WriteLine("{0}: {1}", e.GetType(), e.Message);
            }
            Console.WriteLine();
            try
            {
                rash.Fight(howley);
                Console.WriteLine("{0}: {1}", howley.Name, howley.Health);
                Console.WriteLine();
                rash.Fight(special);
            }
            catch (AttackingMonsterException e)
            {
                Console.WriteLine("{0}: {1}", e.GetType(), e.Message);
            }

            try
            {
                rash.Fight(null);
            }
            catch (AttackingMonsterException e)
            {
                Console.WriteLine("{0}: {1}", e.GetType(), e.Message);
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("I summon you, Satan!");
            Demon satan = Demon.Summon("Satan!");

            satan.Print();
            Console.WriteLine();
            satan.Say();
            Console.WriteLine();
            satan.ApocalypsisEvent += new EventHandler <ApocalypsisEventArgs>(ReactionOfAnimals);
            satan.CarryChaos();
            satan.ApocalypsisEvent -= new EventHandler <ApocalypsisEventArgs>(ReactionOfAnimals);

            Console.WriteLine();
            Console.WriteLine("Damage from earthquake:");
            Console.WriteLine("{0}: {1}", unicorn.Name, unicorn.Health);
            Console.WriteLine("{0}: {1}", derek.Name, derek.Health);
            Console.WriteLine("{0}: {1}", phoenix.Name, phoenix.Health);
            Console.WriteLine("{0}: {1}", trevor.Name, trevor.Health);
            Console.WriteLine("{0}: {1}", rash.Name, rash.Health);

            Console.WriteLine();
            manticore.Poison(trevor);
            manticore.Fight(rash);
            Console.WriteLine("{0}: {1}", rash.Name, rash.Health);

            Console.ReadKey();
        }