Пример #1
0
        private static async Task DeleteCollection(string appDataPath)
        {
            try
            {
                string settingsFile    = appDataPath + "\\" + FolderConstants.GIN_APP_DATA_FOLDER + "\\settings.txt";
                string encryptedString = System.IO.File.ReadAllText(settingsFile);
                string decryptedString = CottonDBMS.Helpers.EncryptionHelper.Decrypt(encryptedString);
                var    parms           = Newtonsoft.Json.JsonConvert.DeserializeObject <TruckAppInstallParams>(decryptedString);

                if (!string.IsNullOrEmpty(parms.EndPoint) &&
                    !string.IsNullOrEmpty(parms.Key))
                {
                    DocumentDBContext.Initialize(parms.EndPoint, parms.Key);

                    //remove document tracking lists this truck has downloaded
                    //this allows them to be released for delete etc at the gin
                    await DocumentDBContext.DeleteCollectionAsync();
                }
                else
                {
                    Console.WriteLine("One or more settings null.");
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
                Console.WriteLine(exc.StackTrace);
                Console.WriteLine("Press enter to continue.");
                Console.ReadLine();
            }
        }