Пример #1
0
        /// <summary>
        ///     Serialize a Service Map to a given file
        /// </summary>
        /// <param name="file">File to serialize Service Map to</param>
        /// <returns></returns>
        public static void PutServiceMap(ServiceMapFile serviceMap, string file)
        {
            // Change the metadata to reflect this updated version
            serviceMap.Updated = DateTime.Now;

            using (var sr = new StreamWriter(file))
            {
                new SerializerBuilder()
                .WithNamingConvention(new CamelCaseNamingConvention())
                .AddLoadedTagMappings()
                .Build()
                .Serialize(sr, serviceMap);
            }
        }
Пример #2
0
        /// <summary>
        ///     Creates a Workspace without a persistent Working Directory (cannot create Plugin instances)
        /// </summary>
        /// <returns></returns>
        public void CreateEphemeral(string serviceMapFile = null)
        {
            if (string.IsNullOrEmpty(serviceMapFile))
            {
                Logger.LogDebug("Creating new ephemeral Workspace with blank Service Map");
                ServiceMap = new ServiceMapFile
                {
                    Created = DateTime.Now,
                    Updated = DateTime.Now
                };
            }
            else
            {
                Logger.LogDebug("Creating new ephemeral Workspace with Service Map from {0}", serviceMapFile);
                ImportServiceMapFromFile(serviceMapFile);
            }

            WorkingDirectory = null;
        }