﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SourceBrowser.Search.ViewModels
{
    public struct TokenViewModel
    {
        public string Id { get; } 

        public string Path { get; } 
        public string Username { get; }
        public string Repository { get; }
        public string FullName { get; }
        public string Name
        {
            get
            {
                if (FullName == null)
                    return null;

                var splitName = FullName.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
                return splitName.Last();
            }
        }
        public int LineNumber { get; }

        public TokenViewModel(string username, string repository, string path, string fullName, int lineNumber)
        {
            Id = System.IO.Path.Combine(username, repository, fullName);
            Username = username;
            Repository = repository;
            Path = path;
            FullName = fullName;
            LineNumber = lineNumber;
        }
    }
}

﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SourceBrowser.Search.ViewModels
{
    public struct TokenViewModel
    {
        public string Id { get; } 

        public string Path { get; } 
        public string Username { get; }
        public string Repository { get; }
        public string FullName { get; }
        public string Name
        {
            get
            {
                if (FullName == null)
                    return null;
                string currentName = FullName;
                var parensIndex = FullName.IndexOf("(");
                if(parensIndex != -1)
                {
                    currentName = currentName.Remove(parensIndex, currentName.Length - parensIndex);
                }

                var splitName = currentName.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
                return splitName.Last();
            }
        }
        public int LineNumber { get; }

        public TokenViewModel(string username, string repository, string path, string fullName, int lineNumber)
        {
            Id = username + "/" + repository + "/" + fullName;
            Username = username;
            Repository = repository;
            Path = path;
            FullName = fullName;
            LineNumber = lineNumber;
        }
    }
}

Handle parenthese in method name.
Handle parenthese in method name.
