private void TryLoadFile() { try { BusyDialogManager.Show("Loading " + BusyDialog.CleanPath(_loadedFile)); Persistance.LoadFromFile(_loadedFile); LoadFile(); ConfigureMenu(true); HideGettingStarted(); } catch (Exception ex) { #if NOLICENSE throw; #else ConfigureMenu(false); _loadedFile = string.Empty; MessageBox.Show("A problem occured loading the file." + Environment.NewLine + ex.Message); ShowGettingStarted(); #endif } finally { BusyDialogManager.Hide(); } }
public InverseKinematicsPerformanceDemo() { var figureDir = UnpackedArchiveDirectory.Make(new System.IO.DirectoryInfo("work/figures/genesis-3-female")); var channelSystemRecipe = Persistance.Load <ChannelSystemRecipe>(figureDir.File("channel-system-recipe.dat")); channelSystem = channelSystemRecipe.Bake(null); var boneSystemRecipe = Persistance.Load <BoneSystemRecipe>(figureDir.File("bone-system-recipe.dat")); boneSystem = boneSystemRecipe.Bake(channelSystem.ChannelsByName); var inverterParameters = Persistance.Load <InverterParameters>(figureDir.File("inverter-parameters.dat")); rigidBoneSystem = new RigidBoneSystem(boneSystem); goalProvider = new DemoInverseKinematicsGoalProvider(rigidBoneSystem); solver = new HarmonicInverseKinematicsSolver(rigidBoneSystem, inverterParameters.BoneAttributes); var pose = Persistance.Load <List <Pose> >(figureDir.File("animations/idle.dat"))[0]; var channelInputs = channelSystem.MakeDefaultChannelInputs(); new Poser(channelSystem, boneSystem).Apply(channelInputs, pose, DualQuaternion.Identity); var channelOutputs = channelSystem.Evaluate(null, channelInputs); rigidBoneSystem.Synchronize(channelOutputs); initialInputs = rigidBoneSystem.ReadInputs(channelOutputs); }
private static void InitalizeDatabase(Persistance.LogPersistContext LogDatabase) { // Add Modules var existingModules = LogDatabase.Modules.Include("EventTypes").ToDictionary(m => m.Id); foreach (var module in LogModules) { // Update/Insert Module Models.LogModule dbModule; if (existingModules.TryGetValue(module.Key, out dbModule)) { // Update if (dbModule.Name != module.Value.ModuleName) dbModule.Name = module.Value.ModuleName; if (dbModule.Description != module.Value.ModuleDescription) dbModule.Description = module.Value.ModuleDescription; } else { // Insert dbModule = new Models.LogModule() { Id = module.Key, Name = module.Value.ModuleName, Description = module.Value.ModuleDescription }; LogDatabase.Modules.Add(dbModule); } // Update/Insert Event Types Dictionary<int, Models.LogEventType> existingEventTypes = (dbModule.EventTypes == null) ? new Dictionary<int, Models.LogEventType>() : dbModule.EventTypes.ToDictionary(et => et.Id); foreach (var eventType in module.Value.EventTypes) { Models.LogEventType dbEventType; if (existingEventTypes.TryGetValue(eventType.Key, out dbEventType)) { // Update if (dbEventType.Name != eventType.Value.Name) dbEventType.Name = eventType.Value.Name; if (dbEventType.Severity != eventType.Value.Severity) dbEventType.Severity = eventType.Value.Severity; if (dbEventType.Format != eventType.Value.Format) dbEventType.Format = eventType.Value.Format; } else { // Insert dbEventType = new Models.LogEventType() { Id = eventType.Key, ModuleId = module.Key, Name = eventType.Value.Name, Severity = eventType.Value.Severity, Format = eventType.Value.Format }; LogDatabase.EventTypes.Add(dbEventType); } } } LogDatabase.SaveChanges(); }
public static FigureDefinition Load(IArchiveDirectory dataDir, string name, FigureDefinition parent) { IArchiveDirectory figureDir = dataDir.Subdirectory("figures").Subdirectory(name); var channelSystemRecipe = Persistance.Load <ChannelSystemRecipe>(figureDir.File("channel-system-recipe.dat")); var channelSystem = channelSystemRecipe.Bake(parent?.ChannelSystem); BoneSystem boneSystem; RigidTransform[] childToParentBindPoseTransforms; if (parent != null) { boneSystem = parent.BoneSystem; childToParentBindPoseTransforms = Persistance.Load <RigidTransform[]>(figureDir.File("child-to-parent-bind-pose-transforms.dat")); } else { var boneSystemRecipe = Persistance.Load <BoneSystemRecipe>(figureDir.File("bone-system-recipe.dat")); boneSystem = boneSystemRecipe.Bake(channelSystem.ChannelsByName); childToParentBindPoseTransforms = null; } var shapeOptions = Shape.LoadAllForFigure(figureDir, channelSystem); var materialSetOptions = MaterialSetOption.LoadAllForFigure(figureDir); return(new FigureDefinition(name, figureDir, channelSystem, boneSystem, childToParentBindPoseTransforms, shapeOptions, materialSetOptions)); }
public void Pack(FileInfo archiveFile, DirectoryInfo rootDir) { var rootRecord = ScanDirectory(rootDir); var memoryStream = new MemoryStream(); Persistance.Write(memoryStream, rootRecord); var listingBytes = memoryStream.ToArray(); long listingSize = listingBytes.LongLength; long payloadSize = currentOffset; long payloadOffset = IntegerUtils.NextLargerMultiple(HeaderSize + listingSize, OffsetGranularity); long totalSize = payloadOffset + payloadSize; using (var archiveMap = MemoryMappedFile.CreateFromFile(archiveFile.FullName, FileMode.Create, archiveFile.Name, totalSize)) { //write header using (var headerAccessor = archiveMap.CreateViewAccessor(0, HeaderSize)) { headerAccessor.Write(0, listingSize); headerAccessor.Write(sizeof(long), payloadOffset); } //write listing using (var listingAccessor = archiveMap.CreateViewAccessor(HeaderSize, listingSize)) { listingAccessor.WriteArray(0, listingBytes, 0, listingBytes.Length); } WriteDirectory(archiveMap, payloadOffset, rootRecord, rootDir); } }
public static void StoreInDB( string Scenario, string PageName, string ElementName, string TestDescription, TestResult TestStatus) { SeleniumStatus seleniumStatus = new SeleniumStatus(); seleniumStatus.Scenario = Scenario + " - Dataset " + (object)Common.RowNumber; seleniumStatus.PageName = PageName; seleniumStatus.ElementName = ElementName; seleniumStatus.TestDescription = TestDescription; seleniumStatus.TestStatus = TestStatus.ToString(); seleniumStatus.UserName = WindowsIdentity.GetCurrent().Name; seleniumStatus.TestID = ExecuteTest.TestID; seleniumStatus.ParentID = ""; if (Common.Screenshot == null || TestStatus.ToString() == "Success") { seleniumStatus.Screenshot = " "; seleniumStatus.FailureURL = " "; } else { seleniumStatus.Screenshot = Common.Screenshot; seleniumStatus.FailureURL = Common.FailureURL; } Guid guid = TestRun.GetAll().Where <TestRun>((Func <TestRun, bool>)(run => run.ExecutedTime.ToString() == ExecuteTest.scenarioTime.ToString())).Select <TestRun, Guid>((Func <TestRun, Guid>)(run => run.TestRunID)).FirstOrDefault <Guid>(); seleniumStatus.TestRunID = guid; Persistance.Create((object)seleniumStatus); }
// Use this for initialization protected override void Start() { base.Start(); Input.gyro.enabled = true; persistance = Persistance.instance; transformMatrix = persistance.ReadData("GravityControl.transformMatrix", ZeroRotation(Vector3.back)); }
public IOccluder Load(IArchiveDirectory occlusionDirectory) { bool isMainFigure = channelSystem.Parent == null; if (isMainFigure) { IArchiveFile occluderParametersFile = occlusionDirectory.File("occluder-parameters.dat"); if (occluderParametersFile == null) { throw new InvalidOperationException("expected main figure to have occlusion system"); } var occluderParameters = Persistance.Load <OccluderParameters>(occluderParametersFile); OcclusionInfo[] unmorphedOcclusionInfos = OcclusionInfo.UnpackArray(unmorphedOcclusionDirectory.File("occlusion-infos.array").ReadArray <uint>()); var occluder = new DeformableOccluder(device, shaderCache, channelSystem, unmorphedOcclusionInfos, occluderParameters); return(occluder); } else { OcclusionInfo[] figureOcclusionInfos = OcclusionInfo.UnpackArray(occlusionDirectory.File("occlusion-infos.array").ReadArray <uint>()); OcclusionInfo[] parentOcclusionInfos = OcclusionInfo.UnpackArray(occlusionDirectory.File("parent-occlusion-infos.array").ReadArray <uint>()); var occluder = new StaticOccluder(device, figureOcclusionInfos, parentOcclusionInfos); return(occluder); } }
private void Login() { Login login = Persistance.GetLoginData(EnteredName).Result; if (login == null) { MessageDialog msg = new MessageDialog("This name doesn't exist!"); msg.ShowAsync(); //NavigationService ns = new NavigationService(); //ns.Navigate(typeof(LoginPage)); } else { if (login.Password == EnteredPassword) { LoggedInSingleton singletonlog = LoggedInSingleton.Instance; singletonlog.LoggedStudentID = login.StudentID; NavigateToMenu(); } else { MessageDialog msg = new MessageDialog("Entered password is incorrect!"); msg.ShowAsync(); //NavigationService ns = new NavigationService(); //ns.Navigate(typeof(LoginPage)); } } }
public void Load() { SettingsIndex = (int)Persistance.LoadObject("SettingsIndex", 0); ListNullCheck(); LoadAllSettings(); }
/// <summary> /// Obtiene los datos necesarios para llenar el modelo de <see cref="Asistentes"/> /// </summary> /// <param name="episodio">Episodio/Evento/Identificador</param> /// <returns>Colección de datos de asistentes</returns> public List <Asistentes> GetAttendees(int episodio) { List <Asistentes> Asistentes = new List <Asistentes>(); Persistance persistance = new Persistance(); using (var dataContext = persistance.GetObjectContext()) { try { Asistentes = (from Q in dataContext.ppObtenerAsistentesAgenda(episodio) select new Asistentes { Nombre = Q.vchNombre, Correo = EmailUtil.StringToEmailUri(Q.vchCorreo), EstadoParticipacion = (EstadoParticipacion)Q.iEstadoParticipación, Rsvp = Q.iRsvp == 1 ? true : false }).ToList(); } catch (Exception) { throw new Exception(); } } return(Asistentes); }
private void GetAttendees() { AttendeesCancelSingleton singleton = AttendeesCancelSingleton.Instance; int bookingID = singleton.SelectedBooking.BookingID; AttendeeList = Persistance.GetAttendees(bookingID); }
public void GetBookings() // Get the list of bookings from persistance { LoggedInSingleton loggedinsingleton = LoggedInSingleton.Instance; int studentID = loggedinsingleton.LoggedStudentID; Bookings = Persistance.GetBookings(studentID); }
private void DumpParentOverrides(DirectoryInfo shapeDirectory, ShapeImportConfiguration configuration) { if (configuration.parentOverrides.Count == 0) { return; } FileInfo parentOverridesFile = shapeDirectory.File("parent-overrides.dat"); if (parentOverridesFile.Exists) { return; } //persist var parentChannelSystem = figure.Parent.ChannelSystem; var parentOverridesByName = configuration.parentOverrides .ToDictionary(entry => { //look up the channel to confirm it exists var channel = parentChannelSystem.ChannelsByName[entry.Key]; return(channel.Name); }, entry => entry.Value); shapeDirectory.CreateWithParents(); Persistance.Save(parentOverridesFile, parentOverridesByName); }
private void CancelRoom() { AttendeesCancelSingleton singleton = AttendeesCancelSingleton.Instance; Persistance.CancelBooking(singleton.SelectedBooking); NavigateBack(); }
public SkipperForm() { try { //throw new Exception("Don't load from the file during debugging"); Persistance.LoadFromFile(); } catch { Persistance.CreateNew(); } SelectRace sr = new SelectRace(); sr.ShowDialog(); Race r = sr.SelectedRace; EditRace er = new EditRace(r); er.ShowDialog(); //Persistance.SaveToFile(); InitializeComponent(); viewPanel.Initialize(r, new Notify(this.RequestStatisticsUpdate)); foreach (AmphibianSoftware.Skipper.Data.Boat b in r.Boats) { boatsLB.Items.Add(b); } boatsLB.SelectedIndex = 0; this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); _drawThread = new Thread(new ThreadStart(drawLoop)); _drawThread.Start(); }
private void DumpInputs(DirectoryInfo shapeDirectory, ChannelInputs shapeInputs) { FileInfo shapeFile = shapeDirectory.File("channel-inputs.dat"); if (shapeFile.Exists) { return; } //persist Dictionary <string, double> shapeInputsByName = new Dictionary <string, double>(); foreach (var channel in figure.Channels) { double defaultValue = channel.InitialValue; double value = channel.GetInputValue(shapeInputs); if (value != defaultValue) { shapeInputsByName.Add(channel.Name, value); } } shapeDirectory.CreateWithParents(); Persistance.Save(shapeFile, shapeInputsByName); }
public static Animation Load(IArchiveFile animationFile) { string label = Path.GetFileNameWithoutExtension(animationFile.Name); List <Pose> posesByFrame = Persistance.Load <List <Pose> >(animationFile); return(new Animation(label, posesByFrame)); }
void Start() { agent = GetComponent <NavMeshAgent>(); Debug.Log(FindObjectsOfType <Persistance>().Length); levelInfo = FindObjectOfType <Persistance>(); StartCoroutine(Wait()); }
public ShapeNormals Load(IArchiveDirectory figureDir, Shape shape) { var file = shape.Directory?.File("shape-normals.dat"); if (file == null) { return(null); } var recipe = Persistance.Load <ShapeNormalsRecipe>(file); var uvSetName = recipe.UvSetName; IArchiveDirectory uvSetsDirectory = figureDir.Subdirectory("uv-sets"); IArchiveDirectory uvSetDirectory = uvSetsDirectory.Subdirectory(uvSetName); var texturedVertexInfos = uvSetDirectory.File("textured-vertex-infos.array").ReadArray <TexturedVertexInfo>(); var texturesDirectory = dataDir.Subdirectory("textures"); var textureLoader = new TextureLoader(device, textureCache, texturesDirectory); var normalMapsBySurface = recipe.TextureNamesBySurface .Select(name => name != ShapeNormalsRecipe.DefaultTextureName ? name : null) .Select(name => textureLoader.Load(name, TextureLoader.DefaultMode.Bump)) .ToArray(); return(new ShapeNormals(textureLoader, texturedVertexInfos, normalMapsBySurface)); }
public FigureRecipe LoadFigureRecipe(string figureName, FigureRecipe parentRecipe) { var importProperties = ImportProperties.Load(pathManager, figureName); var figureRecipesDirectory = CommonPaths.WorkDir.Subdirectory("recipes/figures"); figureRecipesDirectory.Create(); var figureRecipeFile = figureRecipesDirectory.File($"{figureName}.dat"); if (!figureRecipeFile.Exists) { Console.WriteLine($"Reimporting {figureName}..."); FigureRecipe recipeToPersist = FigureImporter.ImportFor( figureName, fileLocator, objectLocator, importProperties.Uris, parentRecipe, importProperties.HdCorrectionInitialValue, importProperties.VisibleProducts); Persistance.Save(figureRecipeFile, recipeToPersist); } Console.WriteLine($"Loading {figureName}..."); FigureRecipe recipe = Persistance.Load <FigureRecipe>(figureRecipeFile); return(recipe); }
public void Init() { persistance_ = new Persistance(); bibliotheque_ = new Bibliotheque(persistance_); persistance_.Adhérents.Add(new DonnéesAdhérent { Numéro = 23, Nom = "Dupont", Ville = "Toulouse" }); persistance_.Adhérents.Add(new DonnéesAdhérent { Numéro = 48, Nom = "Martin", Ville = "Marseille" }); persistance_.Emprunts.Add(new DonnéesEmprunt { Identifiant = 1111, NuméroAdhérent = 48, Description = "Les 3 mousquetaires", Actif = true }); persistance_.Emprunts.Add(new DonnéesEmprunt { Identifiant = 2222, NuméroAdhérent = 48, Description = "Les misérables", Actif = false }); persistance_.Emprunts.Add(new DonnéesEmprunt { Identifiant = 3333, NuméroAdhérent = 23, Description = "Le Retour de Martin Guerre", Actif = true }); }
public FigureRenderer Load(IArchiveDirectory figureDir, MaterialSetAndVariantOption materialSetOption) { SurfaceProperties surfaceProperties = Persistance.Load <SurfaceProperties>(figureDir.File("surface-properties.dat")); var refinementDirectory = figureDir.Subdirectory("refinement"); var controlMeshDirectory = refinementDirectory.Subdirectory("control"); int[] surfaceMap = controlMeshDirectory.File("surface-map.array").ReadArray <int>(); var refinedMeshDirectory = refinementDirectory.Subdirectory("level-" + surfaceProperties.SubdivisionLevel); SubdivisionMesh mesh = SubdivisionMeshPersistance.Load(refinedMeshDirectory); int[] controlFaceMap = refinedMeshDirectory.File("control-face-map.array").ReadArray <int>(); var materialSet = MaterialSet.LoadActive(device, shaderCache, textureCache, dataDir, figureDir, materialSetOption, surfaceProperties); var materials = materialSet.Materials; Scatterer scatterer = surfaceProperties.PrecomputeScattering ? Scatterer.Load(device, shaderCache, figureDir, materialSetOption.MaterialSet.Label) : null; var uvSetName = materials[0].UvSet; IArchiveDirectory uvSetDirectory = figureDir.Subdirectory("uv-sets").Subdirectory(uvSetName); var texturedVertexInfos = uvSetDirectory.File("textured-vertex-infos.array").ReadArray <TexturedVertexInfo>(); Quad[] texturedFaces = uvSetDirectory.File("textured-faces.array").ReadArray <Quad>(); var vertexRefiner = new VertexRefiner(device, shaderCache, mesh, texturedVertexInfos); FigureSurface[] surfaces = FigureSurface.MakeSurfaces(device, materials.Length, texturedFaces, controlFaceMap, surfaceMap, materialSet.FaceTransparencies); HashSet <int> visitedSurfaceIndices = new HashSet <int>(); List <int> surfaceOrder = new List <int>(surfaces.Length); bool[] areUnorderedTransparent = new bool[surfaces.Length]; //first add surfaces with an explicity-set render order foreach (int surfaceIdx in surfaceProperties.RenderOrder) { visitedSurfaceIndices.Add(surfaceIdx); surfaceOrder.Add(surfaceIdx); areUnorderedTransparent[surfaceIdx] = false; } //then add any remaining surfaces for (int surfaceIdx = 0; surfaceIdx < surfaces.Length; ++surfaceIdx) { if (visitedSurfaceIndices.Contains(surfaceIdx)) { continue; } surfaceOrder.Add(surfaceIdx); areUnorderedTransparent[surfaceIdx] = true; } var isOneSided = figureDir.Name == "genesis-3-female"; //hack return(new FigureRenderer(device, shaderCache, scatterer, vertexRefiner, materialSet, surfaces, isOneSided, surfaceOrder.ToArray(), areUnorderedTransparent)); }
public void NewFromGpsFiles(List <string> files) { HideGettingStarted(); _gpsDataFileParameters = files; Persistance.CreateNew(); ConfigureMenu(true); LoadFile(); }
public void InvitePeople() { MakeAttendees(); Persistance.AddAttendees(ListOfAttendees); NavigationService ns = new NavigationService(); ns.Navigate(typeof(CurrentBookingsPage)); }
public static List <Character> LoadList(IArchiveDirectory dataDir) { var dir = dataDir.Subdirectory("characters"); var characters = dir.GetFiles() .Select(file => Persistance.Load <Character>(file)) .ToList(); return(characters); }
public void Load(int i, GameSettings defaultSettings) { PlayerSpeed = (int)Persistance.LoadObject("PlayerSpeed" + i, defaultSettings.PlayerSpeed); FinalScore = (int)Persistance.LoadObject("FinalScore" + i, defaultSettings.FinalScore); ObstacleSpeed = (float)Persistance.LoadObject("ObstacleSpeed" + i, defaultSettings.ObstacleSpeed); StartCount = (int)Persistance.LoadObject("StartCount" + i, defaultSettings.StartCount); AddAmount = (int)Persistance.LoadObject("AddAmount" + i, defaultSettings.AddAmount); TakeAmount = (int)Persistance.LoadObject("TakeAmount" + i, defaultSettings.TakeAmount); }
public void Save(int i) { Persistance.SaveObject("PlayerSpeed" + i, PlayerSpeed); Persistance.SaveObject("FinalScore" + i, FinalScore); Persistance.SaveObject("ObstacleSpeed" + i, ObstacleSpeed); Persistance.SaveObject("StartCount" + i, StartCount); Persistance.SaveObject("AddAmount" + i, AddAmount); Persistance.SaveObject("TakeAmount" + i, TakeAmount); }
// ReSharper disable once UnusedMember.Local void Start() { PlayerAudioSource.volume = 0.3f; Persistance = FindObjectOfType <Persistance>(); if (!Persistance.AlreadyDiedScene02) { PlayDialogue(); } }
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFD.ShowDialog() == DialogResult.OK) { BusyDialogManager.Show("Saving"); _loadedFile = saveFD.FileName; Persistance.SaveToFile(_loadedFile); BusyDialogManager.Hide(); } }
public DelayedStatusEffect(Status owner, DeliveryPack deliveryPack, Persistance persistance, int duration) : base(owner, persistance, duration) { foreach (EffectPack ep in deliveryPack.EffectPack) { if (ep.StatusEffect is DelayedStatusEffect) { throw new System.Exception("Cannot create a DelayedStatusEffect with a DelayedStatusEffect"); } } DeliveryPack = deliveryPack; }