예제 #1
0
        public void TestInitialize()
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Verbose()
                         .WriteTo.Console()
                         .Enrich.FromLogContext()
                         .CreateLogger();

            _itemInfos = AlliedModsWiki.GetItemInfos();

            var itemInfoSource  = new ItemInfoSource(_itemInfos);
            var classNameSource = new ClassNameSource();

            _transformations = new Dictionary <string, ITransformation <Node> >
            {
                {
                    "tf2rebalance_attributes", new Tf2RebalanceTransformation(itemInfoSource,
                                                                              classNameSource)
                },
                {
                    "Custom Attributes", new CustomAttributesTransformation(itemInfoSource,
                                                                            classNameSource)
                },
            };
        }
예제 #2
0
        private static void Execute(IList <string> files, IRebalanceInfoFormatter formatter, IFileSystem fileSystem)
        {
            IDictionary <string, List <ItemInfo> > weaponNames = AlliedModsWiki.GetItemInfos();
            var itemInfoSource  = new ItemInfoSource(weaponNames);
            var classNameSource = new ClassNameSource();
            var transformations = new Dictionary <string, ITransformation <Node> >
            {
                {
                    "tf2rebalance_attributes", new Tf2RebalanceTransformation(itemInfoSource,
                                                                              classNameSource)
                },
                {
                    "Custom Attributes", new CustomAttributesTransformation(itemInfoSource,
                                                                            classNameSource)
                },
            };
            IConverter converter = new CompositeTf2FormatConverter(new ValveFormatParser(), transformations);

            foreach (string filename in files)
            {
                CreateSummary(filename, converter, formatter, fileSystem);
            }

            Log.Information("finished creating summaries for {ConfigFileCount} configs", files.Count);
        }
예제 #3
0
        public void Export(ClassNameSource aClassNameSource, string aOutputPath = PATH)
        {
            try
            {
                // prepare export run
                mClassNameSource        = aClassNameSource;
                mWrittenBaseClasses     = new List <string>();
                mWrittenTemplateClasses = new List <string>();
                mBaseClassBases         = new Dictionary <string, string>();

                mExportedObjectCount = 0;
                mExportedAssetCount  = 0;

                var aTopics = new List <string>
                {
                    "Flow",
                    "Entities",
                    "Assets",
                    "Locations",
                };

                // check output dir
                DirectoryInfo outDir = new DirectoryInfo(aOutputPath);
                if (!outDir.Exists)
                {
                    //mFramework.ShowError("Output directory does not exist! Please specify the asset directory of your Unity project.");
                    return;
                }

                //var files = outDir.GetFiles("*.unity");
                //if (files.Length == 0)
                //{
                //    //mFramework.ShowError("The specified output directory does not contain a Unity project file! Please specify the asset directory of your Unity project.");
                //    return;
                //}

                DirectoryInfo pluginsDir = new DirectoryInfo(outDir.FullName + @"\Plugins");
                if (!pluginsDir.Exists)
                {
                    pluginsDir.Create();
                }

                DirectoryInfo articyDir = new DirectoryInfo(pluginsDir.FullName + @"\Articy");
                if (!articyDir.Exists)
                {
                    articyDir.Create();
                }

                mClassDir = new DirectoryInfo(articyDir.FullName + @"\Classes");
                if (!mClassDir.Exists)
                {
                    mClassDir.Create();
                }

                // export flow);
                if (aTopics.Contains("Flow"))
                {
                    var systemFolderFlow = mSession.GetSystemFolder(SystemFolderNames.Flow);
                    var flowDir          = new DirectoryInfo(articyDir.FullName + @"\Flow");
                    if (!flowDir.Exists)
                    {
                        flowDir.Create();
                    }
                    ExportFlowFolder(systemFolderFlow, flowDir);
                }

                // export entities
                if (aTopics.Contains("Entities"))
                {
                    var systemFolderEntities = mSession.GetSystemFolder(SystemFolderNames.Entities);
                    var entitiesDir          = new DirectoryInfo(articyDir.FullName + @"\Entities");
                    if (!entitiesDir.Exists)
                    {
                        entitiesDir.Create();
                    }
                    ExportEntityFolder(systemFolderEntities, entitiesDir);
                }

                // export locations
                if (aTopics.Contains("Locations"))
                {
                    var systemFolderLocations = mSession.GetSystemFolder(SystemFolderNames.Locations);
                    var locationsDir          = new DirectoryInfo(articyDir.FullName + @"\Locations");
                    if (!locationsDir.Exists)
                    {
                        locationsDir.Create();
                    }
                    ExportLocationFolder(systemFolderLocations, locationsDir);
                }

                // export assets
                if (aTopics.Contains("Assets"))
                {
                    var systemFolderAssets = mSession.GetSystemFolder(SystemFolderNames.Assets);
                    var assetsDir          = new DirectoryInfo(articyDir.FullName + @"\Resources");
                    mResourcesPath = assetsDir.FullName;
                    if (!assetsDir.Exists)
                    {
                        assetsDir.Create();
                    }
                    ExportAssetsFolder(systemFolderAssets, assetsDir);
                }


                mSession.ShowMessageBox("Complete");
            }
            catch (Exception ex)
            {
                mSession.ShowMessageBox("Error");
            }
        }