public PathTemplateWindow(string value, WotContext context, Style style, SaveType saveType)
            : this()
        {
            MainWindow.ApplyUiZoom(this);

            Title = App.Translation.PathTemplateWindow.Title;
            Lingo.TranslateWindow(this, App.Translation.PathTemplateWindow);

            _context  = context;
            _style    = style;
            _saveType = saveType;

            ctValue.Text = value;
            ctValue.Focus();
            ctValue_TextChanged(null, null);
            var isAtlas = saveType != SaveType.Icons;

            if (isAtlas)
            {
                ctIconsPathMacro.Text = "{AtlasPath}";
                for (int i = 4; i <= 9; ++i)
                {
                    var row = this.ctHelpGrid.RowDefinitions[i];
                    row.Height = new GridLength(0);
                }
            }
            else
            {
                _exampleTank = context.Tanks.FirstOrDefault(x => x.TankId.Contains("Object_260"));
                if (_exampleTank == null)
                {
                    _exampleTank = context.Tanks.FirstOrDefault();
                }
            }

            ctIconsPathHelp.Text = isAtlas
                ? ctIconsPathHelp.Text.Replace("{cur}",
                                               Ut.ExpandIconPath("{AtlasPath}", _context, _style, "", "", fragment: true))
                : ctIconsPathHelp.Text.Replace("{cur}",
                                               Ut.ExpandIconPath("{IconsPath}", _context, _style, "", "", fragment: true));
            ctTimPathHelp.Text = ctTimPathHelp.Text.Replace("{cur}",
                                                            Ut.ExpandIconPath("{TimPath}", _context, _style, "", "", fragment: true));
            ctGamePathHelp.Text = ctGamePathHelp.Text.Replace("{cur}",
                                                              Ut.ExpandIconPath("{GamePath}", _context, _style, "", "", fragment: true));
            ctGameVersionHelp.Text = ctGameVersionHelp.Text.Replace("{cur}",
                                                                    Ut.ExpandIconPath("{GameVersion}", _context, _style, "", "", fragment: true));
            ctStyleNameHelp.Text = ctStyleNameHelp.Text.Replace("{cur}",
                                                                Ut.ExpandIconPath("{StyleName}", _context, _style, "", "", fragment: true));
            ctStyleAuthorHelp.Text = ctStyleAuthorHelp.Text.Replace("{cur}",
                                                                    Ut.ExpandIconPath("{StyleAuthor}", _context, _style, "", "", fragment: true));
        }
Beispiel #2
0
 /// <param name="addWarning">
 ///     The method to be used to add warnings about this tank's rendering.</param>
 public Tank(WotTank tank, Action<string> addWarning)
     : base(tank)
 {
     _addWarning = addWarning;
 }
Beispiel #3
0
 /// <summary>Expands a Tank Icon Maker-style path, which may have expandable tokens like "VersionName".</summary>
 public static string ExpandIconPath(string path, WotContext context, Style style, WotTank tank,
                                     bool fragment = false, SaveType saveType = SaveType.Icons)
 {
     if (tank != null)
     {
         var country   = tank.Country;
         var class_    = tank.Class;
         var tankId    = tank.TankId;
         var fullName  = tank.ClientData != null ? tank.ClientData.FullName : tank.TankId;
         var shortName = tank.ClientData != null ? tank.ClientData.ShortName : tank.TankId;
         var tier      = tank.Tier;
         return(ExpandIconPath(path, context, style,
                               country.Pick("ussr", "germany", "usa", "france", "china", "uk", "japan", "czech", "sweden", "poland", "italy", "none"),
                               class_.Pick("light", "medium", "heavy", "destroyer", "artillery", "none"), tankId, fullName,
                               shortName, tier,
                               fragment, saveType));
     }
     else
     {
         return(ExpandIconPath(path, context, style, "none", "none", "none", "none", "none", 0, fragment, saveType));
     }
 }
Beispiel #4
0
 /// <param name="addWarning">
 ///     The method to be used to add warnings about this tank's rendering.</param>
 public Tank(WotTank tank, Action <string> addWarning)
     : base(tank)
 {
     _addWarning = addWarning;
 }