public CustomizationManager(CustomizationInitializationParameters initParams)
        {
            var writeableCdfPath = CryPak.AdjustFileName(initParams.CharacterDefinitionLocation, PathResolutionRules.RealPath | PathResolutionRules.ForWriting);

            var baseCdfPath = Path.Combine(CryPak.GameFolder, initParams.BaseCharacterDefinition);
            BaseDefinition = XDocument.Load(baseCdfPath);

            if (File.Exists(writeableCdfPath))
                CharacterDefinition = XDocument.Load(writeableCdfPath);
            else
            {
                var directory = new DirectoryInfo(Path.GetDirectoryName(writeableCdfPath));
                while (!directory.Exists)
                {
                    Directory.CreateDirectory(directory.FullName);

                    directory = Directory.GetParent(directory.FullName);
                }

                File.Copy(baseCdfPath, writeableCdfPath);

                CharacterDefinition = XDocument.Load(writeableCdfPath);
            }

            InitParameters = initParams;

            Initialize();
        }
Example #2
0
        public CustomizationManager(CustomizationInitializationParameters initParams)
        {
            var writeableCdfPath = CryPak.AdjustFileName(initParams.CharacterDefinitionLocation, PathResolutionRules.RealPath | PathResolutionRules.ForWriting);

            var baseCdfPath = Path.Combine(CryPak.GameFolder, initParams.BaseCharacterDefinition);

            BaseDefinition = XDocument.Load(baseCdfPath);

            if (File.Exists(writeableCdfPath))
            {
                CharacterDefinition = XDocument.Load(writeableCdfPath);
            }
            else
            {
                var directory = new DirectoryInfo(Path.GetDirectoryName(writeableCdfPath));
                while (!directory.Exists)
                {
                    Directory.CreateDirectory(directory.FullName);

                    directory = Directory.GetParent(directory.FullName);
                }

                File.Copy(baseCdfPath, writeableCdfPath);

                CharacterDefinition = XDocument.Load(writeableCdfPath);
            }

            InitParameters = initParams;

            Initialize();
        }
        public static CustomizationInitializationParameters GetDefault()
        {
            var initParams = new CustomizationInitializationParameters();

            initParams.CharacterDefinitionLocation = "%USER%/Cosmetics/Definitions/MyCharacter.cdf";
            initParams.BaseCharacterDefinition     = "Scripts/Config/base.cdf";

            initParams.AvailableAttachmentsDirectory = "Scripts/Config/Attachments/";

            initParams.EmptyThumbnailPath = "Objects/Characters/Attachments/thumb_empty.dds";

            initParams.TempDirectory = "%USER%/Cosmetics/";

            return(initParams);
        }
        public static CustomizationInitializationParameters GetDefault()
        {
            var initParams = new CustomizationInitializationParameters();

            initParams.CharacterDefinitionLocation = "%USER%/Cosmetics/Definitions/MyCharacter.cdf";
            initParams.BaseCharacterDefinition = "Scripts/Config/base.cdf";

            initParams.AvailableAttachmentsDirectory = "Scripts/Config/Attachments/";

            initParams.EmptyThumbnailPath = "Objects/Characters/Attachments/thumb_empty.dds";

            initParams.TempDirectory = "%USER%/Cosmetics/";

            return initParams;
        }