void OnGUI_Version(AgentSetVersion version) { GUIStyle version_style; EditorGUILayout.LabelField("All Plugins", BoldLabel); scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.Height(180)); for (int i = 0; i < plugins.Agents.Count; i++) { EditorGUILayout.BeginHorizontal(); if (version.hasPlugin(plugins.Agents[i].filename)) { AgentVersion v = version.getVersionOfPlugin(plugins.Agents[i].filename); v.status = EditorGUILayout.Toggle(v.status, GUILayout.MaxWidth(50)); if (v.status == false) { version_style = NormalLabel; } else { { if (v.isVersionReady(version)) { if (v.isManifestReady(manifest) && v.isStringsReady(exist_strings)) { version_style = GreenLabel; } else { version_style = YellowLabel; } } else { version_style = RedLabel; } } } } else { bool status = EditorGUILayout.Toggle(false, GUILayout.MaxWidth(50)); if (status == true) { version.addPlugin().ImportFromManifest(plugins.Agents[i], true); version_style = RedLabel; } else { version_style = NormalLabel; } } EditorGUILayout.LabelField(plugins.Agents[i].filename, version_style); if (GUILayout.Button("...", PositiveButton)) { agent = plugins.Agents[i]; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); }
private void RemoveDependencies(AgentVersion plug) { RemoveDependencies(plug.ManifestSource); foreach (ManifestActivity act in plug.ManifestSource.Activity) { if (manifest.application.hasActivity(act.name)) { manifest.application.activity.Remove(manifest.application.getActivity(act.name)); } } foreach (ManifestMetaData mmd in plug.MetaData) { if (manifest.application.hasMetaData(mmd.name)) { manifest.application.meta_data.Remove(manifest.application.getMetaData(mmd.name)); } } for (int i = 0; i < plug.Strings.Count; i++) { if (strings.hasName(plug.Strings.strings[i].name)) { strings.removeEntry(plug.Strings.strings[i].name); } } }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Description.Length != 0) { hash ^= Description.GetHashCode(); } if (AgentVersion.Length != 0) { hash ^= AgentVersion.GetHashCode(); } if (State != global::Google.Cloud.Dialogflow.V2.Environment.Types.State.Unspecified) { hash ^= State.GetHashCode(); } if (updateTime_ != null) { hash ^= UpdateTime.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private Agent GetAgent(LogEventInfo logEventInfo) { var agentId = AgentId?.Render(logEventInfo); var agentName = AgentName?.Render(logEventInfo); var agentType = AgentType?.Render(logEventInfo); var agentVersion = AgentVersion?.Render(logEventInfo); if (string.IsNullOrEmpty(agentId) && string.IsNullOrEmpty(agentName) && string.IsNullOrEmpty(agentType) && string.IsNullOrEmpty(agentVersion)) { return(null); } var agent = new Agent { Id = agentId, Name = agentName, Type = agentType, Version = agentVersion }; return(agent); }
public static AgentVersion ToDomainObjectFromDto(AgentVersionDto dto) { AgentVersion result = new AgentVersion(dto.VersionString); result.DownloadLink = dto.DownloadLink; result.Id = dto.Id; result.ReleasedDate = dto.ReleasedDate; return(result); }
public override int GetHashCode() { unchecked { var hashCode = AgentID; hashCode = (hashCode * 397) ^ (MachineID != null ? MachineID.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DeviceGuid != null ? DeviceGuid.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CustomerID; hashCode = (hashCode * 397) ^ (CustomerName != null ? CustomerName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ FolderID.GetHashCode(); hashCode = (hashCode * 397) ^ (AgentName != null ? AgentName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SystemName != null ? SystemName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MachineName != null ? MachineName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DomainName != null ? DomainName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CurrentLoggedUsers != null ? CurrentLoggedUsers.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ComputerDescription != null ? ComputerDescription.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Monitored.GetHashCode(); hashCode = (hashCode * 397) ^ LastPatchManagementReceived.GetHashCode(); hashCode = (hashCode * 397) ^ (AgentVersion != null ? AgentVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Favorite.GetHashCode(); hashCode = (hashCode * 397) ^ ThresholdID.GetHashCode(); hashCode = (hashCode * 397) ^ MonitoredAgentID.GetHashCode(); hashCode = (hashCode * 397) ^ Created.GetHashCode(); hashCode = (hashCode * 397) ^ Modified.GetHashCode(); hashCode = (hashCode * 397) ^ Online.GetHashCode(); hashCode = (hashCode * 397) ^ (ReportedFromIP != null ? ReportedFromIP.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AppViewUrl != null ? AppViewUrl.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Motherboard != null ? Motherboard.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Processor != null ? Processor.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Memory.GetHashCode(); hashCode = (hashCode * 397) ^ (Display != null ? Display.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Sound != null ? Sound.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ProcessorCoresCount.GetHashCode(); hashCode = (hashCode * 397) ^ (SystemDrive != null ? SystemDrive.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProcessorClock != null ? ProcessorClock.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Vendor != null ? Vendor.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (VendorSerialNumber != null ? VendorSerialNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (VendorBrandModel != null ? VendorBrandModel.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProductName != null ? ProductName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OS != null ? OS.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OSType != null ? OSType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OSVersion != null ? OSVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OSBuild != null ? OSBuild.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (WindowsSerialNumber != null ? WindowsSerialNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Office != null ? Office.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OfficeSP != null ? OfficeSP.GetHashCode() : 0); hashCode = (hashCode * 397) ^ OfficeOEM.GetHashCode(); hashCode = (hashCode * 397) ^ (OfficeSerialNumber != null ? OfficeSerialNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OfficeFullVersion != null ? OfficeFullVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (LastLoginUser != null ? LastLoginUser.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (HardwareDisks?.Sum(x => x.GetHashCode()) ?? 0); hashCode = (hashCode * 397) ^ (MacAddresses?.Sum(x => x.GetHashCode()) ?? 0); hashCode = (hashCode * 397) ^ (IpAddresses?.Sum(x => x.GetHashCode()) ?? 0); return(hashCode); } }
public static AgentVersionDto FromDomainObjectToDto(AgentVersion source) { AgentVersionDto target = new AgentVersionDto(); target.DownloadLink = source.DownloadLink; target.Id = source.Id; target.ReleasedDate = source.ReleasedDate; target.VersionString = source.VersionString; return(target); }
public static AgentVersion FromEntityToDomainObject(DataAccess.AgentVersion source) { AgentVersion target = new AgentVersion(); target.Id = source.Id; target.DownloadLink = source.DownloadLink; target.ReleasedDate = source.ReleasedDate; target.VersionString = source.VersionString; return(target); }
private void OnWorkerCompleted(object w, RunWorkerCompletedEventArgs e) { AgentVersion lastVersion = e.Result as AgentVersion; if (lastVersion != null && ApplicationVersion.Current.IsOlderThan(lastVersion)) { if (newVersionCallback != null) { newVersionCallback.Invoke(lastVersion); } } }
public AgentVersion Post([FromBody] CreateAgentVersionRequest request) { using (var connection = _connectionFactory.CreateAndOpen()) using (var transaction = connection.BeginTransaction()) { AgentVersion agentVersion = new AgentVersion() { Name = request.Name, ImageId = request.ImageId, DeviceTypeId = request.DeviceTypeId, Logs = request.Logs, }.SetNew(); connection.Insert(agentVersion, transaction); transaction.Commit(); return(agentVersion); } }
private void GetLastVersion(object w, DoWorkEventArgs e) { Thread.Sleep(10000); try { using (VtsWebServiceClient service = new VtsWebServiceClient()) { AgentVersionDto lastAgentVersionDto = service.GetLastAgentVersion(); AgentVersion lastVersion = AgentVersionAssembler. ToDomainObjectFromDto(lastAgentVersionDto); e.Result = lastVersion; } } catch (Exception ex) { if (errorCallback != null) { errorCallback.Invoke(ex, ex.Message); } } }
public static List <AgentSetVersion> GetVersionsFromPath(string path, AgentDependency deps) { List <AgentSetVersion> versions = new List <AgentSetVersion>(); string[] allnames = System.IO.Directory.GetFiles(path); for (int i = 0; i < allnames.Length; i++) { if (allnames[i].EndsWith(".xml")) { bool isvalid = true; AgentSetVersion newv = LoadVersionFromFile(allnames[i]); for (int j = 0; j < newv.Plugins.Count; j++) { AgentVersion plug = newv.Plugins[j]; if (deps.getAgentWithFilename(plug.filename) != null) { plug.ManifestSource = deps.getAgentWithFilename(plug.filename); } else { newv.Plugins.RemoveAt(j); j--; continue; } } if (isvalid) { versions.Add(newv); } else { Debug.Log("Could not add version from file: " + allnames[i] + ". Version missmatch or something like that!"); } } } return(versions); }
private void OnNewVersionAvailable(AgentVersion newVersion) { Dispatcher.Invoke(DispatcherPriority.Normal, new ShowNewVersionWindowDelegate(ShowNewVersionWindow), newVersion.DownloadLink); }
public AgentVersion addPlugin() { AgentVersion v = new AgentVersion(); Plugins.Add(v); return v; }
public void OnGUI(AgentVersion version, AgentDependency deps, AgentSetVersion vset) { GUIStyle status_style = GreenLabel; if (version.MetaData.Count > 0) { EditorGUILayout.LabelField("Meta-Datas", SubBoldLabel); for (int i = 0; i < version.MetaData.Count; i++) { version.MetaData[i].value = EditorGUILayout.TextField(version.MetaData[i].name, version.MetaData[i].value); version.MetaData[i].resource = EditorGUILayout.TextField("Resource", version.MetaData[i].resource); } } else EditorGUILayout.LabelField("No Meta-Data is Required", SubBoldLabel); if (version.ManifestSource.Strings.Count > 0) { EditorGUILayout.LabelField("Strings", SubBoldLabel); for (int i = 0; i < version.Strings.Count; i++) { version.Strings.strings[i].value = EditorGUILayout.TextField(version.Strings.strings[i].name, version.Strings.strings[i].value); } } else EditorGUILayout.LabelField("No String Resource is Required", SubBoldLabel); if (version.ManifestSource.Permission.Count > 0) { EditorGUILayout.LabelField("Permissions", SubBoldLabel); status_style = GreenLabel; for (int i = 0; i < version.ManifestSource.Permission.Count; i++) { status_style = GreenLabel; string perm = version.ManifestSource.Permission[i].name; if (!manifest.hasPermission(perm)) status_style = RedLabel; EditorGUILayout.LabelField(perm, status_style); } } else EditorGUILayout.LabelField("No Permission is Required", SubBoldLabel); if (version.ManifestSource.Activity.Count > 0) { EditorGUILayout.LabelField("Activities", SubBoldLabel); for (int i = 0; i < version.ManifestSource.Activity.Count; i++) { ManifestActivity act = version.ManifestSource.Activity[i]; status_style = GreenLabel; if (!manifest.hasActivity(act.name)) status_style = RedLabel; EditorGUILayout.LabelField(act.name, status_style); for (int j = 0; j < act.meta_data.Count; j++) { act.meta_data[j].value = EditorGUILayout.TextField(act.meta_data[j].name, act.meta_data[j].value); act.meta_data[j].resource = EditorGUILayout.TextField("Resource", act.meta_data[j].resource); } } } else EditorGUILayout.LabelField("No Activity is Required", SubBoldLabel); if (version.ManifestSource.RequiredAgents.Count > 0) { EditorGUILayout.LabelField("Dependencies", SubBoldLabel); for (int i = 0; i < version.ManifestSource.RequiredAgents.Count; i++) { status_style = GreenLabel; if (!deps.hasAgent(version.ManifestSource.RequiredAgents[i])) { status_style = RedLabel; EditorGUILayout.LabelField("Warning: No plugin with filename: " + version.ManifestSource.RequiredAgents[i] + " found. Maybe your Plugin Manager is out-dated.", YellowLabel); } else if (!vset.isPluginActive(version.ManifestSource.RequiredAgents[i])) status_style = RedLabel; EditorGUILayout.LabelField(version.ManifestSource.RequiredAgents[i], status_style); } } else EditorGUILayout.LabelField("No Additional Plugins Required"); }
private void RemoveDependencies(AgentVersion plug) { RemoveDependencies(plug.ManifestSource); foreach (ManifestActivity act in plug.ManifestSource.Activity) { if (manifest.application.hasActivity(act.name)) manifest.application.activity.Remove(manifest.application.getActivity(act.name)); } foreach (ManifestMetaData mmd in plug.MetaData) { if (manifest.application.hasMetaData(mmd.name)) manifest.application.meta_data.Remove(manifest.application.getMetaData(mmd.name)); } for (int i = 0; i < plug.Strings.Count; i++) { if (strings.hasName(plug.Strings.strings[i].name)) { strings.removeEntry(plug.Strings.strings[i].name); } } }
private void AddPluginDependencies(AgentVersion plug) { foreach (ManifestMetaData source in plug.MetaData) { if (!manifest.application.hasMetaData(source.name)) manifest.application.addMetaData().name = source.name; manifest.application.getMetaData(source.name).value = source.value; if (source.resource != "NOT SET") manifest.application.getMetaData(source.name).resource = source.resource; } foreach (ManifestActivity act in plug.ManifestSource.Activity) { if (!manifest.application.hasActivity(act.name)) manifest.application.addActivity().name = act.name; CopyActivityData(act, manifest.application.getActivity(act.name)); } foreach (ManifestMetaData hardmmd in plug.ManifestSource.MetaData) { if (ManifestResource.isResourceString(hardmmd.value)) { if (!manifest.application.hasMetaData(hardmmd.name)) manifest.application.addMetaData().name = hardmmd.name; manifest.application.getMetaData(hardmmd.name).value = hardmmd.value; if (hardmmd.resource != "NOT SET") manifest.application.getMetaData(hardmmd.name).resource = hardmmd.resource; } } foreach (ManifestPermission perm in plug.ManifestSource.Permission) { if (!manifest.hasPermission(perm.name)) manifest.addPermission().name = perm.name; } for (int i = 0; i < plug.ManifestSource.Strings.Count; i++) { if (strings.hasName(plug.Strings.strings[i].name)) strings.setValue(plug.Strings.strings[i].name, plug.Strings.strings[i]); else strings.addString(plug.Strings.strings[i].name, plug.Strings.strings[i]); } if (!System.IO.Directory.Exists(Manifest.LibsFolder)) System.IO.Directory.CreateDirectory(Manifest.LibsFolder); CopyLibraryFiles(System.IO.Directory.GetFiles(plug.ManifestSource.LibraryFolder)); if (plug.ManifestSource.hasResources()) { ResFolder resfolder = new ResFolder(plug.ManifestSource.ResFolder); resfolder.CopyHierarchyTo(Manifest.ResFolder); } }
protected override async Task <int> ExecuteAsync(CommandContext context, CancellationToken cancellationToken) { //Look up the device type var deviceType = await context.FindDeviceTypeAsync(DeviceType, cancellationToken); if (deviceType == null) { return(1); } //create the docker instance using (var dockerClient = CreateDockerClient()) { string fromImage = $"{FromRepository}:{Tag}"; Console.WriteLine($"Pulling from '{fromImage}'..."); var imageCreateParameters = new ImagesCreateParameters { FromImage = fromImage, }; var localAuthConfig = new AuthConfig { }; //Pull the agent version await dockerClient.Images.CreateImageAsync( imageCreateParameters, localAuthConfig, new Progress <JSONMessage>(m => Console.WriteLine(m.ProgressMessage)), cancellationToken); var imageInspection = await dockerClient.Images.InspectImageAsync(fromImage, cancellationToken); if (imageInspection == null) { Console.WriteLine($"Unable to find image '{fromImage}' for inspection."); return(1); } var getAgentUploadInfoRequest = new GetAgentUploadInfoRequest { ImageId = imageInspection.ID, DeviceTypeId = deviceType.Id, Name = Tag }; var agentUploadInfo = await context.Client.AgentUploadInfo.GetAgentUploadInfo(getAgentUploadInfoRequest, cancellationToken); if (!agentUploadInfo.CanUpload) { Console.WriteLine($"Unable to upload: {agentUploadInfo.Reason}"); return(1); } string registryHost = RegistryHost ?? agentUploadInfo.RegistryHost; //Create the image tag paramters var imageTagParameters = new ImageTagParameters { RepositoryName = $"{registryHost}/{agentUploadInfo.Repository}", Tag = Tag, }; Console.WriteLine($"Tagging the image with '{imageTagParameters}'..."); //Tag the image await dockerClient.Images.TagImageAsync(fromImage, imageTagParameters, cancellationToken); string toImage = $"{registryHost}/{agentUploadInfo.Repository}:{Tag}"; Console.WriteLine($"Pushing '{toImage}'..."); //Push to our registry await dockerClient.Images.PushImageAsync( toImage, new ImagePushParameters(), localAuthConfig, new Progress <JSONMessage>(m => Console.WriteLine(m.ProgressMessage)), cancellationToken); //TODO: Let the management service know that we uploaded it var createAgentVersionRequest = new CreateAgentVersionRequest { DeviceTypeId = deviceType.Id, ImageId = imageInspection.ID, MakeCurrent = false, Name = Tag, Logs = "Imported" }; //Create the version AgentVersion agentVersion = await context.Client.AgentVersions.CreateAgentVersion(createAgentVersionRequest, cancellationToken); //And we're done Console.WriteLine($"Version {agentVersion.Id} created."); } return(0); }
private void ApplyVersion(AgentSetVersion v) { PlayerSettings.bundleVersion = v.versionName; PlayerSettings.Android.bundleVersionCode = int.Parse(v.versionCode); PlayerSettings.bundleIdentifier = v.bundleid; manifest.package = v.bundleid; manifest.versionCode = v.versionCode; manifest.versionName = v.versionName; PreDefinitions = v.PreDefine.ToArray(); SetPreDefinitions(); System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/"); System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/res"); System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/libs"); foreach (AgentManifest mans in plugins.Agents) { if (!v.hasPlugin(mans.filename)) { SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), false); RemoveDependencies(mans); } else if (v.getVersionOfPlugin(mans.filename).status == false) { SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), false); RemoveDependencies(v.getVersionOfPlugin(mans.filename)); } } foreach (AgentManifest mans in plugins.Agents) { if (v.hasPlugin(mans.filename)) { AgentVersion plug = v.getVersionOfPlugin(mans.filename); if (plug.status) { SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), true); AddPluginDependencies(plug); } } } AndroidManifestEditor.SaveManifestToFile(Manifest.ManifestFile, manifest); ManifestResource current_strings; if (System.IO.File.Exists(ManifestResource.StringsFilename)) { current_strings = StringEditor.LoadResourcesFromFile(ManifestResource.StringsFilename); } else { current_strings = new ManifestResource(); } for (int i = 0; i < strings.Count; i++) { if (current_strings.hasName(strings.strings[i].name)) { current_strings.setValue(strings.strings[i].name, strings.strings[i]); } else { current_strings.addString(strings.strings[i].name, strings.strings[i]); } } StringEditor.SaveResourcesToFile(ManifestResource.StringsFilename, current_strings); Debug.Log("Done :)"); }
private void AddPluginDependencies(AgentVersion plug) { foreach (ManifestMetaData source in plug.MetaData) { if (!manifest.application.hasMetaData(source.name)) { manifest.application.addMetaData().name = source.name; } manifest.application.getMetaData(source.name).value = source.value; if (source.resource != "NOT SET") { manifest.application.getMetaData(source.name).resource = source.resource; } } foreach (ManifestActivity act in plug.ManifestSource.Activity) { if (!manifest.application.hasActivity(act.name)) { manifest.application.addActivity().name = act.name; } CopyActivityData(act, manifest.application.getActivity(act.name)); } foreach (ManifestMetaData hardmmd in plug.ManifestSource.MetaData) { if (ManifestResource.isResourceString(hardmmd.value)) { if (!manifest.application.hasMetaData(hardmmd.name)) { manifest.application.addMetaData().name = hardmmd.name; } manifest.application.getMetaData(hardmmd.name).value = hardmmd.value; if (hardmmd.resource != "NOT SET") { manifest.application.getMetaData(hardmmd.name).resource = hardmmd.resource; } } } foreach (ManifestPermission perm in plug.ManifestSource.Permission) { if (!manifest.hasPermission(perm.name)) { manifest.addPermission().name = perm.name; } } for (int i = 0; i < plug.ManifestSource.Strings.Count; i++) { if (strings.hasName(plug.Strings.strings[i].name)) { strings.setValue(plug.Strings.strings[i].name, plug.Strings.strings[i]); } else { strings.addString(plug.Strings.strings[i].name, plug.Strings.strings[i]); } } if (!System.IO.Directory.Exists(Manifest.LibsFolder)) { System.IO.Directory.CreateDirectory(Manifest.LibsFolder); } CopyLibraryFiles(System.IO.Directory.GetFiles(plug.ManifestSource.LibraryFolder)); if (plug.ManifestSource.hasResources()) { ResFolder resfolder = new ResFolder(plug.ManifestSource.ResFolder); resfolder.CopyHierarchyTo(Manifest.ResFolder); } }