Exemple #1
0
        private void tabControlSets_Selected(object sender, TabControlEventArgs e)
        {
            TabPage tab = e.TabPage;

            if (tab != null)
            {
                if ((tab == tabPagePanorama) || (tab == tabPageObsolete))
                {
                    if (tab == tabPagePanorama)
                    {
                        _stories = _storyProject[Properties.Resources.IDS_MainStoriesSet];
                    }
                    else if (tab == tabPageObsolete)
                    {
                        _stories = _storyProject[Properties.Resources.IDS_ObsoleteStoriesSet];
                    }
                    InitParentTab(tab);
                    InitGrid();
                }
            }
        }
		public ProjectSettingsForm(StoriesData theStoriesData, ProjectSettings theProjSettings)
		{
			_theProjSettings = theProjSettings;
			InitializeComponent();
		}
Exemple #3
0
        /// <summary>
        /// Build by project by reference array of verse text for this term
        /// </summary>
        internal void ReadVerseText(Term myTerm, StoryProjectData theSPD, ProgressBar progressBarLoadingKeyTerms)
        {
            mapReferenceToVerseTextList = new Dictionary <string, List <string> >();

            ArrayList vrefs = new ArrayList();

            foreach (var vref in myTerm.VerseRefs())
            {
                vrefs.Add(vref.BBBCCCVVVS());
            }

            // List<VerseRef> vrefs = new List<VerseRef>(myTerm.VerseRefs());

            // get the current stories only (not the obsolete ones)
            StoriesData theStories = theSPD[Properties.Resources.IDS_MainStoriesSet];

            progressBarLoadingKeyTerms.Maximum = theStories.Count;
            progressBarLoadingKeyTerms.Value   = 0;

            for (int nStoryNumber = 0; nStoryNumber < theStories.Count; nStoryNumber++)
            {
                StoryData aStory = theStories[nStoryNumber];
                for (int nVerseNumber = 0; nVerseNumber < aStory.Verses.Count; nVerseNumber++)
                {
                    VerseData aVerse = aStory.Verses[nVerseNumber];
                    for (int nAnchorNumber = 0; nAnchorNumber < aVerse.Anchors.Count; nAnchorNumber++)
                    {
                        AnchorData anAnchor    = aVerse.Anchors[nAnchorNumber];
                        VerseRef   theVerseRef = new VerseRef(anAnchor.AnchorAsVerseRef);
                        int        nIndex      = vrefs.BinarySearch(theVerseRef.BBBCCCVVVS());
                        if (nIndex < 0)
                        {
                            continue;
                        }

                        string strVerseReference = String.Format("Story: '{0}' line: {1} anchor: {2}",
                                                                 aStory.Name, nVerseNumber + 1, anAnchor.JumpTarget);

                        List <string> astrVerseText = new List <string>(projectVariablesList.Count);
                        if (theSPD.ProjSettings.Vernacular.HasData)
                        {
                            astrVerseText.Add(aVerse.VernacularText.ToString());
                        }
                        if (theSPD.ProjSettings.NationalBT.HasData)
                        {
                            astrVerseText.Add(aVerse.NationalBTText.ToString());
                        }
                        if (theSPD.ProjSettings.InternationalBT.HasData)
                        {
                            astrVerseText.Add(aVerse.InternationalBTText.ToString());
                        }

                        // keep track of this verse and it's reference
                        if (!mapReferenceToVerseTextList.ContainsKey(strVerseReference))
                        {
                            mapReferenceToVerseTextList.Add(strVerseReference, astrVerseText);
                        }

                        // we don't need to do any more anchors with this same line of the same story
                        //  so set the anchor # to the number of anchors so the next outer for loop
                        //  will think it's finished
                        nAnchorNumber = aVerse.Anchors.Count;
                        break;
                    }
                }
                progressBarLoadingKeyTerms.Value++;
            }
        }
