Dev2.Session.Dev2StudioSessionBroker.InitDebugSession C# (CSharp) Method

InitDebugSession() public method

Init the Debug Session
public InitDebugSession ( DebugTO to ) : DebugTO
to DebugTO
return DebugTO
        public DebugTO InitDebugSession(DebugTO to)
        {
            DebugTO tmp;

            to.Error = string.Empty;

            // Bootstrap the operations
            if (to.BaseSaveDirectory != null)
            {
                BootstrapPersistence(to.BaseSaveDirectory);
                InitPersistSettings();
            }
            else if (to.BaseSaveDirectory == null && _debugPersistSettings.Count == 0)
            {
                BootstrapPersistence(_rootPath);
                InitPersistSettings();
            }

            if (to.BaseSaveDirectory == null)
            {
                // set the save location
                to.BaseSaveDirectory = _rootPath;
            }


            if (to.DataList != null)
            {
                to.DataListHash = to.DataList.GetHashCode(); // set incoming DL hash
            }
            else
            {
                to.DataListHash = -1; // default value
            }

            lock(SettingsLock)
            {
                if (_debugPersistSettings.TryGetValue(to.WorkflowID, out tmp))
                {
                    to.XmlData = tmp.RememberInputs
                        ? tmp.XmlData
                        : (to.XmlData ?? "<DataList></DataList>");
                    tmp.CleanUp();
                }
                else
                {
                    // if no XML data copy over the DataList
                    to.XmlData = to.XmlData != null && to.XmlData == string.Empty
                        ? (to.DataList ?? "<DataList></DataList>")
                        : (to.XmlData ?? "<DataList></DataList>");                    
                }
                to.BinaryDataList = new DataListModel();
                to.BinaryDataList.Create(to.XmlData, to.DataList);
            }

            if (tmp != null) tmp.CleanUp();
            return to;
        }