示例#1
0
        public WorkspaceScopeList Clone()
        {
            var clone = new WorkspaceScopeList();

            foreach (var scope in this._scopes)
            {
                clone.Add(scope.Clone());
            }

            return(clone);
        }
示例#2
0
        protected Task <T> ScopeAsync <T>(string name)
            where T : ScopeVariables, new()
        {
            var scope = new T();

            _scopes.Add(new WorkspaceScope {
                Name = name, TypeName = typeof(T).FullName, Variables = scope
            });

            return(Task.FromResult(scope));
        }
示例#3
0
        public static WorkspaceScopeList Deserialize(string text)
        {
            var list = JsonConvert.DeserializeObject <List <WorkspaceScopeGeneric> >(text);

            var scopeList = new WorkspaceScopeList();

            foreach (var line in list)
            {
                var variableType = Type.GetType(line.TypeName);
                var variables    = line.Variables.ToObject(variableType);

                WorkspaceScope scope = new WorkspaceScope()
                {
                    Name      = line.Name,
                    TypeName  = line.TypeName,
                    Variables = (ScopeVariables)variables
                };

                scopeList.Add(scope);
            }
            return(scopeList);
        }