コード例 #1
0
//    private IList<FamilyFileTypeBaseClass> codecList2;



        public FamilyFileTypeCollection()
        {
            trace = new TraceSource("FamilyFileTypeCollection", SourceLevels.Warning);

            trace.TraceInformation("FamilyFileTypeCollection::FamilyFileTypeCollection()");
            selectedType = FamilyFileType.Unknown;

            codecList = new List <FamilyFileTypeBaseClass>();

            //FamilyFileTypeBaseClass gedcomCodec;
            //FamilyFileTypeBaseClass anarkivCodec;
            //FamilyFileTypeBaseClass geniCodec;

            //gedcomCodec = new GedcomDecoder();
            codecList.Add(new XmlFileType());
            codecList.Add(new GedcomDecoder());

            //anarkivCodec = new AnarkivFileType();
            codecList.Add(new AnarkivFileType());

            //geniCodec = new GeniFileType();
            codecList.Add(new GeniFileType());
            //codecList.Add(new MyHeritageFileType());
            codecList.Add(new TextDecoder());
        }
コード例 #2
0
        public bool IsKnownFileType(String fileName)
        {
            foreach (FamilyFileTypeBaseClass fileType in codecList)
            {
                trace.TraceInformation("IsKnownFileType - check " + fileType.GetType());

                if (fileType.IsKnownFileType(fileName))
                {
                    selectedType = GetType(fileType);
                    return(true);
                }
            }
            return(false);
        }
コード例 #3
0
        /*public bool OpenWeb(String fileName, FamilyTreeStoreBaseClass inFamilyTree)
         * {
         * foreach (FamilyFileTypeBaseClass fileType in codecList)
         * {
         *  trace.TraceInformation("OpenWeb(" + fileName + "):" + fileType.GetType() + ":" + fileType.IsKnownFileType(fileName));
         *  if (fileType.GetFileTypeWebName() == fileName)
         *  {
         *    //selectedType = GetType(fileType);
         *    return fileType.OpenFile(fileName, inFamilyTree);
         *  }
         * }
         * return false;
         * }*/

        public FamilyTreeStoreBaseClass CreateFamilyTreeStore(String fileName, CompletedCallback callback)
        {
            if ((fileName == null) || (fileName == ""))
            {
                FamilyTreeStoreRam nativeStore = new FamilyTreeStoreRam();

                callback(true);
                return(nativeStore);
            }
            foreach (FamilyFileTypeBaseClass fileType in codecList)
            {
                trace.TraceInformation("CreateFamilyTreeStore " + fileType.GetType() + ":" + fileType.IsKnownFileType(fileName));
                if (fileType.IsKnownFileType(fileName))
                {
                    selectedType = GetType(fileType);
                    return(fileType.CreateFamilyTreeStore(fileName, callback));
                }
            }
            trace.TraceInformation("CreateFamilyTreeStore():null");
            callback(false);
            return(null);
        }