private int GetPropertyDefId(string propertyName, Vault vault) { var propertyDefs = vault.PropertyDefOperations.GetPropertyDefs(); int propertyDefId = -1; foreach (PropertyDef propertyDef in propertyDefs) if (propertyDef.Name == propertyName) { propertyDefId = propertyDef.ID; break; } return propertyDefId; }
public PSVault(Vault vault, ActiveDirectoryClient adClient) { var vaultTenantDisplayName = ModelExtensions.GetDisplayNameForTenant(vault.Properties.TenantId, adClient); VaultName = vault.Name; Location = vault.Location; ResourceId = vault.Id; ResourceGroupName = (new ResourceIdentifier(vault.Id)).ResourceGroupName; Tags = TagsConversionHelper.CreateTagHashtable(vault.Tags); Sku = vault.Properties.Sku.Name.ToString(); TenantId = vault.Properties.TenantId; TenantName = vaultTenantDisplayName; VaultUri = vault.Properties.VaultUri; EnabledForDeployment = vault.Properties.EnabledForDeployment.HasValue ? vault.Properties.EnabledForDeployment.Value : false; EnabledForTemplateDeployment = vault.Properties.EnabledForTemplateDeployment; EnabledForDiskEncryption = vault.Properties.EnabledForDiskEncryption; AccessPolicies = vault.Properties.AccessPolicies.Select(s => new PSVaultAccessPolicy(s, adClient)).ToArray(); OriginalVault = vault; }
/// <summary> /// Install nested UX App via API if not already installed /// </summary> /// <param name="vault"></param> protected override void InitializeApplication(Vault vault) { try { string appPath = "Nested UIX App.zip"; if (File.Exists(appPath)) { vault.CustomApplicationManagementOperations.InstallCustomApplication(appPath); } else { SysUtils.ReportErrorToEventLog("File: " + appPath + " does not exist"); } } catch (Exception ex) { SysUtils.ReportErrorToEventLog(ex.Message); } base.InitializeApplication(vault); }
//private int GetValueListItemId(int valueListId, string value, Vault vault, SearchConditions searchConditions) private int GetValueListItemId(PropertyDef propertyDef, string value, Vault vault) { int valueListItemId = -1; System.Collections.IEnumerable items = null; bool useSearch = false; /* search fails for MFExpressionTypePropertyValue */ foreach (SearchCondition searchCondition in propertyDef.StaticFilter) { Debug.WriteLine("searchCondition: " + searchCondition.Expression.Type.ToString() + " " + "condition: " + searchCondition.ConditionType + " " + "typedValue: " + searchCondition.TypedValue.DisplayValue); useSearch = searchCondition.Expression.Type == MFExpressionType.MFExpressionTypeTypedValue; } /* use the search trim down elements (value list items are capped at 5000) */ if (useSearch) items = vault.ValueListItemOperations.SearchForValueListItemsEx(propertyDef.ValueList, propertyDef.StaticFilter); else items = vault.ValueListItemOperations.GetValueListItems(propertyDef.ValueList); //int index = 0; foreach (ValueListItem valueListItem in items) { if (valueListItem.Name == value) { valueListItemId = valueListItem.ID; break; } //index++; } //Debug.WriteLine(index); Debug.WriteLine(string.Format("valueListId={0}, value={1} => valueListItemId={2}", propertyDef.ValueList, value, valueListItemId)); return valueListItemId; }
private IPromise<AuthenticationSchemes> CheckAuthentication(Vault vault, bool async) { var result = new Promise<AuthenticationSchemes>(); if (vault.Authentication == AuthenticationSchemes.None && _conn.Version >= 11) { var hReq = (HttpWebRequest)System.Net.WebRequest.Create(vault.Url); hReq.Credentials = null; hReq.UnsafeAuthenticatedConnectionSharing = true; hReq.Method = "HEAD"; var req = new WebRequest(hReq, CompressionType.none); result.CancelTarget( req.Execute(async) .Progress((p, m) => result.Notify(p, m)) .Done(r => { vault.Authentication = AuthenticationSchemes.Anonymous; result.Resolve(vault.Authentication); }).Fail(ex => { var webEx = ex as HttpException; if (webEx != null && webEx.Response.StatusCode == HttpStatusCode.Unauthorized) { vault.Authentication = req.CheckForNotAuthorized(webEx.Response); result.Resolve(vault.Authentication); } else { result.Reject(ex); } })); } else { result.Resolve(AuthenticationSchemes.Anonymous); } return result; }
public abstract void Read(Vault vault, BinaryReader br);
public static bool ValidateExtendedSettings(Vault credentialContainer) { string[] ignore; return(ValidateExtendedSettings(credentialContainer, out ignore)); }
/// <summary> /// Extension Object => Uninstall => Event Hook. /// </summary> /// <param name="v"><see cref="MFilesAPI.Vault"/></param> public virtual void Uninstall(Vault v) { this.updateConnection(v); }
public override void Read(Vault vault, BinaryReader br) { throw new System.NotImplementedException(); }
public override void DoImpl() { var presets = Ctx.Vault.Metadata["views"]; if (presets.IsNeitherNullNorEmpty()) { if (new Regex(@"^\[.*\]$").IsMatch(presets)) { var reversedViewNames = new List <String>(); if (presets != "[]") { presets.Slice(1, -1).Split(',').Select(s => s.Trim()).ForEach(reversedViewNames.Add); } reversedViewNames.Reverse(); var supportedViews = VaultViewFactories.All; var reversedPresetViews = reversedViewNames.Select(name => supportedViews.SingleOrDefault(v => v.Name == name)); if (reversedPresetViews.All(f => f != null)) { reversedPresetViews.ForEach(f => { var view = f.Create(); view.Apply(Ctx); Ctx.Views.Push(view); }); } else { var unknownIndices = reversedPresetViews.Select((v, i) => v == null ? i : -1).Where(i => i != -1); var unknownViews = unknownIndices.Select(i => reversedViewNames.ElementAt(i)).StringJoin(); var warningMessage = unknownIndices.Count() == 1 ? String.Format(Resources.Views_UnknownSingle_Warning, unknownViews) : String.Format(Resources.Views_UnknownMultiple_Warning, unknownViews); if (MessageBox.Show( warningMessage, Resources.Confirmation_Title, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.Yes) { Ctx.SetVault(null, false); } else { reversedPresetViews.ForEach(f => { if (f != null) { var view = f.Create(); view.Apply(Ctx); Ctx.Views.Push(view); } }); var viewStack = "[" + Views.Select(v1 => v1.Name).StringJoin() + "]"; Vault.Metadata["views"] = viewStack; Vault.Save(); } } } else { if (MessageBox.Show( Resources.Views_CorruptedViewNote_Message, Resources.Views_CorruptedViewNote_Title, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.Yes) { Ctx.SetVault(null, false); } else { Vault.Metadata["views"] = null; Vault.Save(); } } } }
public Vault Create(Vault newVault) { return(_repo.Create(newVault)); }
public void AddPointers(Vault vault) { _text.AddPointers(vault); }
public override void Read(Vault vault, BinaryReader br) { Hash = br.ReadUInt32(); // SKYDOME_1_DAWN, SKYDOME_1_DUSK, etc }
public override void Write(Vault vault, BinaryWriter bw) { bw.Write(Hash); }
private IEnumerable <MfTask> GetTaskApprove(Vault vault, int?mfuserid, string tasktitle) { var forworklist = new List <MfTask>(); try { var ClassNotification = vault.GetMetadataStructureItemIDByAlias(MFMetadataStructureItem.MFMetadataStructureItemClass, MfilesAliasConfig.ClassNotification); // var ClassTaskApprove = //vault.GetMetadataStructureItemIDByAlias(MFMetadataStructureItem.MFMetadataStructureItemClass, // MfilesAliasConfig.ClassTaskApprove); var scs = new SearchConditions(); { var sc = new SearchCondition(); sc.ConditionType = MFConditionType.MFConditionTypeEqual; sc.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectTypeID); sc.TypedValue.SetValueToLookup(new Lookup { Item = (int)MFBuiltInObjectType.MFBuiltInObjectTypeAssignment }); scs.Add(-1, sc); } { var sc = new SearchCondition(); sc.ConditionType = MFConditionType.MFConditionTypeNotEqual; sc.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefClass; sc.TypedValue.SetValueToLookup(new Lookup { Item = ClassNotification }); scs.Add(-1, sc); } { var sc = new SearchCondition(); sc.ConditionType = MFConditionType.MFConditionTypeEqual; sc.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo; sc.TypedValue.SetValueToLookup(new Lookup { Item = (int)mfuserid }); scs.Add(-1, sc); } var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs, MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions; // Log.Info(string.Format("mfuserid:{0},tasks:{1},ClassTaskApprove:{2}", mfuserid, ovs.Count, ClassTaskApprove)); foreach (ObjectVersion objectVersion in ovs) { var pvs = vault.ObjectPropertyOperations.GetProperties(objectVersion.ObjVer); var link = vault.ObjectOperations.GetMFilesURLForObject(objectVersion.ObjVer.ObjID, objectVersion.ObjVer.Version, true); var taskname = pvs.SearchForProperty(0).GetValueAsLocalizedText(); var relations = vault.ObjectOperations.GetRelationships(objectVersion.ObjVer, MFRelationshipsMode.MFRelationshipsModeAll); var creator = string.Empty; foreach (ObjectVersion relation in relations) { // var objpvs = vault.ObjectPropertyOperations.GetProperties(relation.ObjVer); // var name = objpvs.SearchForProperty(0).GetValueAsLocalizedText(); // creator = objpvs.SearchForProperty((int) MFBuiltInPropertyDef.MFBuiltInPropertyDefCreatedBy).GetValueAsLocalizedText(); creator = vault.ObjectPropertyOperations.GetProperty(relation.ObjVer, (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefCreatedBy).GetValueAsLocalizedText(); break; // Log.Info(string.Format("{4},relation: {0},{1},{2},{3},{5}", name, relation.ObjVer.Type, relation.ObjVer.ID, relation.ObjVer.Version, taskname, creator)); } var taskOrNoticeOfVault = new MfTask { Url = link, Name = taskname, ClientName = vault.Name, LastModifiedTime = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefLastModified) .GetValueAsLocalizedText(), Createby = creator, Time = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefCreated).GetValueAsLocalizedText() }; forworklist.Add(taskOrNoticeOfVault); } } catch (Exception ex) { Log.Info(string.Format("GetTaskApprove {0},{1} error:{2}", vault.Name, mfuserid, ex.Message)); } return(forworklist); }
private IEnumerable <MfTask> GetTaskWorkflow(Vault vault, int?mfuserid, string tasktitle) { var forworklist = new List <MfTask>(); try {//工作流任务 var scs = new SearchConditions(); { var sc = new SearchCondition(); sc.ConditionType = MFConditionType.MFConditionTypeNotEqual; sc.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectTypeID); sc.TypedValue.SetValueToLookup(new Lookup { Item = (int)MFBuiltInObjectType.MFBuiltInObjectTypeAssignment }); scs.Add(-1, sc); } { var sc = new SearchCondition(); sc.ConditionType = MFConditionType.MFConditionTypeEqual; sc.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo; sc.TypedValue.SetValueToLookup(new Lookup { Item = (int)mfuserid }); scs.Add(-1, sc); } var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs, MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions; Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, ovs.Count)); foreach (ObjectVersion objectVersion in ovs) { var pvs = vault.ObjectPropertyOperations.GetProperties(objectVersion.ObjVer); // Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "aaa")); var link = vault.ObjectOperations.GetMFilesURLForObject(objectVersion.ObjVer.ObjID, objectVersion.ObjVer.Version, true); // Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "bbb")); var Name = pvs.SearchForProperty(0).GetValueAsLocalizedText(); // Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "ccc")); var Assigner = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefCreatedBy) .GetValueAsLocalizedText(); // Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "ddd")); var Content = string.Empty; try { Content = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignmentDescription) .GetValueAsLocalizedText(); } catch (Exception) { } // Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "eee")); var Date = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefCreated) .GetValueAsLocalizedText(); // Log.Info(string.Format("mfuserid:{0},工作流普通任务 tasks:{1}", mfuserid, "fff")); var tonn = new MfTask { Url = link, Name = Name, Createby = Assigner, ClientName = vault.Name, LastModifiedTime = pvs.SearchForProperty((int)MFBuiltInPropertyDef.MFBuiltInPropertyDefLastModified) .GetValueAsLocalizedText(), Desc = Content, Time = Date }; forworklist.Add(tonn); } } catch (Exception ex) { Log.Info("GetTaskWorkflow error:" + ex.Message); } return(forworklist); }
public abstract void Write(Vault vault, BinaryWriter bw);
private Dictionary<int, PropertyDef> GetPropertyDefLookupById(Vault vault) { var lookup = new Dictionary<int, PropertyDef>(); var propertyDefs = vault.PropertyDefOperations.GetPropertyDefs(); foreach (PropertyDef propertyDef in propertyDefs) { if (!lookup.ContainsKey(propertyDef.ID)) lookup.Add(propertyDef.ID, propertyDef); } return lookup; }
public IEnumerable <CollectionReferenceInfo> GetReferencedCollections(Database database, Vault vault) { return(Items.OfType <IReferencesCollections>() .SelectMany(rc => rc.GetReferencedCollections(database, vault))); }
public override void Read(Vault vault, BinaryReader br) { mPointStart = br.ReadUInt16(); mPointCount = br.ReadUInt16(); }
public override void Read(Vault vault, BinaryReader br) { //Debug.WriteLine("start"); }
public Vault Create(Vault newVault) { newVault.Id = _repo.Create(newVault); return(newVault); }
public override void Write(Vault vault, BinaryWriter bw) { bw.Write(new byte[8]); }
public override void Write(Vault vault, BinaryWriter bw) { throw new System.NotImplementedException(); }
internal object Create(Vault newVault) { return(_repo.Create(newVault)); }
private static void EnsureCredentials(Vault credentialContainer) { Args.ThrowIfNullOrEmpty(credentialContainer["SmtpHost"]); Args.ThrowIfNullOrEmpty(credentialContainer["UserName"]); Args.ThrowIfNullOrEmpty(credentialContainer["Password"]); }
public override void Write(Vault vault, BinaryWriter bw) { bw.Write(mPointStart); bw.Write(mPointCount); }
/// <summary> /// <see cref="MFilesServerApplication"/>.Connect() extension method that accepts a class type that is decorated with a <see cref="MFVaultConnectionAttribute"/>. /// </summary> /// <param name="sa"><see cref="MFilesServerApplication"/> instance</param> /// <param name="decoratedType"><see cref="Type"/> of the class with the connection info decorations</param> /// <param name="vault">Out <see cref="Vault"/></param> /// <returns><see cref="MFVaultConnectionAttribute"/></returns> public static MFVaultConnectionAttribute Connect(this MFilesServerApplication sa, Type decoratedType, out Vault vault) { // Extract the MFVaultConnectionAttribute info attribute. MFVaultConnectionAttribute vaultConn = (MFVaultConnectionAttribute)Attribute.GetCustomAttribute(decoratedType, typeof(MFVaultConnectionAttribute)); // Connect to the server. sa.Connect(vaultConn); // Login to the vault using the GUID provided. // Set the out vault value. vault = sa.LogInToVault(vaultConn.VaultGuid); // Return the Vault Connection info. return(vaultConn); }
private PropertyDef GetPropertyDefByName(string name, Vault vault) { PropertyDef ret = null; var propertyDefs = vault.PropertyDefOperations.GetPropertyDefs(); foreach (PropertyDef propertyDef in propertyDefs) { if (propertyDef.Name == name) { ret = propertyDef; break; } } return ret; }
private IPromise<WebResponse> DownloadFileFromVault(IReadOnlyItem fileItem, Vault vault, bool async, Command request) { var url = vault.Url; if (string.IsNullOrEmpty(url)) return null; var urlPromise = url.IndexOf("$[") < 0 ? Promises.Resolved(url) : _conn.Process(new Command("<url>@0</url>", url) .WithAction(CommandAction.TransformVaultServerURL), async) .Convert(s => s.AsString()); return urlPromise.Continue<string, WebResponse>(u => { if (u != vault.Url) vault.Url = u; var uri = new Uri(string.Format("{0}?dbName={1}&fileId={2}&fileName={3}&vaultId={4}", u, _conn.Database, fileItem.Id(), HttpUtility.UrlEncode(fileItem.Property("filename").Value), vault.Id)); var req = (HttpWebRequest)System.Net.WebRequest.Create(uri); req.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore); req.Credentials = CredentialCache.DefaultCredentials; req.Method = "GET"; req.Proxy.Credentials = CredentialCache.DefaultCredentials; req.Timeout = -1; _conn.SetDefaultHeaders((k, v) => { req.Headers.Set(k, v); }); req.Headers.Set("VAULTID", vault.Id); var result = new WebRequest(req, _conn.Compression); foreach (var a in _conn.DefaultSettings) { a.Invoke(result); } if (request.Settings != null) request.Settings.Invoke(result); return result.Execute(async); }); }
private Dictionary<string, ObjType> GetObjTypeLookup(Vault vault) { var lookup = new Dictionary<string, ObjType>(); ObjTypes objectTypes = vault.ObjectTypeOperations.GetObjectTypes(); foreach (ObjType objectType in objectTypes) { if (!lookup.ContainsKey(objectType.NameSingular)) lookup.Add(objectType.NameSingular, objectType); } return lookup; }
internal static RoValListLockedResource <TVault, TItem> CreateReadOnlyLockedResource([NotNull] TVault v, [NotNull] Vault <BigValueList <TItem> > .Box b) { Func <ReadWriteListVault <TItem, BigValueList <TItem> >, Vault <BigValueList <TItem> > .Box, AcquisitionMode, Vault <BigValueList <TItem> > .Box> releaseMethod = ReadWriteVault <BigValueList <TItem> > .ReleaseResourceMethod; return(new RoValListLockedResource <TVault, TItem>(v, b, releaseMethod)); }
protected override IEnumerable <ValidationFinding> CustomValidation(Vault vault, MyConfiguration config) { return(this.CustomValidator(config)); }
private object ConvertPropertyValue(PropertyDef propertyDef, string value, Vault vault) { object ret; switch (propertyDef.DataType) { case MFDataType.MFDatatypeText: ret = value; break; case MFDataType.MFDatatypeDate: DateTime dt; if (DateTime.TryParse(value, out dt)) ret = dt; else throw new ArgumentException(string.Format("failed to convert '{0}' to a valid date", value)); break; case MFDataType.MFDatatypeLookup: /* we need to retrieve the id of the lookup */ { LogPropertyDef(propertyDef); //Debug.WriteLine("based on valueList: " + propertyDef.BasedOnValueList + " " + // propertyDef.StaticFilter.); //int valueListItemId = GetValueListItemId(propertyDef.ValueList, value, vault, propertyDef.StaticFilter); int valueListItemId = GetValueListItemId(propertyDef, value, vault); ret = valueListItemId; if (valueListItemId == -1) throw new ArgumentException(string.Format("failed to find valuelist entry '{0}' for property '{1}'", value, propertyDef.Name)); } break; case MFDataType.MFDatatypeMultiSelectLookup: { /* split into multiple values */ string[] values = value.Split(Constants.MultiSelectDelimiter); int[] valueListItemIds = new int[values.Length]; for (int i = 0; i < values.Length; i++) { //valueListItemIds[i] = GetValueListItemId(propertyDef.ValueList, value, vault, propertyDef.StaticFilter); valueListItemIds[i] = GetValueListItemId(propertyDef, value, vault); if (valueListItemIds[i] == -1) throw new ArgumentException(string.Format("failed to find valuelist entry '{0}' for property '{1}'", value, propertyDef.Name)); } ret = valueListItemIds; } break; case MFDataType.MFDatatypeBoolean: if (value.ToLower() == "yes" || value.ToLower() == "ja") ret = true; else ret = false; break; case MFDataType.MFDatatypeInteger: { int i; if (Int32.TryParse(value, out i)) ret = i; else throw new ArgumentException(string.Format("failed to convert value '{0}' to an integer for property '{1}'", value, propertyDef.Name)); } break; default: LogPropertyDef(propertyDef); throw new NotImplementedException(string.Format("converting to '{0}' is not implemented.", propertyDef.DataType)); } return ret; }
public override void Write(Vault vault, BinaryWriter bw) { bw.Write((R << 24) | (G << 16) | (B << 8) | (A & 0xFF)); }
private PropertyValues GetPropertyValues(CsvModel csvModel, Vault vault, int classId, ObjType objType, Dictionary<string, ObjType> objectTypeLookup, Dictionary<string, PropertyDef> propertyDefLookupByName, Dictionary<int, PropertyDef> propertyDefLookupById) { var propertyValues = new MFilesAPI.PropertyValues(); int index = 0; /* add the special class property */ propertyValues.Add(index++, GetPropertyValue((int)MFilesAPI.MFBuiltInPropertyDef.MFBuiltInPropertyDefClass, MFDataType.MFDatatypeLookup, classId)); ObjectClass objectClass = vault.ClassOperations.GetObjectClass(classId); /* if the object type has an owner */ if (objType.HasOwnerType) { /* add a special property for the owner */ var ownerObjType = vault.ObjectTypeOperations.GetObjectType(objType.OwnerType); var propertyDef = propertyDefLookupByName[ownerObjType.NameSingular]; string value; if (csvModel.Values.TryGetValue(propertyDef.Name, out value)) { object objValue = ConvertPropertyValue(propertyDef, value, vault); var propertyValue = GetPropertyValue(propertyDef.ID, propertyDef.DataType, objValue); propertyValues.Add(index++, propertyValue); } } foreach (AssociatedPropertyDef associatedPropertyDef in objectClass.AssociatedPropertyDefs) { /* get the property definition id */ PropertyDef propertyDef = PropertyDefLookupById[associatedPropertyDef.PropertyDef]; string value; if (csvModel.Values.TryGetValue(propertyDef.Name, out value)) { /* try to convert the string to the ObjectData Type */ object objValue = ConvertPropertyValue(propertyDef, value, vault); /* create the property value */ PropertyValue propertyValue = GetPropertyValue(associatedPropertyDef.PropertyDef, propertyDef.DataType, objValue); Debug.WriteLine("property - Id: {0}, Name: {1}, DataType: {2}, Value: {3}", associatedPropertyDef.PropertyDef, propertyDef.Name, propertyDef.DataType, objValue); /* add the property value */ propertyValues.Add(index++, propertyValue); } } return propertyValues; }
private async Task LoadEventsAsync(bool refresh) { MODEL.IsLoading = true; try { IEnumerable <CalendarEvent> events = await CalendarManager.INSTANCE.UpdateAsync(Vault.LoadCredentials(Storage.Classes.Settings.GetSettingString(SettingsConsts.TUM_ID)), refresh).ConfAwaitFalse(); MODEL.EVENTS.Replace(events.Where(e => e.End > DateTime.Now).Take(5)); } catch (Exception e) { Logger.Error("Failed to load calendar events!", e); } MODEL.HasUpcomingEvents = MODEL.EVENTS.Count > 0; MODEL.IsLoading = false; }
private Dictionary<string, ObjectClass> GetObjectClassLookup(Vault vault) { var lookup = new Dictionary<string, ObjectClass>(); var allObjectClasses = vault.ClassOperations.GetAllObjectClasses(); foreach (ObjectClass objectClass in allObjectClasses) { if (!lookup.ContainsKey(objectClass.Name)) lookup.Add(objectClass.Name, objectClass); } return lookup; }
public override void Read(Vault vault, BinaryReader br) { X = br.ReadSingle(); Y = br.ReadSingle(); }
//private int GetObjectTypeId(CsvModel csvModel, Vault vault) //{ // ObjTypes objectTypes = vault.ObjectTypeOperations.GetObjectTypes(); // int objectTypeId = -1; // foreach (ObjType objectType in objectTypes) // { // if (objectType.NameSingular == csvModel.ObjectType) // { // objectTypeId = objectType.ID; // break; // } // Debug.WriteLine(objectType.NameSingular); // } // return objectTypeId; //} //private int GetClassId(CsvModel csvModel, Vault vault) //{ // var allObjectClasses = vault.ClassOperations.GetAllObjectClasses(); // int classId = -1; // foreach (ObjectClass objectClass in allObjectClasses) // { // if (csvModel.Class == objectClass.Name) // { // classId = objectClass.ID; // break; // } // //Debug.WriteLine(string.Format("Id={0}, Name={1}", objectClass.ID, objectClass.Name)); // } // return classId; //} //private ObjectVersionAndProperties GetObjectVersionAndPropertiesAndCheckin(CsvModel csvModel, Vault vault, PropertyValues propertyValues, SourceObjectFiles sourceObjectFiles, int objectTypeId) //{ // if (objectTypeId == -1) // throw new ArgumentException(string.Format("could not find objectType with name '{0}'", csvModel.ObjectType)); // Debug.WriteLine("objectTypeId: " + objectTypeId); // return vault.ObjectOperations.CreateNewObjectEx(objectTypeId, propertyValues, SourceFiles, false, false) // return vault.ObjectOperations.CreateNewObject(objectTypeId, propertyValues, sourceObjectFiles); //} private ObjectVersionAndProperties GetObjectVersionAndProperties(CsvModel csvModel, Vault vault, PropertyValues propertyValues, SourceObjectFiles sourceObjectFiles, int objectTypeId) { if (objectTypeId == -1) throw new ArgumentException(string.Format("could not find objectType with name '{0}'", csvModel.ObjectType)); Debug.WriteLine("objectTypeId: " + objectTypeId); //return vault.ObjectOperations.CreateNewObjectEx(objectTypeId, propertyValues, sourceObjectFiles, false, false); return vault.ObjectOperations.CreateNewObject(objectTypeId, propertyValues, sourceObjectFiles); }
public override void Write(Vault vault, BinaryWriter bw) { bw.Write(X); bw.Write(Y); }
/// <summary> /// Method to create Azure Recovery Services Vault /// </summary> /// <param name="resouceGroupName">Name of the resouce group</param> /// <param name="vaultName">Name of the vault</param> /// <param name="vault">Vault creation input object</param> /// <returns>Create response object.</returns> public Vault CreateVault(string resouceGroupName, string vaultName, Vault vault) { return(GetRecoveryServicesClient.Vaults.CreateOrUpdateWithHttpMessagesAsync( resouceGroupName, vaultName, vault, GetRequestHeaders()).Result.Body); }
public void WritePointerData(Vault vault, BinaryWriter bw) { _text.WritePointerData(vault, bw); }