Exemple #1
0
        public void FromXml(string version, XElement config, Dictionary <ObjectId, ObjectId> map = null)
        {
            if (VersionComparer.Instance.Compare(version, "1.2") < 0)
            {
                map = VersionMigration.Befor1_2(this, map);
            }

            foreach (var pointConfig in config.Elements(MarkupPoint.XmlName))
            {
                MarkupPoint.FromXml(pointConfig, this, map);
            }

            var toInit = new Dictionary <MarkupLine, XElement>();

            foreach (var lineConfig in config.Elements(MarkupLine.XmlName))
            {
                if (MarkupLine.FromXml(lineConfig, this, map, out MarkupLine line))
                {
                    LinesDictionary[line.Id] = line;
                    toInit[line]             = lineConfig;
                }
            }
            foreach (var pair in toInit)
            {
                pair.Key.FromXml(pair.Value, map);
            }

            foreach (var fillerConfig in config.Elements(MarkupFiller.XmlName))
            {
                if (MarkupFiller.FromXml(fillerConfig, this, map, out MarkupFiller filler))
                {
                    FillersList.Add(filler);
                }
            }
        }
Exemple #2
0
        internal ConnectionlessVersionLoader(
            IMigrationRunner runner,
            IAssemblyCollection assemblies,
            IConventionSet conventionSet,
            IMigrationRunnerConventions conventions,
            IRunnerContext runnerContext,
            IVersionTableMetaData versionTableMetaData = null)
        {
            _migrationInformationLoader = runner.MigrationLoader;
            _processor = runner.Processor;

            Runner        = runner;
            Assemblies    = assemblies;
            Conventions   = conventions;
            StartVersion  = runnerContext.StartVersion;
            TargetVersion = runnerContext.Version;

            VersionInfo          = new VersionInfo();
            VersionTableMetaData = versionTableMetaData ??
                                   (IVersionTableMetaData)Activator.CreateInstance(assemblies.Assemblies.GetVersionTableMetaDataType(
                                                                                       Conventions, runnerContext));
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            if (VersionTableMetaData is DefaultVersionTableMetaData defaultMetaData)
            {
                conventionSet.SchemaConvention?.Apply(defaultMetaData);
            }

            LoadVersionInfo();
        }
        internal FxVersionLoader(IMigrationRunner runner, IAssemblyCollection assemblies,
                                 IConventionSet conventionSet,
                                 IMigrationRunnerConventions conventions,
                                 IRunnerContext runnerContext,
                                 IVersionTableMetaData versionTableMetaData = null,
                                 string resource = "")
        {
            _conventionSet = conventionSet;
            _processor     = runner.Processor;

            Runner     = runner;
            Assemblies = assemblies;

            Conventions                 = conventions;
            VersionTableMetaData        = versionTableMetaData ?? CreateVersionTableMetaData(runnerContext);
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);
            VersionResourceMigration    = new VersionResourceMigration(VersionTableMetaData);

            VersionTableMetaData.ApplicationContext = runnerContext.ApplicationContext;

            Resource = resource;

            LoadVersionInfo();
        }
        public FxVersionLoader(
            IProcessorAccessor processorAccessor,
            IConventionSet conventionSet,
            IMigrationRunnerConventions conventions,
            IVersionTableMetaData versionTableMetaData,
            IMigrationRunner runner,
            string resource = "")
        {
            _conventionSet = conventionSet;
            _processor     = processorAccessor.Processor;

            Runner = runner;

            Conventions                 = conventions;
            VersionTableMetaData        = versionTableMetaData;
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);
            VersionResourceMigration    = new VersionResourceMigration(VersionTableMetaData);

            Resource = resource;

            LoadVersionInfo();
        }
