private XmlClass CreateFromXml(XmlElement node)
        {
            switch (node.LocalName)
            {
            case "configuration":
                return(Configuration.CreateFromXml(node));

            case "component":
                return(Component.CreateFromXml(node));

            case "installedcheck":
                return(InstalledCheck.CreateFromXml(node));

            case "installedcheckoperator":
                return(InstalledCheckOperator.CreateFromXml(node));

            case "download":
                return(Download.CreateFromXml(node));

            case "downloaddialog":
                return(DownloadDialog.CreateFromXml(node));

            case "embedfile":
                return(EmbedFile.CreateFromXml(node));

            case "embedfolder":
                return(EmbedFolder.CreateFromXml(node));

            case "control":
                return(Control.CreateFromXml(node));

            default:
                throw new Exception(string.Format("Unsupported node: {0}", node.LocalName));
            }
        }
Example #2
0
        public static EmbedFolder CreateFromXml(XmlElement element)
        {
            EmbedFolder result = new EmbedFolder();

            result.FromXml(element);
            return(result);
        }
 public void TestGetFilesNoTargetPath()
 {
     EmbedFolder embedFolder = new EmbedFolder();
     embedFolder.sourcefolderpath = Path.Combine(Environment.GetFolderPath(
         Environment.SpecialFolder.System), @"spool\tools");
     string supportdir = @"C:\SupportFiles\SupportFolder";
     Dictionary<string, EmbedFileCollection> embedFileCollection = embedFolder.GetFiles(string.Empty, supportdir);
     foreach (EmbedFilePair pair in embedFileCollection[string.Empty])
     {
         Console.WriteLine("{0} -> {1}", pair.fullpath, pair.relativepath);
         Assert.IsFalse(pair.relativepath.StartsWith(@"\"));
         Assert.IsTrue(File.Exists(pair.fullpath));
     }
 }
 public void TestGetFilesTargetWithBackslashPath2()
 {
     EmbedFolder embedFolder = new EmbedFolder();
     embedFolder.sourcefolderpath = Path.Combine(Environment.GetFolderPath(
         Environment.SpecialFolder.System), @"spool\tools");
     embedFolder.targetfolderpath = @"\parent\child\";
     string supportdir = @"C:\SupportFiles\SupportFolder";
     Dictionary<string, EmbedFileCollection> embedFileCollection = embedFolder.GetFiles(string.Empty, supportdir);
     foreach (EmbedFilePair pair in embedFileCollection[string.Empty])
     {
         Console.WriteLine("{0} -> {1}", pair.fullpath, pair.relativepath);
         Assert.IsFalse(pair.relativepath.StartsWith(@"\"));
         Assert.IsTrue(File.Exists(pair.fullpath));
         Assert.IsTrue(pair.relativepath.StartsWith(embedFolder.targetfolderpath.TrimStart(Path.DirectorySeparatorChar)));
         Assert.IsFalse(pair.relativepath.Contains(@"\\"));
     }
 }
 public static EmbedFolder CreateFromXml(XmlElement element)
 {
     EmbedFolder result = new EmbedFolder();
     result.FromXml(element);
     return result;
 }