Exemple #4
0
        static void Main(string[] args)
        {
            string[] astrBt = File.ReadAllLines(CstrBtFile);
            CleanSfmFileContents(ref astrBt);
            string[] astrRet = File.ReadAllLines(CstrRetFile);
            CleanSfmFileContents(ref astrRet);
            string[] astrCon = File.ReadAllLines(CstrConFile);
            CleanSfmFileContents(ref astrCon);
            string[] astrCoa = File.ReadAllLines(CstrCoaFile);
            CleanSfmFileContents(ref astrCoa);

            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "Browse for the existing version of the output file (so we can reuse the GUIDs)";
            StoriesData theStories;
            bool        bUsingStoryProject;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                StoryProject projFile = new StoryProject();
                projFile.ReadXml(dlg.FileName);
                ProjectSettings projSettings = new ProjectSettings(Path.GetDirectoryName(dlg.FileName), Path.GetFileNameWithoutExtension(dlg.FileName));

                theStories = new StoriesData(projFile, projSettings);

                // import the member ids so we keep their same guids
                foreach (TeamMemberData aTMD in theStories.TeamMembers.Values)
                {
                    MemberGuid(theStories.TeamMembers, aTMD.Name, aTMD.MemberType);
                }

                bUsingStoryProject = true;
            }
            else
            {
                ProjectSettings projSettings = new ProjectSettings(Path.GetDirectoryName(CstrDefOutputFile), Path.GetFileNameWithoutExtension(CstrDefOutputFile));
                theStories         = new StoriesData(projSettings);
                bUsingStoryProject = false;
            }

            // skip down to the title of the first story (in each file)
            int nIndexBt = 0, nIndexRet = 0, nIndexCon = 0, nIndexCoa = 0;

            SkipTo(@"\t ", null, @"\t ", astrBt, ref nIndexBt);
            SkipTo(@"\t ", null, @"\t ", astrRet, ref nIndexRet);
            SkipTo(@"\t ", null, @"\t ", astrCon, ref nIndexCon);
            SkipTo(@"\t ", null, @"\t ", astrCoa, ref nIndexCoa);

            int nStoryNumber = 0;

            while (nIndexBt != -1)
            {
                System.Diagnostics.Debug.Assert(
                    (astrBt[nIndexBt] == astrRet[nIndexRet]) &&
                    (astrBt[nIndexBt] == astrCon[nIndexCon]) &&
                    (astrBt[nIndexBt] == astrCoa[nIndexCoa]), "Fixup problem in data files: one file has an extra record");

                string    strStoryName = astrBt[nIndexBt].Substring(3);
                StoryData story;
                if (bUsingStoryProject)
                {
                    story = theStories[nStoryNumber++];
                }
                else
                {
                    story = new StoryData(strStoryName, null);
                }

                Console.WriteLine("Story: " + strStoryName);

                // first process the 'story front matter (reason, testors, etc)'
                string strTestorGuid;
                DoStoryFrontMatter(theStories, story, astrBt, ref nIndexBt, bUsingStoryProject, out strTestorGuid);

                int nVerseNumber = 0;
                while (nIndexBt < astrBt.Length)
                {
                    string strRef = astrBt[nIndexBt].Substring(4);
                    Console.WriteLine(" ln: " + strRef);

                    VerseData verse;
                    if (bUsingStoryProject)
                    {
                        System.Diagnostics.Debug.Assert((nVerseNumber < story.Verses.Count), String.Format("Verse count not the same: this could be because some verse in chapter with '{0}' has no data for all files (so it wasn't ultimately added the first time thru)", strRef));
                        verse = story.Verses[nVerseNumber];

                        // clear out any data that doesn't have guids (so we don't add them again)
                        verse.Anchors.Clear();
                        verse.TestQuestions.Clear();                            // these have IDs, but they're member IDs which should get picked up correctly
                        verse.Retellings.Clear();                               // same here
                    }
                    else
                    {
                        verse = new VerseData();
                    }

                    DoVerseData(verse, astrBt, strTestorGuid, ref nIndexBt);

                    // now grab the retelling
                    if (SkipTo(@"\ln ", strRef, @"\c ", astrRet, ref nIndexRet))
                    {
                        DoRetellingData(astrRet, ref nIndexRet, verse, strTestorGuid);
                    }

                    // now grab the consultant notes
                    if (SkipTo(@"\ln ", strRef, @"\c ", astrCon, ref nIndexCon))
                    {
                        DoConsultData(astrCon, ref nIndexCon, bUsingStoryProject, verse.ConsultantNotes, @"\con", CstrConsultantsInitials,
                                      CastrConsultantMenteeSfms, ConsultNoteDataConverter.CommunicationDirections.eConsultantToCrafter,
                                      ConsultNoteDataConverter.CommunicationDirections.eCrafterToConsultant);
                    }

                    // now grab the coach notes
                    if (SkipTo(@"\ln ", strRef, @"\c ", astrCoa, ref nIndexCoa))
                    {
                        DoConsultData(astrCoa, ref nIndexCoa, bUsingStoryProject, verse.CoachNotes, @"\cch", CstrCoachsInitials,
                                      CastrCoachMenteeSfms, ConsultNoteDataConverter.CommunicationDirections.eCoachToConsultant,
                                      ConsultNoteDataConverter.CommunicationDirections.eConsultantToCoach);
                    }

                    if (verse.HasData)
                    {
                        if (bUsingStoryProject)
                        {
                            nVerseNumber++;
                        }
                        else
                        {
                            story.Verses.Add(verse);
                        }
                    }

                    if ((nIndexBt >= astrBt.Length) || (astrBt[nIndexBt].Substring(0, 3) == @"\c "))
                    {
                        // TODO: for others, we could do a special case if there's a second record with an earlier retelling
                        //  (but for K&D, those lines aren't likely to have any association with the current version of the story...

                        if (nIndexBt < astrBt.Length)
                        {
                            System.Diagnostics.Debug.Assert(
                                (astrBt[nIndexBt] == astrRet[nIndexRet]) &&
                                (astrBt[nIndexBt] == astrCon[nIndexCon]) &&
                                (astrBt[nIndexBt] == astrCoa[nIndexCoa]), "Fixup problem in data files: one file has an extra record");
                        }

                        break;
                    }
                }

                story.ProjStage.ProjectStage = StoryStageLogic.ProjectStages.eCoachReviewTest2Notes;
                if (!bUsingStoryProject)
                {
                    theStories.Add(story);
                }
                SkipTo(@"\t ", null, @"\t ", astrBt, ref nIndexBt);
                SkipTo(@"\t ", null, @"\t ", astrRet, ref nIndexRet);
                SkipTo(@"\t ", null, @"\t ", astrCon, ref nIndexCon);
                SkipTo(@"\t ", null, @"\t ", astrCoa, ref nIndexCoa);
            }

            theStories.ProjSettings.Vernacular.LangName      = CstrVernName;
            theStories.ProjSettings.Vernacular.LangCode      = CstrVernCode;
            theStories.ProjSettings.Vernacular.FullStop      = CstrVernFullStop;
            theStories.ProjSettings.NationalBT.LangName      = CstrNatlName;
            theStories.ProjSettings.NationalBT.LangCode      = CstrNatlCode;
            theStories.ProjSettings.NationalBT.FullStop      = CstrNatlFullStop;
            theStories.ProjSettings.InternationalBT.LangName = CstrIntlName;
            theStories.ProjSettings.InternationalBT.LangCode = CstrIntlCode;
            SaveXElement(theStories.GetXml, theStories.ProjSettings.ProjectFileName);
        }
