//public RelayCommand EditCommand { get; set; } /// <summary> /// いくつかの ItemViewModel オブジェクトを作成し、Items コレクションに追加します。 /// </summary> public void LoadData() { var manifests = IOManager.GetManager().LoadManifests().Reverse().ToList();// as List<ManifestModel>; if (manifests.Count > 0) { for (var i = 0; i < manifests.Count; i++)// m in manifests) { var m = manifests[i]; if (m.Contents.Count == 0) { m.Contents.Add(new ContentModel { Description = "タップすると、目標の編集・小目標の追加ができます。" }); } Manifests.Add(m); } (App.Current as App).SelectedManifestID = Manifests[0].ID; SelectedDone = Manifests[0].IsDone; IOManager.GetManager().LoadSetting(); this.IsDataLoaded = true; Messenger.Default.Send("", Contract.UpdateAgent); } else { Messenger.Default.Send("", Contract.RedirectToInitial); Messenger.Default.Send("", Contract.InitializeFail); } }
private void LoadInformation() { Manifests.Clear(); try { var manifests = _manifestService.GetManifestNames(); foreach (var manifestName in manifests) { var manifest = _manifestService.GetManifest(manifestName); Manifests.Add(new ManifestViewModel { Name = manifestName, DomainOverride = manifest.OverrideDomain, DomainOverrideChangedCommand = new RelayCommand(param => _manifestService.SetActiveManifestDomain(param != null ? param.ToString() : string.Empty)) }); } var selectedManifestName = _manifestService.GetActiveManifestName(); SelectedManifest = Manifests.FirstOrDefault(m => m.Name == selectedManifestName); } catch (Exception e) { MessageBox.Show(e.Message, "Error Loading Manifest List", MessageBoxButton.OK, MessageBoxImage.Error); } }
protected bool Equals(ArgoApplicationSyncOperation other) { return(base.Equals(other) && DryRun == other.DryRun && Manifests.IsCollectionEqualTo(other.Manifests) && Prune == other.Prune); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { this.Manifests = new ObservableCollection <ManifestModel>(); Messenger.Default.Register <string>("", Contract.InitializeFail, s => { this.IsDataLoaded = false; }); Messenger.Default.Register <Guid>(this, Contract.ChangeCurrentManifest, id => { (App.Current as App).SelectedManifestID = id; }); Messenger.Default.Register <ManifestModel>(this, Contract.UpdateMain, m => { var old = Manifests.Where(mm => mm.ID.Equals(m.ID)).FirstOrDefault(); if (old != null) { Manifests.Remove(old); Manifests.Insert(0, m); } }); if (IsInDesignMode) { // Code runs in Blend --> create design time data. } else { } }
public static unsafe void ReadObject(ref TVisitor v, ref byte *bytes, byte *end) { while (end - bytes > 2) { var fieldNumber = *bytes++; var manifest = *bytes++; v.PushField(fieldNumber); // remove nullable manifest = (byte)(manifest & ~Manifests.Nullable); if (Manifests.IsArray(manifest)) { if (StoreLengthDecorator.TryReadLength(ref bytes, out var length)) { var itemManifest = (byte)(manifest & ~Manifests.Array); ReadArray(ref v, bytes, bytes + length, itemManifest); bytes += length; } else { v.OnNull(); } }
public override int GetHashCode() { unchecked { int hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ DryRun.GetHashCode(); hashCode = (hashCode * 397) ^ (Manifests != null ? Manifests.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Prune.GetHashCode(); return(hashCode); } }
private void InitializeUx() { MicroserviceList.Items.Clear(); _manifests = _configM.GetAll(); var services = (from m in _manifests.list let path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) select new Microservice {icon = path + @"\images\MicroserviceIcon.png", name = m.name}).ToList(); foreach (var service in services) { MicroserviceList.Items.Add(service); } MicroserviceList.SelectedIndex = 0; MicroserviceName.Focus(); }
private void InitializeUx() { MicroserviceList.Items.Clear(); _manifests = _configM.GetAll(); var services = (from m in _manifests.list let path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) select new Microservice { icon = path + @"\images\MicroserviceIcon.png", name = m.name }).ToList(); foreach (var service in services) { MicroserviceList.Items.Add(service); } MicroserviceList.SelectedIndex = 0; MicroserviceName.Focus(); }
public Manifests GetAll() { Manifests manifests = new Manifests(); try { List<Manifest> manifestList = this._persist.SelectAll<Manifest>(); foreach(Manifest m in manifestList) { manifests.list.Add(m); } this._persist.InsertCache(manifests); } catch (Exception err) { throw new Exception(Errors.ERR_CONFIGM_BAGREQUEST, err); } return manifests; }
public Manifests GetAll() { Manifests manifests = new Manifests(); try { List <Manifest> manifestList = this._persist.SelectAll <Manifest>(); foreach (Manifest m in manifestList) { manifests.list.Add(m); } this._persist.InsertCache(manifests); } catch (Exception err) { throw new Exception(Errors.ERR_CONFIGM_BAGREQUEST, err); } return(manifests); }
public void GetManifests() { JObject m = null; string target = Version; do { if (m != null) { target = (string)m.GetValue("inheritsFrom"); } var dest = Path.Combine(Root, "versions", target); if (!Directory.Exists(dest)) { Directory.CreateDirectory(dest); } string targetPath = Path.Combine(dest, target + ".json"); Program.repo.DownloadFile($"versions/{target}/{target}.json", targetPath); using (StreamReader sr = new StreamReader(targetPath)) { string content = sr.ReadToEnd(); m = JObject.Parse(content); } Manifests.Add(m); }while (m.TryGetValue("inheritsFrom", out JToken _)); IsInherited = Manifests.Count > 1; Manifest = Manifests.Last(); ActualVersion = (string)Manifest.GetValue("id"); for (int i = (Manifests.Count - 2); i >= 0; i--) { Manifest.Merge(Manifests[i], new JsonMergeSettings() { MergeArrayHandling = MergeArrayHandling.Concat }); } }
static void CreateBuild(BuilderOptions options) { Console.WriteLine("Creating Build for " + options.UpdateChannel.ToString() + " version " + options.Version); List <Manifest> Manifests; //Get the Manifests if the file exists. If it doesn't, create it if (!File.Exists(options.Manifest)) { Console.WriteLine("Manifest file does not exist, creating Manifests"); CreateDefaultManifests(options); } Manifests = JsonConvert.DeserializeObject <List <Manifest> >(File.ReadAllText(options.Manifest)); //Get the update channel we are building for Manifest man = Manifests.FirstOrDefault(x => x.Channel == options.UpdateChannel.ToString()); if (man == null) { Console.WriteLine("Error: Cannot find the manifest for " + options.Manifest + "! Aborting."); Environment.Exit(0); } //Get the list of builds string buildListFilename = options.UpdateChannel.ToString() + "BuildList.txt"; List <Build> builds = JsonConvert.DeserializeObject <List <Build> >(File.ReadAllText(buildListFilename)); Console.WriteLine("Creating build information"); //Create the build Build b = new Build() { FileName = Path.GetFileName(options.BuildFile), DownloadURL = options.URL + options.UpdateChannel.ToString() + "/", Notes = options.UpdateNotes, DetailURL = options.DetailedNotesURL, Version = options.Version, Date = DateTime.Now, }; Console.WriteLine("Writing Build"); //Copy the file to the output directory string outputDir = options.OutputPath + "/" + options.UpdateChannel.ToString() + "/"; Directory.CreateDirectory(options.OutputPath); Directory.CreateDirectory(outputDir); //Create the version file UpdaterLib.Version version = new UpdaterLib.Version() { Name = b.Version, Channel = options.UpdateChannel, Origin = b.DownloadURL, Notes = b.Notes, BuildDate = b.Date, }; //And insert it into the output Console.WriteLine("Inserting version.txt"); using (ZipFile z = new ZipFile(options.BuildFile)) { z.AddEntry("version.txt", JsonConvert.SerializeObject(version)); string updaterexe = Assembly.GetExecutingAssembly().Location; z.AddFile(updaterexe, ""); z.Save(); } Console.WriteLine("Computing Sha Hash of the build"); //Create the sha hash string hash = ""; using (FileStream stream = File.OpenRead(options.BuildFile)) { SHA256Managed sha = new SHA256Managed(); byte[] h = sha.ComputeHash(stream); hash = BitConverter.ToString(h).Replace("-", String.Empty); } b.Sha = hash; builds.Add(b); Console.WriteLine("Deploying Build"); File.Copy(options.BuildFile, outputDir + Path.GetFileName(options.BuildFile), true); Console.WriteLine("Writing Buildfile"); //Write the builds file File.WriteAllText(buildListFilename, JsonConvert.SerializeObject(builds)); File.WriteAllText(options.OutputPath + "/" + buildListFilename, JsonConvert.SerializeObject(builds)); //Update the manifest man.LastUpdate = b.Date; man.LatestVersion = b.Version; Console.WriteLine("Writing Manifest"); //Write the manifests File.WriteAllText(options.Manifest, JsonConvert.SerializeObject(Manifests)); File.WriteAllText(options.OutputPath + "/" + options.Manifest, JsonConvert.SerializeObject(Manifests)); }