private void SaveItems(string domainName, string fileName) { long writtenCount = 0; SdbTable table; if (SdbTable.TryCreate(ServiceId, ServiceSecret, domainName, false, null, false, out table)) { long expectedCount; long sizeBytes; table.GetInfo(out expectedCount, out sizeBytes); using (FileStream stream = new FileStream(fileName, FileMode.Create)) { using (XmlWriter writer = XmlWriter.Create(stream)) { writer.WriteStartDocument(); writer.WriteStartElement("Domain"); using (IReader reader = table.Select(new string[] { }, null)) { writtenCount = WriteItems(expectedCount, writer, reader); } } } Console.WriteLine("{0} saved {1} items {2} bytes", Path.GetFullPath(fileName), writtenCount, new FileInfo(fileName).Length); } else { Console.WriteLine("Domain does not exist"); } }
private void DeleteDomain(string domainName) { SdbTable table; if (SdbTable.TryCreate(ServiceId, ServiceSecret, domainName, false, null, false, out table)) { table.Delete(); Console.WriteLine("Deleted {0} domain", domainName); } else { Console.WriteLine("Domain does not exist"); } }
private void ListItems(string domainName) { SdbTable table; if (SdbTable.TryCreate(ServiceId, ServiceSecret, domainName, false, null, false, out table)) { using (IReader reader = table.Select(new string[] { }, null)) { WriteItems(reader); } } else { Console.WriteLine("Domain does not exist"); } }