Exemple #5
0
        private static void DoStoryFrontMatter(StoriesData theStories, StoryData story, string[] astrBt, ref int nIndexBt,
                                               bool bUsingStoryProject, out string strTestorGuid)
        {
            strTestorGuid = null;
            string strMarker, strData;

            ParseLine(astrBt[++nIndexBt], out strMarker, out strData);
            while (strMarker != @"\ln")
            {
                if (strMarker == @"\co")                    // comment field
                {
                    if (BeginsWith(strData, CstrReasonLable))
                    {
                        string strStoryPurpose = strData.Substring(CstrReasonLable.Length).Trim();
                        if (String.IsNullOrEmpty(strStoryPurpose))
                        {
                            strStoryPurpose = null;
                        }
                        if (bUsingStoryProject)
                        {
                            System.Diagnostics.Debug.Assert(story.CraftingInfo.StoryPurpose == strStoryPurpose);
                        }
                        else
                        {
                            story.CraftingInfo.StoryPurpose = strStoryPurpose;
                        }
                    }
                    else if (BeginsWith(strData, CstrStoryCrafter))
                    {
                        string strCrafterName = strData.Substring(CstrStoryCrafter.Length).Trim();
                        System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(strCrafterName));
                        string strCrafterGuid = MemberGuid(theStories.TeamMembers, strCrafterName, TeamMemberData.UserTypes.eCrafter);

                        if (bUsingStoryProject)
                        {
                            if (String.IsNullOrEmpty(story.CraftingInfo.StoryCrafterMemberID) && !String.IsNullOrEmpty(strCrafterGuid))
                            {
                                story.CraftingInfo.StoryCrafterMemberID = strCrafterGuid;
                            }
                            System.Diagnostics.Debug.Assert(story.CraftingInfo.StoryCrafterMemberID == strCrafterGuid);
                        }
                        else
                        {
                            story.CraftingInfo.StoryCrafterMemberID = strCrafterGuid;
                        }
                    }
                    else if (BeginsWith(strData, CstrBackTranslator))
                    {
                        string strBackTranslatorName = strData.Substring(CstrBackTranslator.Length).Trim();
                        string strBackTranslatorGuid = null;
                        if (!String.IsNullOrEmpty(strBackTranslatorName))
                        {
                            strBackTranslatorGuid = MemberGuid(theStories.TeamMembers, strBackTranslatorName, TeamMemberData.UserTypes.eUNS);
                        }

                        if (bUsingStoryProject)
                        {
                            System.Diagnostics.Debug.Assert(story.CraftingInfo.BackTranslatorMemberID == strBackTranslatorGuid);
                        }
                        else
                        {
                            story.CraftingInfo.BackTranslatorMemberID = strBackTranslatorGuid;
                        }
                    }
                    else if (BeginsWith(strData, CstrTestor1))
                    {
                        string strTestor1 = strData.Substring(CstrTestor1.Length).Trim();
                        if (!String.IsNullOrEmpty(strTestor1))
                        {
                            strTestorGuid = MemberGuid(theStories.TeamMembers, strTestor1, TeamMemberData.UserTypes.eUNS);
                            if (bUsingStoryProject)
                            {
                                System.Diagnostics.Debug.Assert(story.CraftingInfo.Testors[1] == strTestorGuid);
                            }
                            else
                            {
                                story.CraftingInfo.Testors.Add(1, strTestorGuid);
                            }
                        }
                    }
                    else if (BeginsWith(strData, CstrTestor2))
                    {
                        string strTestor2 = strData.Substring(CstrTestor2.Length).Trim();
                        if (!String.IsNullOrEmpty(strTestor2))
                        {
                            strTestorGuid = MemberGuid(theStories.TeamMembers, strTestor2, TeamMemberData.UserTypes.eUNS);
                            if (bUsingStoryProject)
                            {
                                System.Diagnostics.Debug.Assert(story.CraftingInfo.Testors[2] == strTestorGuid);
                            }
                            else
                            {
                                story.CraftingInfo.Testors.Add(2, strTestorGuid);
                            }
                        }
                    }
                }
                else if (strMarker == @"\c")                    // chapter field
                {
                    break;
                }

                ParseLine(astrBt[++nIndexBt], out strMarker, out strData);
            }
        }