public static void Run(string basePath, string nameSpace)
        {
            var infos         = All;
            var unitGenerator = new BasicUnitGenerator(Path.Combine(basePath, "+IUnits"), nameSpace);

            unitGenerator.Generate(infos.DistinctNames);

            var unitedValues = new BasicUnitValuesGenerator(Path.Combine(basePath, "+IUnitedValue"), nameSpace);

            unitedValues.Generate(infos.Items);

            var jsonConverter = new UnitJsonConverterGenerator(Path.Combine(basePath, "+jsonConverters"), nameSpace);

            jsonConverter.Generate(infos.Items);

            var ext = new UnitExtensionsGenerator(Path.Combine(basePath, "+extensions"), nameSpace);

            ext.Generate(infos.Items);
        }
Example #2
0
        protected override void Add_FromMethods()
        {
            var collection  = CommonFractionalUnitDefs.All;
            var commonUnits = collection.GetBy(Cfg.UnitTypes.Unit);

            if (commonUnits.Length == 0)
            {
                return;
            }
            foreach (var i in commonUnits)
            {
                var u = new RelatedUnitInfo(i.TargetPropertyName,
                                            UnitShortCodeSource.MakeDirect(i.GetUnitName()),
                                            i.TargetPropertyName);
                BasicUnitValuesGenerator.Add_FromMethods(
                    GetType(),
                    i.Type.Value,
                    i.Type,
                    Target,
                    u);
            }
        }