Пример #1
0
        protected override void Logic(ValidationTarget target)
        {
            var path = target.GetBaseFolderPath();

            var di         = new DirectoryInfo(path);
            var folderSize = GetDirectorySize(di);

            if (folderSize > limit)
            {
                var excess    = folderSize - limit;
                var reference = AssetDatabase.LoadMainAssetAtPath(path);
                var message   = LocalizedMessage.Get("FolderSizeRule.Exceeded",
                                                     SIReadableNumberText.Get(limit, "B"),
                                                     SIReadableNumberText.Get(folderSize, "B"),
                                                     SIReadableNumberText.Get(excess, "B"));
                var solution    = LocalizedMessage.Get("FolderSizeRule.Exceeded.Solution");
                var solutionURL = LocalizedMessage.Get("FolderSizeRule.Exceeded.SolutionURL");
                AddIssue(new Issue(reference, IssueLevel.Error, message, solution, solutionURL));
            }
        }
Пример #2
0
 public void TestUnit(string unit, string expected)
 {
     Assert.AreEqual(expected, SIReadableNumberText.Get(1000, unit));
 }
Пример #3
0
 public void TestDigit(long input, string expected)
 {
     Assert.AreEqual(expected, SIReadableNumberText.Get(input, "B"));
 }