internal void RestartTimer(bool refresh = false)
        {
            _buildRefreshTimer.Stop();
            if (refresh)
            {
                Builds.Clear();
                OnPropertyChanged(new PropertyChangedEventArgs(nameof(DisplaySpinner)));
            }

            if (string.IsNullOrWhiteSpace(_configManager.Get <DevOpsServerConfig>().Url))
            {
                return;
            }

            _buildRefreshTimer.Interval = _serverConfig.BuildRefreshTime;
            _buildRefreshTimer.Start();

            // In general, not awaiting an async Method (which returns a Task) will cause any Exception in the method being lost, going nowhere.
            // Awaiting the Task, will throw the exception on the current thread.
            // async void Methods cannot be awaited, BUT an Exception will hit the application completely unhandled, usually causing it to crash.
            // Thus, async void Methods (usually only event handlers) must handle all exceptions themselves.

            // Here, we want to call an async method which does return a Task. However, we do not want to await it.
            // async () => await X() is effectively creating an async void method inline, so any Exception which leaves, would at least crash the application, so we know
            // Since RefreshAllAsync handles it's exceptions, we can do that without crashing the application.

            Task.Run(async() => await RefreshAllAsync().ConfigureAwait(false));
        }
示例#2
0
 public static void BuildDLCConfig(DLCItem dlc)
 {
     //清除缓存
     PackedAssets_Internal.Clear();
     PackedAssets_Native.Clear();
     PackedAssets_DLC.Clear();
     Builds.Clear();
     Rules.Clear();
     AllDependencies.Clear();
     AllAssets.Clear();
     AllBundles.Clear();
     AllSharedBundles.Clear();
     Consts.Clear();
     //永远提前打包Internal
     if (!dlc.IsInternal)
     {
         BuildDLCConfigInternal(Internal);
     }
     //如果不是NativeDLC则先BuildNativeDLC,防止资源被其他DLC重复打包
     if (!dlc.IsInternal && !dlc.IsNative)
     {
         BuildDLCConfigInternal(Native);
     }
     BuildDLCConfigInternal(dlc);
 }
示例#3
0
        /// <summary>
        /// 活的构建的数据
        /// </summary>
        /// <param name="manifestPath"></param>
        /// <returns></returns>
        private static List <AssetBundleBuild> GenerateAssetBundleBuildData(DLCItem dlc)
        {
            if (dlc.IsInternal)
            {
                PackedAssets_Internal.Clear();
            }
            else if (dlc.IsNative)
            {
                PackedAssets_Native.Clear();
            }
            PackedAssets_DLC.Clear();
            Builds.Clear();
            Rules.Clear();
            AllDependencies.Clear();
            AllAssets.Clear();
            AllBundles.Clear();
            AllSharedBundles.Clear();

            //建立其他文件
            List <BuildRuleConfig> tempBuildDatas = dlc.BuildRuleData;

            if (tempBuildDatas == null && tempBuildDatas.Count == 0)
            {
                CLog.Error("没有配置相关的AssetBundle信息");
                return(null);
            }

            foreach (var item in tempBuildDatas)
            {
                BuildRule buildRule = null;
                if (item.BuildRuleType == BuildRuleType.Directroy)
                {
                    buildRule = new BuildAssetsWithDirectroy(dlc, item);
                }
                else if (item.BuildRuleType == BuildRuleType.FullPath)
                {
                    buildRule = new BuildAssetsWithPath(dlc, item);
                }
                else if (item.BuildRuleType == BuildRuleType.File)
                {
                    buildRule = new BuildAssetsWithFile(dlc, item);
                }
                Rules.Add(buildRule);
            }

            //搜集依赖的资源
            foreach (var item in Rules)
            {
                CollectDependencies(item.Config.FullSearchPath);
            }
            //打包共享的资源
            BuildSharedAssets(dlc);

            foreach (var item in Rules)
            {
                item.Build();
            }
            EditorUtility.ClearProgressBar();
            return(Builds);
        }
        public async Task LoadAsync()
        {
            // 35
            var lookup = await _lookupBuildsService.GetBuildsAsync();

            Builds.Clear();

            foreach (var item in lookup)
            {
                Builds.Add(item);
            }
        }
        public void Calculate()
        {
            Results.Add(new BuildStabilityMetric
            {
                Date               = Date,
                FailureRate        = CalculateFailureRateFor(Builds),
                RecoveryTime       = CalculateAverageRecoveryTimeInHoursFor(Intervals),
                RecoveryTimeStdDev = Calculator.ConvertMillisecondsToHours(
                    Calculator.CalculateStandardDeviation(Intervals)),
                IgnoredTestCount = Builds.Sum(build => build.IgnoredTestCount)
            });

            Intervals.Clear();
            Builds.Clear();
        }
 private void InitBuilds(TfsBuildMonitorManager manager)
 {
     Builds.Clear();
     foreach (var buildDef in manager.BuildDefinitions)
     {
         var t = buildDef.First();
         Builds.Add(new BuildDefinitionViewModel()
         {
             Id              = t.id,
             Name            = t.definition.name,
             LastRequested   = DateTime.Parse(t.queueTime),
             LastRequestedBy = t.requestedFor.displayName,
             UserImage       = t.requestedFor.imageUrl,
             Status          = t.result,
             LastChange      = t.LastChange
         });
     }
     Refresh();
 }
