private void EntryOperation(List <LocalContent> localContent, string type)
        {
            _windowElements.WriteLog($"EntryOperation -- {type} | count {localContent.Count}");

            foreach (var local in localContent)
            {
                using (var memoryStream = new MemoryStream())
                {
                    using (var fileStream = new FileStream(local.GetFilePath, FileMode.Open, FileAccess.ReadWrite)) { fileStream.CopyTo(memoryStream); }
                    memoryStream.Position = 0;

                    var checkSum = CcdHelper.GetCheckSum(memoryStream);
                    var mime     = MimeTypeMap.GetMimeType(local.GetFilePath);
                    var size     = (int)memoryStream.Length;
                    var labels   = new List <string>()
                    {
                        "string"
                    };

                    if (type == "create")
                    {
                        CreateEntry(local, checkSum, mime, size, labels);
                    }
                    else if (type == "update")
                    {
                        UpdateEntry(local, checkSum, mime, size, labels);
                    }
                    else
                    {
                        _windowElements.WriteLog($"Can`t handle this type = {type}");
                        return;
                    }
                }
            }
        }
        private List <LocalContent> GetLocalContent()
        {
            string path  = Application.dataPath + "/CloudContentDelivery/Editor/Resources/Content";
            var    files = CcdHelper.FindAll(path, new [] { ".meta" }).ToList();
            List <LocalContent> localContent = new List <LocalContent>();

            foreach (var file in files)
            {
                localContent.Add(new LocalContent(file));
            }
            return(localContent);
        }
        private void Connect()
        {
            _settings      = Resources.Load <CloudContentSettings>("CloudContentSettings");
            _decodedApiKey = CcdHelper.Base64Encode($":{_settings.apiKey}");

            _bucketsApi  = new BucketsApi();
            _entriesApi  = new EntriesApi();
            _contentApi  = new ContentApi();
            _releasesApi = new ReleasesApi();

            if (_settings.lastBucketData != null)
            {
                _bucketData = _settings.lastBucketData;
            }
            if (!_bucketsApi.Configuration.DefaultHeader.ContainsKey("Authorization"))
            {
                _bucketsApi.Configuration.DefaultHeader.Add("Authorization", $"Basic {_decodedApiKey}");
            }

            _windowElements = new CcdWindowElements(rootVisualElement, _settings, _bucketData);
            RegisterCallbacks();
        }