Exemple #5
0
        public override void FromXml(Version version, XElement config, ObjectsMap map)
        {
            if (version < new Version("1.2"))
            {
                map = VersionMigration.Befor1_2(this, map);
            }

            base.FromXml(version, config, map);
        }
        public VersionLoader(IMigrationRunner runner, Assembly assembly, IMigrationConventions conventions)
        {
            Runner    = runner;
            Processor = runner.Processor;
            Assembly  = assembly;

            Conventions            = conventions;
            VersionTableMetaData   = GetVersionTableMetaData();
            VersionMigration       = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration = new VersionSchemaMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
Exemple #7
0
        public VersionLoader(IMigrationRunner runner, IAssemblyCollection assemblies, IMigrationConventions conventions)
        {
            Runner     = runner;
            Processor  = runner.Processor;
            Assemblies = assemblies;

            Conventions                 = conventions;
            VersionTableMetaData        = GetVersionTableMetaData();
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
        public VersionLoader(IMigrationRunner runner, Assembly assembly, IMigrationConventions conventions, IVersionTableMetaData versionTableMetaData = null)
        {
            Runner    = runner;
            Processor = runner.Processor;
            Assembly  = assembly;

            Conventions                 = conventions;
            VersionTableMetaData        = versionTableMetaData ?? GetVersionTableMetaData();
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
        public VersionLoader(IMigrationRunner runner, Assembly assembly, IMigrationConventions conventions, string group)
        {
            Runner    = runner;
            Processor = runner.Processor;
            Assembly  = assembly;
            Group     = group;

            Conventions            = conventions;
            VersionTableMetaData   = GetVersionTableMetaData();
            VersionMigration       = new VersionMigration(VersionTableMetaData);
            GroupVersionMigration  = new VersionGroupMigration(VersionTableMetaData);
            VersionSchemaMigration = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration = new VersionUniqueMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
Exemple #10
0
        public void FromXml(Version version, XElement config, Dictionary <ObjectId, ObjectId> map = null)
        {
            if (version < new Version("1.2"))
            {
                map = VersionMigration.Befor1_2(this, map);
            }

            foreach (var pointConfig in config.Elements(MarkupPoint.XmlName))
            {
                MarkupPoint.FromXml(pointConfig, this, map);
            }

            var toInit = new Dictionary <MarkupLine, XElement>();

            foreach (var lineConfig in config.Elements(MarkupLine.XmlName))
            {
                if (MarkupLine.FromXml(lineConfig, this, map, out MarkupLine line))
                {
                    LinesDictionary[line.Id] = line;
                    toInit[line]             = lineConfig;
                }
            }

            foreach (var pair in toInit)
            {
                pair.Key.FromXml(pair.Value, map);
            }

            foreach (var fillerConfig in config.Elements(MarkupFiller.XmlName))
            {
                if (MarkupFiller.FromXml(fillerConfig, this, map, out MarkupFiller filler))
                {
                    FillersList.Add(filler);
                }
            }
            foreach (var crosswalkConfig in config.Elements(MarkupCrosswalk.XmlName))
            {
                if (MarkupCrosswalk.FromXml(crosswalkConfig, this, map, out MarkupCrosswalk crosswalk))
                {
                    CrosswalksDictionary[crosswalk.Line] = crosswalk;
                }
            }

            Update();
        }
Exemple #11
0
        public ConnectionlessVersionLoader(IMigrationRunner runner, IAssemblyCollection assemblies, IMigrationConventions conventions, long startVersion, long targetVersion)
        {
            Runner        = runner;
            Assemblies    = assemblies;
            Conventions   = conventions;
            StartVersion  = startVersion;
            TargetVersion = targetVersion;

            Processor = Runner.Processor;

            VersionInfo                 = new VersionInfo();
            VersionTableMetaData        = GetVersionTableMetaData();
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
Exemple #12
0
        public VersionLoader(IMigrationRunner runner, IAssemblyCollection assemblies,
                             IConventionSet conventionSet,
                             IMigrationRunnerConventions conventions,
                             IVersionTableMetaData versionTableMetaData = null)
        {
            _conventionSet = conventionSet;
            Runner         = runner;
            Processor      = runner.Processor;
            Assemblies     = assemblies;

            Conventions                 = conventions;
            VersionTableMetaData        = versionTableMetaData ?? GetVersionTableMetaData();
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
Exemple #13
0
        public VersionLoader(
            [NotNull] IProcessorAccessor processorAccessor,
            [NotNull] IConventionSet conventionSet,
            [NotNull] IMigrationRunnerConventions conventions,
            [NotNull] IVersionTableMetaData versionTableMetaData,
            [NotNull] IMigrationRunner runner)
        {
            _conventionSet = conventionSet;
            _processor     = processorAccessor.Processor;

            Runner = runner;

            Conventions                 = conventions;
            VersionTableMetaData        = versionTableMetaData;
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
Exemple #14
0
        public static void LoadAllData(out bool NeedToCreateCharacter)
        {
            RPGMethods.CleanupObjects();
            NeedToCreateCharacter = false;
            var newDir         = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var dir            = Path.Combine(newDir, @"Rockstar Games\GTA V\RPGMod\");
            var playerDataFile = "PlayerData.save";

            var playerDataPath = Path.Combine(dir, playerDataFile);

            if (File.Exists(playerDataPath))
            {
                try
                {
                    var loadedData = File.ReadAllText(playerDataPath);
                    PlayerData = JsonConvert.DeserializeObject <PlayerData>(loadedData, GM.GetSerialisationSettings());
                    var dataVersion = PlayerData.Version;
                    if (dataVersion != RPG.Version)
                    {
                        VersionMigration.Migrate(dataVersion, RPG.Version);
                    }

                    InitCharacter();
                }
                catch (Exception e)
                {
                    LoadedSuccessfully = false;
                    RPGLog.Log(e.ToString());
                    RPGLog.Log("Error Loading or Initialising Player data.");
                }
            }
            else
            {
                NeedToCreateCharacter = true;
            }



            ApplySettings();
        }
Exemple #15
0
        public ConnectionlessVersionLoader(
            [NotNull] IProcessorAccessor processorAccessor,
            [NotNull] IMigrationRunnerConventions conventions,
            [NotNull] IOptions <RunnerOptions> runnerOptions,
            [NotNull] IMigrationInformationLoader migrationInformationLoader,
            [NotNull] IVersionTableMetaData versionTableMetaData)
        {
            _processor = processorAccessor.Processor;
            _migrationInformationLoader = migrationInformationLoader;
            Conventions   = conventions;
            StartVersion  = runnerOptions.Value.StartVersion;
            TargetVersion = runnerOptions.Value.Version;

            VersionInfo                 = new VersionInfo();
            VersionTableMetaData        = versionTableMetaData;
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
Exemple #16
0
        internal VersionLoader(IMigrationRunner runner, IAssemblyCollection assemblies,
                               [NotNull] IConventionSet conventionSet,
                               [NotNull] IMigrationRunnerConventions conventions,
                               [NotNull] IRunnerContext runnerContext,
                               [CanBeNull] IVersionTableMetaData versionTableMetaData = null)
        {
            _conventionSet = conventionSet;
            _processor     = runner.Processor;

            Runner     = runner;
            Assemblies = assemblies;

            Conventions                 = conventions;
            VersionTableMetaData        = versionTableMetaData ?? CreateVersionTableMetaData(runnerContext);
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            VersionTableMetaData.ApplicationContext = runnerContext.ApplicationContext;

            LoadVersionInfo();
        }