Example #1
0
        private async void ExportHand(object obj)
        {
            if (layout == null)
            {
                return;
            }

            EnumExportType exportType = EnumExportType.Raw;

            if (obj == null || !Enum.TryParse(obj.ToString(), out exportType))
            {
                return;
            }

            await Task.Run(() =>
            {
                using (var readToken = readerWriterLock.Read())
                {
                    LogProvider.Log.Info($"Exporting hand {layout.GameNumber}, {exportType} [{layout.PokerSite}]");

                    ExportFunctions.ExportHand(layout.GameNumber, (short)layout.PokerSite, exportType, true);
                    RaiseNotification(CommonResourceManager.Instance.GetResourceString(ResourceStrings.DataExportedMessageResourceString), "Hand Export");
                }
            });
        }
Example #2
0
 private void BtnExport_Click(object sender, RoutedEventArgs e)
 {
     foreach (var selectorGroup in (ObservableCollection <SelectorGroup>)((Button)sender).DataContext)
     {
         ExportFunctions.ExportSelectorGroupToCSV(selectorGroup);
     }
 }
Example #3
0
        private void GeneralExportItem_Click(object sender, RadRoutedEventArgs e)
        {
            var menuItem   = sender as RadMenuItem;
            var exportType = menuItem?.Tag as EnumExportType? ?? EnumExportType.TwoPlusTwo;

            ExportItem(handHistory => ExportFunctions.ConvertHHToForumFormat(handHistory, exportType));
        }
Example #4
0
 private void PlainTextExportItem_Click(object sender, RadRoutedEventArgs e)
 {
     if (ViewModel?.CurrentGame != null)
     {
         Clipboard.SetText(ExportFunctions.ConvertHHToForumFormat(ViewModel.CurrentGame, EnumExportType.PlainText));
         ViewModel.RaiseNotification(CommonResourceManager.Instance.GetResourceString(ResourceStrings.DataExportedMessageResourceString), "Hand Export");
     }
 }
Example #5
0
        private void ExportEC(object obj)
        {
            var EquityData = ExportFunctions.GetEquityDataToExport(GetBoardStringFormatted(), GetEquityStringFormatted(this.PlayersList));

            Clipboard.SetText(EquityData);
            RaiseNotification(CommonResourceManager.Instance.GetResourceString(ResourceStrings.DataExportedMessageResourceString), "Export");
            FinishInteraction();
        }
Example #6
0
        private void ExportHH(object obj)
        {
            var hh = ExportFunctions.ConvertHHToForumFormat(CurrentHandHistory, Model.Enums.EnumExportType.TwoPlusTwo);

            Clipboard.SetText(hh);
            RaiseNotification(CommonResourceManager.Instance.GetResourceString(ResourceStrings.DataExportedMessageResourceString), "Export");
            FinishInteraction();
        }
 public void ExportToExcel()
 {
     if (_Properties.DataView != null)
     {
         ExportFunctions.ExportToExcel(_Properties.DataView.Table, "ExportToExcel");
     }
     else
     {
         ExportFunctions.ExportToExcel(((IEntity)DataSource).GetDataSet().Tables[0], "ExportToExcel");
     }
 }
Example #8
0
        private void GeneralExportItem_Click(object sender, RadRoutedEventArgs e)
        {
            if (ViewModel?.CurrentGame != null)
            {
                var menuItem   = sender as RadMenuItem;
                var exportType = menuItem?.Tag as EnumExportType? ?? EnumExportType.TwoPlusTwo;

                Clipboard.SetText(ExportFunctions.ConvertHHToForumFormat(ViewModel.CurrentGame, exportType));
                ViewModel.RaiseNotification(CommonResourceManager.Instance.GetResourceString(ResourceStrings.DataExportedMessageResourceString), "Hand Export");
            }
        }
Example #9
0
        private void ExportBoth(object obj)
        {
            var hh = ExportFunctions.ConvertHHToForumFormat(CurrentHandHistory, Model.Enums.EnumExportType.TwoPlusTwo);

            var EquityData = ExportFunctions.GetEquityDataToExport(GetBoardStringFormatted(), GetEquityStringFormatted(this.PlayersList));
            var result     = hh + Environment.NewLine + Environment.NewLine + EquityData;

            Clipboard.SetText(result);
            RaiseNotification(CommonResourceManager.Instance.GetResourceString(ResourceStrings.DataExportedMessageResourceString), "Export");
            FinishInteraction();
        }
Example #10
0
        public void HandHistoryIsConvertedIntoForumFormatV2(string sourceFileName, string expectedResultFileName, EnumExportType exportType,
                                                            EnumPokerSites site, TestIndicators[] testIndicators)
        {
            var pr = Process.GetProcesses();

            var playerStatisticRepository = ServiceLocator.Current.GetInstance <IPlayerStatisticRepository>();

            playerStatisticRepository
            .GetPlayersIndicators <ExportIndicators>(Arg.Any <string[]>(), Arg.Any <short?>())
            .Returns(testIndicators?.ToDictionary(x => x.PlayerName, x => (ExportIndicators)x));

            var sourceFile         = Path.Combine(testFolder, sourceFileName);
            var expectedResultFile = Path.Combine(testFolder, expectedResultFileName);

            if (!File.Exists(sourceFile))
            {
                throw new Exception(string.Format("Test file '{0}' doesn't exist", sourceFile));
            }

            if (!File.Exists(expectedResultFile))
            {
                throw new Exception(string.Format("Test file '{0}' doesn't exist", expectedResultFile));
            }

            var handHistoryText = File.ReadAllText(sourceFile);

            var factory = new HandHistoryParserFactoryImpl();

            var parser = factory.GetFullHandHistoryParser(site);

            var handHistory = parser.ParseFullHandHistory(handHistoryText);

            var actualHandHistoryForumText = ExportFunctions.ConvertHHToForumFormat(handHistory, exportType, true);

            actualHandHistoryForumText = ReplaceHeader(actualHandHistoryForumText);

            var expectedHandHistoryForumText = File.ReadAllText(expectedResultFile);

            Assert.That(actualHandHistoryForumText, Is.EqualTo(expectedHandHistoryForumText));
        }