示例#7
0
        private async Task Search()
        {
            StartLoading();
            Builds.Clear();
            DisplayIsIndeterminate = true;

            await Task.Run(async() =>
            {
                ProgressTotalItems = buildDefs.Length;

                foreach (IBuildDefinition buildDef in buildDefs)
                {
                    IBuildDetail[] builds = await SearchBuilds(buildDef);
                    foreach (IBuildDetail detail in builds)
                    {
                        Builds.AddOnUi(new BuildDetail(buildDef, detail));
                    }
                    ProgressValue++;
                    DisplayIsIndeterminate = false;
                }
            });

            Working = false;
        }
示例#8
0
        public static void Read()
        {
            Builds.Clear();
            Games.Clear();
            RecentFiles.Clear();
            Settings.Clear();
            Hotkeys.Clear();
            AdditionalSettings.Clear();
            FavouriteTextureFolders.Clear();

            var root = ReadSettingsFile();

            if (root == null)
            {
                return;
            }

            var settings = root.Children.FirstOrDefault(x => x.Name == "Settings");

            if (settings != null)
            {
                foreach (var key in settings.GetPropertyKeys())
                {
                    Settings.Add(new Setting {
                        Key = key, Value = settings[key]
                    });
                }
            }
            var recents = root.Children.FirstOrDefault(x => x.Name == "RecentFiles");

            if (recents != null)
            {
                foreach (var key in recents.GetPropertyKeys())
                {
                    int i;
                    if (int.TryParse(key, out i))
                    {
                        RecentFiles.Add(new RecentFile {
                            Location = recents[key], Order = i
                        });
                    }
                }
            }
            var games = root.Children.Where(x => x.Name == "Game");

            foreach (var game in games)
            {
                var g = new Game();
                g.Read(game);
                Games.Add(g);
            }
            var builds = root.Children.Where(x => x.Name == "Build");

            foreach (var build in builds)
            {
                var b = new Build();
                b.Read(build);
                Builds.Add(b);
            }
            var hotkeys = root.Children.FirstOrDefault(x => x.Name == "Hotkeys");

            if (hotkeys != null)
            {
                foreach (var key in hotkeys.GetPropertyKeys())
                {
                    var spl = key.Split(':');
                    Hotkeys.Add(new Hotkey {
                        ID = spl[0], HotkeyString = hotkeys[key]
                    });
                }
            }

            Serialise.DeserialiseSettings(Settings.ToDictionary(x => x.Key, x => x.Value));
            Sledge.Settings.Hotkeys.SetupHotkeys(Hotkeys);

            var additionalSettings = root.Children.FirstOrDefault(x => x.Name == "AdditionalSettings");

            if (additionalSettings != null)
            {
                foreach (var child in additionalSettings.Children)
                {
                    if (child.Children.Count > 0)
                    {
                        AdditionalSettings.Add(child.Name, child.Children[0]);
                    }
                }
            }

            var favTextures = root.Children.FirstOrDefault(x => x.Name == "FavouriteTextures");

            if (favTextures != null && favTextures.Children.Any())
            {
                try
                {
                    var ft = GenericStructure.Deserialise <List <FavouriteTextureFolder> >(favTextures.Children[0]);
                    if (ft != null)
                    {
                        FavouriteTextureFolders.AddRange(ft);
                    }
                    FixFavouriteNames(FavouriteTextureFolders);
                }
                catch
                {
                    // Nope
                }
            }

            if (!File.Exists(SettingsFile))
            {
                Write();
            }
        }