Esempio n. 1
0
 public StorySettings(StoryProject.storyRow theStoryRow, StoryProject projFile, TeamMemberData loggedOnMember)
 {
     StoryName    = theStoryRow.name;
     StoryGuid    = theStoryRow.guid;
     ProjStage    = new StoryStageLogic(theStoryRow.stage, loggedOnMember);
     CraftingInfo = new CraftingInfoData(theStoryRow, projFile, loggedOnMember);
 }
Esempio n. 2
0
        public CraftingInfoData(StoryProject.storyRow theStoryRow, StoryProject projFile, TeamMemberData loggedOnMember)
        {
            StoryProject.CraftingInfoRow[] aCIRs = theStoryRow.GetCraftingInfoRows();
            if (aCIRs.Length == 1)
            {
                StoryProject.CraftingInfoRow theCIR = aCIRs[0];

                StoryProject.StoryCrafterRow[] aSCRs = theCIR.GetStoryCrafterRows();
                if (aSCRs.Length == 1)
                {
                    StoryCrafterMemberID = aSCRs[0].memberID;
                }
                else
                {
                    StoryCrafterMemberID = loggedOnMember.MemberGuid;
                }

                StoryPurpose = theCIR.StoryPurpose;

                StoryProject.BackTranslatorRow[] aBTRs = theCIR.GetBackTranslatorRows();
                if (aBTRs.Length == 1)
                {
                    BackTranslatorMemberID = aBTRs[0].memberID;
                }

                StoryProject.TestsRow[] aTsRs = theCIR.GetTestsRows();
                if (aTsRs.Length == 1)
                {
                    foreach (StoryProject.TestRow aTR in aTsRs[0].GetTestRows())
                    {
                        Testors.Add(aTR.number, aTR.memberID);
                    }
                }
            }
            else
            {
                StoryCrafterMemberID = loggedOnMember.MemberGuid;
            }
        }
Esempio n. 3
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);
        }