private static IWorkspaceInternal InitWorkspaceInternal(List<string> typeDirectories, string workspaceDirectory, string cacheDirectory, StreamManager manager) { lock (s_padlock) { return new Workspace(workspaceDirectory, cacheDirectory, typeDirectories, manager); } }
/// <summary> /// Initializes a new instance of the <see cref="CachingSerializer"/> class. /// </summary> /// <param name="streamManager">The stream manager.</param> /// <param name="path">The path.</param> /// <param name="cachePath">The cache path.</param> /// <param name="supportedTypes">The supported types.</param> /// <param name="writeToDisc">if set to <c>true</c> the streams are written to disc. Note, if the value is false, then the writeXml does not matter, cause xml is not going to be written to disc anyway</param> /// <param name="writeXml">if set to <c>true</c> [write XML].</param> public CachingSerializer(StreamManager streamManager, string path, string cachePath, Type[] supportedTypes, bool writeToDisc, bool writeXml) { StreamMgr = streamManager; DataPath = path; //assures path is not null and that it is absolute path CachePath = cachePath; //assures path is not null and that it is absolute path SupportedTypes = supportedTypes; WriteXml = writeXml; WriteToDisc = writeToDisc; }
private Workspace(StreamManager manager) { m_writeXml = false; m_dataUnits = new Dictionary<string, WorkspaceUnit>(); //init stream manager m_streamManager = manager; //init observable collections m_unitsViewCollection = new ObservableCollection<WorkspaceUnit>(); m_readonlyUnitsViewCollection = new ReadOnlyObservableCollection<WorkspaceUnit>(m_unitsViewCollection); }
/// <summary> /// Creates a new s_instance of the Workspace with the given workspace and cache directories, without pre-loading supported types. /// </summary> /// <param name="workspaceDir">Where XML workspace data should be stored</param> /// <param name="cacheDir">Where binary workspace data should be stored</param> public Workspace(string workspaceDir, string cacheDir, StreamManager manager) : this(manager) { WorkspaceDir = workspaceDir; CacheTempDir = cacheDir; InitCache(); }
/// <summary> /// Creates a new s_instance of the Workspace with the given workspace, cache and type directories /// </summary> /// <param name="workspaceDir">Where XML workspace data should be stored</param> /// <param name="cacheDir">Where binary workspace data should be stored</param> /// <param name="typeDir">Where the supported types for the workspace are defined</param> public Workspace(string workspaceDir, string cacheDir, List<string> typeDirectories, StreamManager manager) : this(workspaceDir, cacheDir, manager) { foreach (string typeDir in typeDirectories) { if (string.IsNullOrWhiteSpace(typeDir)) throw new ArgumentException("Type Directory must exist", "typeDir"); if (!Path.IsPathRooted(typeDir)) throw new ArgumentException("Absolute path is required for Type Directory: " + typeDir, "typeDir"); } //set the paths TypeDirectories = typeDirectories; RegisterTypes(); }