Exemple #1
0
        public override void Reset()
        {
            objectToId = new Dictionary <object, int> ();
            idToObject = new Dictionary <int, object> ();

            xmlDocument = null;
            //projectInfoNode = null;

            currentStep = OpenerTaskStep.Init;

            base.Reset();
        }
Exemple #2
0
                // Private methods ////////////////////////////////////////////

                protected override TaskStatus ExecuteStep (int s)
                {
                        bool cont = true;

                        // Main
                        switch (currentStep) {

                                case OpenerTaskStep.Init:
                                        objectsList = new List <ObjectInfo> ();
                                        xmlDocument = new XmlDocument ();
                                        xmlDocument.Load (fileName);
                                        currentStep = OpenerTaskStep.Header;
                                        break;

                                case OpenerTaskStep.Header:
                                        //ReadHeader ();
                                        currentStep = OpenerTaskStep.ProjectInfoRead;
                                        break;

                                case OpenerTaskStep.ProjectInfoRead:
                                        foreach (XmlNode node in xmlDocument.DocumentElement.ChildNodes)
                                                if (node.Name == "projectinfo")
                                                        ResolveProjectInfoNode (node);

                                        // FIXME: Fail if not found/not resolved
                                        currentStep = OpenerTaskStep.ObjectListRead;
                                        break;

                                case OpenerTaskStep.ObjectListRead:
                                        foreach (XmlNode node in xmlDocument.DocumentElement.ChildNodes)
                                                if (node.Name == "objectlist")
                                                        objectListContainer = (ObjectListContainer)
                                                                DataFactory.MakeDataElement  (node as XmlElement);

                                        if (objectListContainer == null)
                                                throw new Exception ("ObjectListContainer not found!");

                                        currentStep = OpenerTaskStep.ObjectListParse;
                                        break;

                                case OpenerTaskStep.ObjectListParse:
                                        bool flush = EnumerateSomeObjects ();
                                        if (flush)
                                                currentStep = OpenerTaskStep.ObjectListUnBoil;
                                        break;

                                case OpenerTaskStep.ObjectListUnBoil:
                                        bool done = UnBoilSomeObjects ();
                                        if (done)
                                                currentStep = OpenerTaskStep.FindRoots;
                                        break;


                                case OpenerTaskStep.FindRoots:
                                        projectTrackList = (TrackList) FindRoot ("tracklist");
                                        projectTagList = (TagList) FindRoot ("taglist");
                                        projectStuffList = (StuffList) FindRoot ("stufflist");
                                        projectClipList = (ClipList) FindRoot ("cliplist");
                                        projectMediaItemList = (MediaItemList) FindRoot ("mediaitemlist");
                                        projectPipeline = (Gdv.Pipeline) FindRoot ("pipeline");
                                        projectCommander = (Commander) FindRoot ("commander");
                                        projectFormat = (Gdv.ProjectFormat) FindRoot ("projectformat");

                                        currentStep = OpenerTaskStep.Finished;
                                        break;

                                case OpenerTaskStep.Finished:
                                        cont = false;
                                        break;

                                default:
                                        break;
                        }

                        // Post
                        if (cont)
                                return TaskStatus.Running;
                        else
                                return TaskStatus.Done;
                }
Exemple #3
0
                public override void Reset ()
                {
                        objectToId = new Dictionary <object, int> ();
                        idToObject = new Dictionary <int, object> ();

                        xmlDocument = null;
                        //projectInfoNode = null;

                        currentStep = OpenerTaskStep.Init;

                        base.Reset ();
                }
Exemple #4
0
        // Private methods ////////////////////////////////////////////

        protected override TaskStatus ExecuteStep(int s)
        {
            bool cont = true;

            // Main
            switch (currentStep)
            {
            case OpenerTaskStep.Init:
                objectsList = new List <ObjectInfo> ();
                xmlDocument = new XmlDocument();
                xmlDocument.Load(fileName);
                currentStep = OpenerTaskStep.Header;
                break;

            case OpenerTaskStep.Header:
                //ReadHeader ();
                currentStep = OpenerTaskStep.ProjectInfoRead;
                break;

            case OpenerTaskStep.ProjectInfoRead:
                foreach (XmlNode node in xmlDocument.DocumentElement.ChildNodes)
                {
                    if (node.Name == "projectinfo")
                    {
                        ResolveProjectInfoNode(node);
                    }
                }

                // FIXME: Fail if not found/not resolved
                currentStep = OpenerTaskStep.ObjectListRead;
                break;

            case OpenerTaskStep.ObjectListRead:
                foreach (XmlNode node in xmlDocument.DocumentElement.ChildNodes)
                {
                    if (node.Name == "objectlist")
                    {
                        objectListContainer = (ObjectListContainer)
                                              DataFactory.MakeDataElement(node as XmlElement);
                    }
                }

                if (objectListContainer == null)
                {
                    throw new Exception("ObjectListContainer not found!");
                }

                currentStep = OpenerTaskStep.ObjectListParse;
                break;

            case OpenerTaskStep.ObjectListParse:
                bool flush = EnumerateSomeObjects();
                if (flush)
                {
                    currentStep = OpenerTaskStep.ObjectListUnBoil;
                }
                break;

            case OpenerTaskStep.ObjectListUnBoil:
                bool done = UnBoilSomeObjects();
                if (done)
                {
                    currentStep = OpenerTaskStep.FindRoots;
                }
                break;


            case OpenerTaskStep.FindRoots:
                projectTrackList     = (TrackList)FindRoot("tracklist");
                projectTagList       = (TagList)FindRoot("taglist");
                projectStuffList     = (StuffList)FindRoot("stufflist");
                projectClipList      = (ClipList)FindRoot("cliplist");
                projectMediaItemList = (MediaItemList)FindRoot("mediaitemlist");
                projectPipeline      = (Gdv.Pipeline)FindRoot("pipeline");
                projectCommander     = (Commander)FindRoot("commander");
                projectFormat        = (Gdv.ProjectFormat)FindRoot("projectformat");

                currentStep = OpenerTaskStep.Finished;
                break;

            case OpenerTaskStep.Finished:
                cont = false;
                break;

            default:
                break;
            }

            // Post
            if (cont)
            {
                return(TaskStatus.Running);
            }
            else
            {
                return(TaskStatus.Done);
            }
        }