コード例 #1
0
ファイル: Program.cs プロジェクト: dfrandsen/Stratosphere
        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");
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: dfrandsen/Stratosphere
        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");
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: dfrandsen/Stratosphere
        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");
            }
        }