Beispiel #1
0
        public DeploymentData New(uint number)
        {
            var _path = Path.Combine(deploymentPath, number.ToString());

            PathEx.CreatePath(_path);

            var deployData = new DeploymentData {
                Number      = number,
                ContentPath = _path,
                Created     = DateTime.UtcNow,
            };

            data[number] = deployData;
            return(deployData);
        }
Beispiel #2
0
        public void Load()
        {
            if (!Directory.Exists(deploymentPath))
            {
                return;
            }

            foreach (var path in Directory.EnumerateDirectories(deploymentPath, "*", SearchOption.TopDirectoryOnly))
            {
                var path_name = Path.GetFileName(path);

                if (!uint.TryParse(path_name, out var deploymentNumber))
                {
                    Log.Warn($"Failed to parse deployment directory '{path_name}'!");
                    continue;
                }

                var            indexFilename = Path.Combine(path, "index.json");
                DeploymentData deployData;

                if (File.Exists(indexFilename))
                {
                    using (var stream = File.Open(indexFilename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
                        deployData = JsonSettings.Serializer.Deserialize <DeploymentData>(stream);

                        //buildData.Number = buildNumber;
                        deployData.ContentPath = path;
                    }
                }
                else
                {
                    deployData = new DeploymentData {
                        Number      = deploymentNumber,
                        ContentPath = path,
                    };
                }

                data[deploymentNumber] = deployData;
            }
        }
Beispiel #3
0
 public bool TryGet(uint number, out DeploymentData deployData)
 {
     return(data.TryGetValue(number, out deployData));
 }