Пример #1
0
        public void Add(Pot pot)
        {
            PotDirectory potDirectory = PotDirectory.FromPotName(pot.Name);

            potDirectory.Create();

            JPotInfoFile jPotInfoFile = potDirectory.GetInfoFile();

            jPotInfoFile.JPotInfo = new JPotInfo
            {
                Name        = pot.Name,
                Path        = pot.Path,
                Description = pot.Description
            };

            jPotInfoFile.Save();
        }
Пример #2
0
        private static Pot ToPot(PotDirectory potDirectory)
        {
            if (!potDirectory.IsValid)
            {
                return(null);
            }

            JPotInfoFile jPotInfoFile = potDirectory.GetInfoFile();
            bool         success      = jPotInfoFile.TryOpen();

            if (!success)
            {
                return(null);
            }

            return(new Pot
            {
                Guid = potDirectory.PotGuid,
                Name = jPotInfoFile.JPotInfo.Name,
                Path = jPotInfoFile.JPotInfo.Path,
                Description = jPotInfoFile.JPotInfo.Description
            });
        }