Ejemplo n.º 1
0
        public override void Configure(IWinSWConfiguration descriptor, XmlNode node)
        {
            XmlNodeList?mapNodes = XmlHelper.SingleNode(node, "mapping", false) !.SelectNodes("map");

            if (mapNodes != null)
            {
                for (int i = 0; i < mapNodes.Count; i++)
                {
                    if (mapNodes[i] is XmlElement mapElement)
                    {
                        var config = SharedDirectoryMapperConfig.FromXml(mapElement);
                        this._entries.Add(config);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void Configure(IWinSWConfiguration descriptor, YamlExtensionConfiguration config)
        {
            var dict = config.GetSettings();

            var mappingNode = dict["mapping"];

            if (!(mappingNode is List <object> mappings))
            {
                throw new InvalidDataException("SharedDirectoryMapper mapping should be a list");
            }

            foreach (var map in mappings)
            {
                var mapConfig = SharedDirectoryMapperConfig.FromYaml(map);
                this._entries.Add(mapConfig);
            }
        }
Ejemplo n.º 3
0
        public SharedDirectoryMapper(bool enableMapping, string directoryUNC, string driveLabel)
        {
            SharedDirectoryMapperConfig config = new SharedDirectoryMapperConfig(enableMapping, driveLabel, directoryUNC);

            this._entries.Add(config);
        }
Ejemplo n.º 4
0
 private void HandleMappingError(SharedDirectoryMapperConfig config, MapperException ex)
 {
     Logger.Error("Mapping of " + config.Label + " failed. STDOUT: " + ex.Process.StandardOutput.ReadToEnd()
                  + " \r\nSTDERR: " + ex.Process.StandardError.ReadToEnd(), ex);
     throw new ExtensionException(this.Descriptor.Id, this.DisplayName + ": Mapping of " + config.Label + "failed", ex);
 }