Esempio n. 1
0
        public override IEnumerable <CommentBlock> FindCommentsForMembers(CommentBag commentBag)
        {
            var results = new List <CommentBlock>();

            results.AddRange(base.FindCommentsForMembers(commentBag));
            results.AddRange(Definitions.SelectMany(model =>
                                                    SymbolConverter.SearchComments(commentBag, model.Comments)));
            return(results);
        }
Esempio n. 2
0
        public static HexTile ImportRow(CsvReader csv, int id)
        {
            try
            {
                HexTile tile = new HexTile
                {
                    Id       = id,
                    Symbol   = SymbolConverter.Get(csv.GetField(1)[0].ToString()),
                    ImageUrl = csv.GetField(0)
                };

                int merge = 2450;
                //int offset = id >= merge ? 1 : 0;
                int offset = 1;

                //tile.ForceDelete = id >= merge;
                tile.ForceDelete = false;

                // Import the wall.
                string wall = csv.GetField(2);
                tile.Walls    = new bool[6];
                tile.Walls[0] = !wall.Contains((1 - offset).ToString());
                tile.Walls[1] = !wall.Contains((2 - offset).ToString());
                tile.Walls[2] = !wall.Contains((3 - offset).ToString());
                tile.Walls[3] = !wall.Contains((4 - offset).ToString());
                tile.Walls[4] = !wall.Contains((5 - offset).ToString());
                tile.Walls[5] = !wall.Contains((6 - offset).ToString());

                for (int i = 0; i < 6; i++)
                {
                    tile.Nodes[i] = SmallHexGroup.Import(csv, i);
                }

                tile.Status = csv.GetField(9);

                // Populate the URL for checking.
                string data = "";

                for (int i = 0; i < 9; i++)
                {
                    data += $"{csv.GetField(i)}\t";
                }

                tile.Url = BaseUrl + Convert.ToBase64String(Encoding.ASCII.GetBytes(data));

                return(tile);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Esempio n. 3
0
        public static SmallHexGroup Import(CsvReader csv, int index)
        {
            SmallHexGroup group = new SmallHexGroup();
            string        node  = csv.GetField(3 + index).Replace(" ", "").Replace(",", "").Replace("\r", "").Replace("\n", "");

            group.IsValid = node.Length == 7;

            if (!group.IsValid)
            {
                return(group);
            }

            for (int i = 0; i < 7; i++)
            {
                group.HexTiles[i] = new SmallHexTile
                {
                    Symbol = SymbolConverter.Get(node[i].ToString())
                };
            }

            return(group);
        }
Esempio n. 4
0
 public virtual IEnumerable <CommentBlock> FindCommentsForMembers([NotNull] CommentBag commentBag)
 {
     return(SymbolConverter.SearchComments(commentBag, Comments));
 }
Esempio n. 5
0
 public override IEnumerable <CommentBlock> FindCommentsForMembers(CommentBag commentBag) =>
 SymbolConverter.SearchComments(commentBag, Path.Comments);
 public void SetUp()
 {
     _target = new SymbolConverter();
 }
Esempio n. 7
0
 public ModelConverter()
 {
     _symbolConverter = new SymbolConverter();
 }
Esempio n. 8
0
        // ReSharper disable once UnusedMember.Global
        public static void Main([NotNull] TransformationContext context)
        {
#if DEBUG
            Console.WriteLine("Waiting for debug connection");
            Console.Read();
#endif
            var symbolConverter = new SymbolConverter();
            var modelContainer  = symbolConverter.ParseSymbols(context);

            Console.WriteLine("input command..");

            var clo = new Tdl.Transformator.CommandLineOptions();

            while (clo.NeedExit == false)
            {
                Console.WriteLine();

                var commands = Console.ReadLine()?.ToLower().Split(' ');

                clo.Parse(commands);

                switch (clo.Command)
                {
                case ArgumentCommand.GetFiles:
                    var affectedModules = modelContainer.GetAll <ModuleModel>(clo.Mask);
                    foreach (var affectedModule in affectedModules)
                    {
                        Console.WriteLine(affectedModule.FilePath);
                    }

                    break;

                case ArgumentCommand.GetModels:
                    var models = modelContainer.GetAll <Model>(clo.Mask);
                    foreach (var model in models)
                    {
                        var path = clo.IsShortPath ? Path.GetFileName(model.FilePath) : model.FilePath;
                        Console.WriteLine(
                            $"model: '{model.Name}', type: '{model.GetType().Name}' path: '{path}'");
                    }

                    break;

                case ArgumentCommand.RmUnused:
                    new ScenarioProcessor().RemoveUnused(modelContainer.GetAll <ScenarioModel>(clo.Mask));
                    break;

                case ArgumentCommand.ClrDupEnv:
                    new ScenarioProcessor().ReplaceDuplicatesWIthDifferentScenarios(modelContainer.GetAll <ScenarioModel>(clo.Mask));
                    break;

                case ArgumentCommand.ClrEnv:
                    new ScenarioProcessor().SimplifyEnvironments(
                        modelContainer.GetAll <ScenarioModel>(clo.Mask),
                        modelContainer.GetAll <ProductSetModel>(clo.Mask));
                    break;

                case ArgumentCommand.ClrDup:
                    new ScenarioProcessor().ReplaceDuplicates(modelContainer.GetAll <ScenarioModel>(clo.Mask));
                    break;

                case ArgumentCommand.ClrName:
                    new ScenarioProcessor().ClearScenarioNames(modelContainer.GetAll <ScenarioModel>(clo.Mask));
                    break;

                case ArgumentCommand.ClrSets:
                    new ScenarioProcessor().ReplaceDuplicates(modelContainer.GetAll <ScenarioSetModel>(clo.Mask));
                    break;

                case ArgumentCommand.Sort:
                    new ModuleProcessor().SortModuleMembers(modelContainer.GetAll <ModuleModel>(clo.Mask));
                    break;

                case ArgumentCommand.Reset:
                    modelContainer = symbolConverter.ParseSymbols(context);
                    break;

                case ArgumentCommand.Save:
                    SaveParsed(modelContainer.GetPrintable());
                    break;

                case ArgumentCommand.SaveMod:
                    SaveParsed(modelContainer.GetChanged());
                    break;

                case ArgumentCommand.Ungroup:
                    var scenarios = Ungroup(clo.UngroupType, modelContainer);
                    if (clo.NeedPrintUngroup)
                    {
                        PrintScenariosInfo(scenarios, clo.UngroupInfoOutput);
                    }

                    break;

                case ArgumentCommand.Undefined:
                    break;

                default:
                    clo.PrintHelp(Console.Out);
                    break;
                }
            }
        }