Example #11
0
 private void PlainExportItem_Click(object sender, RadRoutedEventArgs e)
 {
     ExportItem(handHistory => ExportFunctions.ConvertHHToForumFormat(handHistory, EnumExportType.PlainText));
 }
Example #12
0
        public IReadable Read()
        {
            var peHeaderReader = (PeHeaderReader) new PeHeaderReader(_filePath).Read();

            ExportTableDirectory = peHeaderReader.Is32BitPeHeader
                ? peHeaderReader.PeHeader32.OptionalHeader.ExportTable
                : peHeaderReader.PeHeader64.OptionalHeader.ExportTable;

            var address = RvaToRawFormatConverter.RvaToOffset32(ExportTableDirectory.VirtualAddress,
                                                                peHeaderReader.SectionHeaders,
                                                                peHeaderReader.Is32BitPeHeader
                    ? peHeaderReader.PeHeader32.OptionalHeader.SectionAlignment
                    : peHeaderReader.PeHeader64.OptionalHeader.SectionAlignment);

            using var fs = new FileStream(_filePath, FileMode.Open, FileAccess.Read);
            var br = new BinaryReader(fs);

            fs.Seek(address, SeekOrigin.Begin);

            ExportTable = PeBlockToStructConverter.ConvertTo <ExportTable>(br);

            var ordinalsTableAddress = RvaToRawFormatConverter.RvaToOffset32(ExportTable.AddressOfNameOrdinals,
                                                                             peHeaderReader.SectionHeaders,
                                                                             peHeaderReader.Is32BitPeHeader
                    ? peHeaderReader.PeHeader32.OptionalHeader.SectionAlignment
                    : peHeaderReader.PeHeader64.OptionalHeader.SectionAlignment);

            var functionsTableAddress = RvaToRawFormatConverter.RvaToOffset32(ExportTable.AddressOfFunctions,
                                                                              peHeaderReader.SectionHeaders,
                                                                              peHeaderReader.Is32BitPeHeader
                    ? peHeaderReader.PeHeader32.OptionalHeader.SectionAlignment
                    : peHeaderReader.PeHeader64.OptionalHeader.SectionAlignment);

            var namesTableAddress = RvaToRawFormatConverter.RvaToOffset32(ExportTable.AddressOfNames,
                                                                          peHeaderReader.SectionHeaders,
                                                                          peHeaderReader.Is32BitPeHeader
                    ? peHeaderReader.PeHeader32.OptionalHeader.SectionAlignment
                    : peHeaderReader.PeHeader64.OptionalHeader.SectionAlignment);

            fs.Seek(functionsTableAddress, SeekOrigin.Begin);

            for (UInt32 i = 0; i < ExportTable.NumberOfFunctions; i++)
            {
                var ordinal = ExportTable.Base + i;
                var exportFunctionAddress = br.ReadUInt32();
                ExportFunctions.Add(new ExportFunction()
                {
                    Address = exportFunctionAddress,
                    Ordinal = (UInt16)ordinal
                });
            }

            fs.Seek(namesTableAddress, SeekOrigin.Begin);

            for (UInt32 i = 0; i < ExportTable.NumberOfNames; i++)
            {
                var nameRva     = br.ReadUInt32();
                var nameAddress = RvaToRawFormatConverter.RvaToOffset32(nameRva,
                                                                        peHeaderReader.SectionHeaders,
                                                                        peHeaderReader.Is32BitPeHeader
                        ? peHeaderReader.PeHeader32.OptionalHeader.SectionAlignment
                        : peHeaderReader.PeHeader64.OptionalHeader.SectionAlignment);

                var currentPosition = fs.Position;
                fs.Seek(ordinalsTableAddress + sizeof(UInt16) * i, SeekOrigin.Begin);

                var ordinalIndex = br.ReadUInt16();
                fs.Seek(currentPosition, SeekOrigin.Begin);

                String name = ByteArrayToAsciiStringConverter.ConvertToString(fs, nameAddress);
                fs.Seek(currentPosition, SeekOrigin.Begin);

                if (RedirectionRva(ExportFunctions[ordinalIndex].Address))
                {
                    var redirectionNameAddress = RvaToRawFormatConverter.RvaToOffset32(ExportFunctions[ordinalIndex].Address,
                                                                                       peHeaderReader.SectionHeaders,
                                                                                       peHeaderReader.Is32BitPeHeader
                            ? peHeaderReader.PeHeader32.OptionalHeader.SectionAlignment
                            : peHeaderReader.PeHeader64.OptionalHeader.SectionAlignment);
                    String redirectionName = ByteArrayToAsciiStringConverter.ConvertToString(fs, redirectionNameAddress);
                    fs.Seek(currentPosition, SeekOrigin.Begin);

                    ExportFunctions[ordinalIndex].Name            = null;
                    ExportFunctions[ordinalIndex].RedirectionName = redirectionName;
                }
                else
                {
                    ExportFunctions[ordinalIndex].Name = name;
                }
            }

            return(this);
        }
Example #13
0
        private void BtnExport_Click(object sender, RoutedEventArgs e)
        {
            SelectorGroup selectorGroup = (SelectorGroup)((Button)sender).DataContext;

            ExportFunctions.ExportSelectorGroupToCSV(selectorGroup);
        }