Example #1
0
 private void ParseSecondType(Xml.Document xmlDoc)
 {
     TargetPath  = xmlDoc.GetRoot().Children()[0].AttributeValue <string>("TargetPath");
     SourcetPath = xmlDoc.GetRoot().Children()[0].AttributeValue <string>("SourcetPath");
     foreach (var mod in xmlDoc.GetRoot().Children()[1].GetDictionary())
     {
         _mods[(FTPTargetWatcher.ArchiveCryptMode)Enum.Parse(typeof(FTPTargetWatcher.ArchiveCryptMode), mod.Key)] = mod.Value;
     }
     isParsed = true;
 }
Example #2
0
 private void TryParse(Xml.Document xmlDoc)
 {
     try
     {
         ParseFirstType(xmlDoc);
     }
     catch (Exception)
     {
         ParseSecondType(xmlDoc);
     }
 }
Example #3
0
        static void Main(string[] args)
        {
            var file = args.Length > 0 ? args[0] : @"C:\Users\alexandr\Downloads\test.zip";

            var      data = File.ReadAllBytes(file);
            Document doc  = null;

            switch (Path.GetExtension(file).ToLowerInvariant())
            {
            case ".ai":
                doc = new Ai.Document(data);
                break;

            case ".asl":
                doc = new Asl.Document(data);
                break;

            case ".png":
                doc = new Png.Document(data);
                break;

            case ".xml":
                doc = new Xml.Document(Encoding.UTF8.GetString(data));
                break;

            case ".zip":
                doc = new Xml.Document(Encoding.UTF8.GetString(Zlib.Decompress(data)));
                break;
            }
            if (doc != null)
            {
                var sb = new StringBuilder();
                foreach (var style in doc.Styles)
                {
                    if (style != null)
                    {
                        sb.Append(style.ToString());
                    }
                }
                if (sb.Length > 0)
                {
                    Clipboard.SetText(sb.ToString());
                }
            }
        }