public static void Get(string key) { Console.WriteLine("\n===> RSService.Get"); GetRet getRet = rs.Get(key, "attName"); PrintRet(getRet); if (getRet.OK) { Console.WriteLine("Hash: " + getRet.Hash); Console.WriteLine("FileSize: " + getRet.FileSize); Console.WriteLine("MimeType: " + getRet.MimeType); Console.WriteLine("Url: " + getRet.Url); } else { Console.WriteLine("Failed to Get"); } Console.WriteLine("\n===> RSService.GetIfNotModified"); getRet = rs.GetIfNotModified(key, "attName", getRet.Hash); PrintRet(getRet); if (getRet.OK) { Console.WriteLine("Hash: " + getRet.Hash); Console.WriteLine("FileSize: " + getRet.FileSize); Console.WriteLine("MimeType: " + getRet.MimeType); Console.WriteLine("Url: " + getRet.Url); } else { Console.WriteLine("Failed to GetIfNotModified"); } }
public static void ImageOps() { Console.WriteLine("\n===> FileOp.ImageInfo"); ImageInfoRet infoRet = ImageOp.ImageInfo("http://" + DEMO_DOMAIN + "/" + key); PrintRet(infoRet); if (infoRet.OK) { Console.WriteLine("Format: " + infoRet.Format); Console.WriteLine("Width: " + infoRet.Width); Console.WriteLine("Heigth: " + infoRet.Height); Console.WriteLine("ColorModel: " + infoRet.ColorModel); } else { Console.WriteLine("Failed to ImageInfo"); } Console.WriteLine("\n===> FileOp.ImageExif"); CallRet exifRet = ImageOp.ImageExif("http://" + DEMO_DOMAIN + "/" + key); PrintRet(exifRet); if (!exifRet.OK) { Console.WriteLine("Failed to ImageExif"); } Console.WriteLine("\n===> FileOp.ImageViewUrl"); ImageViewSpec viewSpec = new ImageViewSpec { Mode = 0, Width = 200, Height = 200 }; string viewUrl = ImageOp.ImageViewUrl("http://" + DEMO_DOMAIN + "/" + key, viewSpec); Console.WriteLine("ImageViewUrl 1:" + viewUrl); viewSpec.Quality = 1; viewSpec.Format = "gif"; viewUrl = ImageOp.ImageViewUrl("http://" + DEMO_DOMAIN + "/" + key, viewSpec); Console.WriteLine("ImageViewUrl 2:" + viewUrl); viewSpec.Quality = 90; viewSpec.Sharpen = 10; viewSpec.Format = "png"; viewUrl = ImageOp.ImageViewUrl("http://" + DEMO_DOMAIN + "/" + key, viewSpec); Console.WriteLine("ImageViewUrl 3:" + viewUrl); Console.WriteLine("\n===> FileOp.ImageMogrifyUrl"); ImageMogrifySpec mogrSpec = new ImageMogrifySpec { Thumbnail = "!50x50r", Gravity = "center", Rotate = 90, Crop = "!50x50", Quality = 80, AutoOrient = true }; string mogrUrl = ImageOp.ImageMogrifyUrl("http://" + DEMO_DOMAIN + "/" + key, mogrSpec); Console.WriteLine("ImageMogrifyUrl:" + mogrUrl); Console.WriteLine("\n===> Get"); GetRet getRet = rs.Get(key, "save-as"); PrintRet(getRet); if (getRet.OK) { Console.WriteLine("Hash: " + getRet.Hash); Console.WriteLine("FileSize: " + getRet.FileSize); Console.WriteLine("MimeType: " + getRet.MimeType); Console.WriteLine("Url: " + getRet.Url); } else { Console.WriteLine("Failed to Get"); } Console.WriteLine("\n===> FileOp.ImageMogrifySaveAs"); PutFileRet saveAsRet = rs.ImageMogrifySaveAs(getRet.Url, mogrSpec, key + ".mogr-save-as"); PrintRet(saveAsRet); if (saveAsRet.OK) { Console.WriteLine("Hash: " + saveAsRet.Hash); } else { Console.WriteLine("Failed to ImageMogrifySaveAs"); } Console.WriteLine("\n===> Get"); getRet = rs.Get(key + ".mogr-save-as", "mogr-save-as.jpg"); PrintRet(getRet); if (getRet.OK) { Console.WriteLine("Hash: " + getRet.Hash); Console.WriteLine("FileSize: " + getRet.FileSize); Console.WriteLine("MimeType: " + getRet.MimeType); Console.WriteLine("Url: " + getRet.Url); } else { Console.WriteLine("Failed to Get"); } }