void SerializeYamlFile(string path, object data, bool serializeAsJson = false, bool formatJson = true, bool emitDefaultValues = false)
    {
        string yaml = YamlHelpers.Serialize(data, serializeAsJson: serializeAsJson, formatJson: formatJson, emitDefaultValues: true);

        zf.AwsS3ZephyrFile file = new zf.AwsS3ZephyrFile(_awsClient, path);
        file.WriteAllText(yaml);
    }
    T DeserializeYamlFile <T>(string path)
    {
        zf.AwsS3ZephyrFile file = new zf.AwsS3ZephyrFile(_awsClient, path);
        string             yaml = file.ReadAllText();

        return(YamlHelpers.Deserialize <T>(yaml));
    }
Beispiel #3
0
        /// <summary>
        /// Gets a ZephyrFile implementation matching the URL type passed in.
        /// </summary>
        /// <param name="url">The Fullname or URL of the file.</param>
        /// <param name="clients">A collection of connection clients.</param>
        /// <returns>A ZephyrFile implementation.</returns>
        public static ZephyrFile GetZephyrFile(string url, Clients clients = null)
        {
            ZephyrFile file = null;
            UrlType    type = GetUrlType(url);

            switch (type)
            {
            case UrlType.LocalFile:
                file = new WindowsZephyrFile(url);
                break;

            case UrlType.NetworkFile:
                file = new WindowsZephyrFile(url);
                break;

            case UrlType.AwsS3File:
                file = new AwsS3ZephyrFile(clients?.aws, url);
                break;
            }

            return(file);
        }
Beispiel #4
0
    void LoadSuplex()
    {
        string splxFile = DirectoryGetFile(_splxPath, "security.splx", throwFileNotFoundException: false);

        if (splxFile != null)
        {
            SuplexPoller.Enabled = true;

            zf.AwsS3ZephyrFile s3splx        = new zf.AwsS3ZephyrFile(_awsClient, splxFile);
            DateTime           lastWriteTime = GetFileDetails(s3splx).LastWriteTime;
            if (_splxLastWriteTime != lastWriteTime)
            {
                _splxLastWriteTime = lastWriteTime;

                if (_splxDal == null)
                {
                    _splxDal = new SuplexDal();
                }

                string storeData = s3splx.ReadAllText();
                _splxDal.LoadStoreData(storeData);
            }
        }
    }
Beispiel #5
0
 Amazon.S3.IO.S3FileInfo GetFileDetails(zf.AwsS3ZephyrFile awsS3zfile)
 {
     return(new Amazon.S3.IO.S3FileInfo(_s3Client, awsS3zfile.BucketName, awsS3zfile.ObjectKey));
 }