Beispiel #1
0
        private IEnumerator CoImport(IFileImporter importer, string path)
        {
            IRTE rte = IOC.Resolve <IRTE>();

            rte.IsBusy = true;

            IProjectTree projectTree = IOC.Resolve <IProjectTree>();
            string       targetPath  = Path.GetFileNameWithoutExtension(path);

            if (projectTree != null && projectTree.SelectedItem != null)
            {
                ProjectItem folder = projectTree.SelectedItem;

                targetPath = folder.RelativePath(false) + "/" + targetPath;
                targetPath = targetPath.TrimStart('/');

                IProject project = IOC.Resolve <IProject>();
                targetPath = project.GetUniquePath(targetPath, typeof(Texture2D), folder);
            }

            yield return(StartCoroutine(importer.Import(path, targetPath)));

            rte.IsBusy = false;
            m_parentDialog.Close();

            rte.ActivateWindow(RuntimeWindowType.Scene);
        }
Beispiel #2
0
        protected override IEnumerable <ParsingResult> ImportHand(string handHistory, GameInfo gameInfo, IFileImporter dbImporter, DHProgress progress)
        {
            // client window contains some additional information about the game, so add it to the HH if possible
            handHistory = AddAdditionalData(handHistory, gameInfo);

            return(dbImporter.Import(handHistory, progress, gameInfo));
        }
        private IEnumerator CoImport(IFileImporter importer, string path)
        {
            IRTE rte = IOC.Resolve <IRTE>();

            rte.IsBusy = true;

            IProjectTree projectTree = IOC.Resolve <IProjectTree>();
            string       targetPath  = Path.GetFileNameWithoutExtension(path);

            if (projectTree != null && projectTree.SelectedFolder != null)
            {
                ProjectItem folder = projectTree.SelectedFolder;

                targetPath = folder.RelativePath(false) + "/" + targetPath;
                targetPath = targetPath.TrimStart('/');

                IProject project = IOC.Resolve <IProject>();

                targetPath = project.GetUniquePath(targetPath, typeof(Texture2D), folder);
            }

            yield return(importer.Import(path, targetPath));

            rte.IsBusy = false;
        }
Beispiel #4
0
        protected override IEnumerable <ParsingResult> ImportHand(string handHistory, GameInfo gameInfo, IFileImporter dbImporter, DHProgress progress)
        {
            var parsingResults = dbImporter.Import(handHistory, progress, gameInfo);

            IPokerFileInfo importedFileInfo = null;

            if (importedHandsHistory.ContainsKey(gameInfo.FullFileName))
            {
                importedFileInfo = importedHandsHistory[gameInfo.FullFileName];
            }
            else
            {
                importedFileInfo = new IPokerFileInfo();
                importedHandsHistory.Add(gameInfo.FullFileName, importedFileInfo);
            }

            foreach (var parsingResult in parsingResults)
            {
                if (parsingResult != null && parsingResult.HandHistory != null &&
                    !importedFileInfo.ImportedHands.Contains(parsingResult.HandHistory.Gamenumber))
                {
                    importedFileInfo.ImportedHands.Add(parsingResult.HandHistory.Gamenumber);
                }
            }

            return(parsingResults);
        }
Beispiel #5
0
        /// <summary>
        /// This method performs the actual import logic.
        /// </summary>
        /// <remarks>This method can throw exceptions of any kind.</remarks>
        protected override void OnRun()
        {
            fileImporter.SetProgressChanged((currentStepName, currentStep, totalSteps) =>
            {
                ProgressText = string.Format(CultureInfo.CurrentCulture,
                                             Resources.FileImportActivity_ImportFromFile_Step_CurrentProgress_0_of_TotalProgress_1_ProgressText_2,
                                             currentStep, totalSteps, currentStepName);
            });

            bool importSuccessful = fileImporter.Import();

            if (State == ActivityState.Canceled)
            {
                if (importSuccessful)
                {
                    State = ActivityState.Executed;
                }
            }
            else if (!importSuccessful)
            {
                State = ActivityState.Failed;
            }
        }
Beispiel #6
0
        public IEnumerable <ParsingResult> Import(IFileImporter fileImporter, string handHistoryFileContent, GameInfo gameInfo)
        {
            var progress = Substitute.For <IDHProgress>();

            var xDocument = XDocument.Parse(handHistoryFileContent);

            var handHistoryNodes = xDocument.Descendants("HandHistory");

            var result = new List <ParsingResult>();

            foreach (var handHistoryNode in handHistoryNodes)
            {
                var xml = handHistoryNode.ToString();
                var betOnlineXmlConverter = new BetOnlineXmlToIPokerXmlConverter();
                betOnlineXmlConverter.Initialize(xml);

                var convertedResult = betOnlineXmlConverter.Convert();

                result.AddRange(fileImporter.Import(convertedResult.ConvertedXml, progress, convertedResult.GameInfo));
            }

            return(result);
        }
        public IEnumerable <ParsingResult> Import(IFileImporter fileImporter, string handHistoryFileContent, GameInfo gameInfo)
        {
            var progress = Substitute.For <IDHProgress>();

            return(fileImporter.Import(handHistoryFileContent, progress, gameInfo));
        }
Beispiel #8
0
 protected virtual IEnumerable <ParsingResult> ImportHand(string handHistory, GameInfo gameInfo, IFileImporter importer, DHProgress progress)
 {
     return(importer.Import(handHistory, progress, gameInfo));
 }