Example #1
0
        /// <summary>
        /// Deserialize the WM in WmDsr. Downgrade Status to None as needed.
        /// Return true if it worked.
        /// </summary>
        public virtual bool DeserializeWm()
        {
            try
            {
                Status = KwmDeserializationStatus.Full;
                WmDsr.Deserialize();
                WmDsr.Wm.Initialize(Spawner.LocalDb);
                return true;
            }

            catch (Exception ex)
            {
                Logging.LogException(ex);
                WmDsr.Ex = ex;
                Status = KwmDeserializationStatus.None;
                return false;
            }
        }
Example #2
0
        /// <summary>
        /// Deserialize all the workspaces in KwsDsrList. Downgrade Status to
        /// partial as needed.
        /// </summary>
        public virtual void DeserializeAllKws()
        {
            // This tree is used to detect duplicate IDs.
            SortedDictionary<UInt64, Workspace> kwsTree = new SortedDictionary<UInt64, Workspace>();

            foreach (KwsDeserializer KwsDsr in KwsDsrList)
            {
                CurKwsDsr = KwsDsr;

                try
                {
                    KwsDsr.Deserialize();
                    Workspace kws = KwsDsr.Kws;
                    if (kws.InternalID == 0)
                        throw new Exception(Base.GetKwsString() + " has no internal ID");
                    if (kwsTree.ContainsKey(kws.InternalID))
                        throw new Exception(Base.GetKwsString() + " has duplicate internal ID " + kws.InternalID);
                    kwsTree.Add(kws.InternalID, kws);
                }

                catch (Exception ex)
                {
                    Logging.LogException(ex);
                    KwsDsr.Ex = ex;
                    if (Status != KwmDeserializationStatus.None) Status = KwmDeserializationStatus.Partial;
                }

                CurKwsDsr = null;
            }
        }