Exemplo n.º 1
0
        private void GenerateSerializableClass(XmlClassItem item, ObjectType type)
        {
            var template = new SerializableTemplate(item, _schema, type);
            var data     = template.TransformText();

            _codeWriter.Write(Utils.SerializableNamespace, item.name, data);
        }
Exemplo n.º 2
0
        public void LoadData(string path)
        {
            Clear();

            var info = new DirectoryInfo(path);

            foreach (var fileInfo in info.GetFiles("*", SearchOption.AllDirectories))
            {
                var file = fileInfo.FullName;
                if (fileInfo.Extension == ".png" || fileInfo.Extension == ".jpg" || fileInfo.Extension == ".jpeg")
                {
                    LoadImage(fileInfo);
                }
                else if (fileInfo.Extension == ".xml")
                {
                    var xmlData = File.ReadAllText(file);
                    _localizations.Add(Path.GetFileNameWithoutExtension(file), xmlData);
                }
                else if (fileInfo.Extension == ".json")
                {
                    var data = File.ReadAllText(file);

                    DeserializeItem(data, path, file);
                }
                else if (fileInfo.Extension == ".template")
                {
                    var data = File.ReadAllText(file);
                    var name = Helpers.FileName(file);
                    SerializableTemplate template = JsonConvert.DeserializeObject <SerializableTemplate>(data);
                    template.FileName = name;
                    template.FilePath = file;
                    _templates.Add(template.Name, template);
                }
            }
        }