internal UserConfigurationTile
        (
            MmasfContext context,
            UserConfiguration configuration,
            Selection <UserConfiguration> selection,
            int index,
            ContextView parent)
        {
            Context       = context;
            Configuration = configuration;
            Parent        = parent;
            var data = Configuration.CreateTileView(Configuration.GetIndicatorColor());

            var frame = new Label
            {
                Opacity    = 0,
                Background = Brushes.Yellow
            };

            var result = new Grid();

            result.Children.Add(data);
            result.Children.Add(frame);

            selection.Add
            (
                index,
                Configuration,
                Selection.List(this, Selection.ViewByOpacity(frame))
            );

            ContextMenu = CreateContextMenu();
            Content     = result;
        }
Beispiel #2
0
        public static FileCluster Create
        (
            SmbFile path,
            SmbFile[] paths,
            IDictionary <string, bool> knownMods,
            MmasfContext parent)
        {
            var infoJSon = GetInfoJSon(path);

            if (infoJSon == null)
            {
                return(null);
            }

            var dictionary = path.Directory.Directory;

            var index = paths
                        .OrderByDescending(item => item.FullName.Split('\\').Length)
                        .ThenBy(item => item.FullName)
                        .IndexWhere(file => file.Contains(dictionary))
                        .AssertValue();

            var modName     = infoJSon.Name;
            var isEnabled   = knownMods.GetValueOrNull(modName);
            var version     = new Version(infoJSon.Version);
            var description = parent.ModDictionary[modName][version];

            description.InfoJSon = infoJSon;
            return(new FileCluster(path, isEnabled, index, description, infoJSon));
        }
Beispiel #3
0
        internal static ScrollViewer CreateView
            (this MmasfContext context, Selection <UserConfiguration> selection, ContextView parent)
        {
            var result = new ScrollViewer();
            var panel  = new StackPanel();

            var elements = context
                           .UserConfigurations
                           .Select
                           (
                (configuration, index) =>
                (UIElement) new UserConfigurationTile
                (
                    context,
                    configuration,
                    selection,
                    index,
                    parent
                )
                           );

            foreach (var configuration in elements)
            {
                panel.Children.Add(configuration);
            }

            result.Content = panel;
            result.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            return(result);
        }
Beispiel #4
0
    UserConfiguration(SmbFile path, SmbFile[] allPaths, MmasfContext parent)
    {
        Path     = path;
        AllPaths = allPaths;
        Parent   = parent;
        ModConfigurationCache = new(GetModConfiguration);
        ModFilesCache         = new(GetModFiles);
        SaveFilesCache        = new(GetSaveFiles);
        return;

/*
 *      RunLua();
 *      LogfileWatcher = new(Path);
 */
    }
Beispiel #5
0
 internal static UserConfiguration Create
     (SmbFile item, SmbFile[] allPaths, MmasfContext parent) => new(item, allPaths, parent);