public void Save(ConfigSource config, Stream output)
        {
            if (!output.CanWrite)
                throw new ArgumentException("The output stream cannot be written.", "output");

            Util.Properties properties = new Util.Properties();
            SetChildValues(properties, "", config);
            properties.Store(output, null);
        }
Esempio n. 2
0
        protected override void CreatePath(string pathName, string pathTypeName)
        {
            string f = Path.Combine(basePath, pathName);
            FileInfo fileInfo = new FileInfo(f);
            if (fileInfo.Exists)
                throw new ApplicationException("Path file for '" + pathName + "' exists on this root service.");

            // Create the root file
            using (fileInfo.Create()) {
                // immediately call Dispose on the stream...
            }

            // Create a summary file for storing information about the path
            string summaryFile = Path.Combine(basePath, pathName + ".summary");
            Util.Properties p = new Util.Properties();
            p.SetProperty("path_type", pathTypeName);
            using (FileStream fileStream = new FileStream(summaryFile, FileMode.CreateNew, FileAccess.Write)) {
                p.Store(fileStream, null);
            }
        }