public Book ParseBook(string line) { // title, author, uid, isbn, ean, reader name, reader surname, ruid, from, to, archived, library var b = line.Split(','); string title = b[0].Trim(); string author = b[1].Trim(); int uid = Convert.ToInt32(b[2].Trim()); string isbn = b[3].Trim(); string ean = b[4].Trim(); string name = b[5].Trim(); string surname = b[5].Trim(); string rid = b[6].Trim(); string from = b[7].Trim(); string to = b[8].Trim(); bool archived = b[9].Trim().Equals("true") ? true : false; string library = b[12].Trim(); var lib = Libraries.SearchNode(new Library(library), Libraries.Root); if (lib != null) { Book book = new Book(author, title, isbn, ean, "Poetry", lib.Data, uid); return(book); } return(null); }
private void Libraries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (SteamLibrary addition in e.NewItems) { var newLib = (addition is SteamArchive) ? new SteamArchiveViewModel(addition as SteamArchive) : new SteamLibraryViewModel(addition); newLib.UpdateFilter(LocalListFilter); Libraries.Add(newLib); } } if (e.Action == NotifyCollectionChangedAction.Remove) { foreach (SteamLibrary removal in e.OldItems) { SteamLibraryViewModel itemToRemove = null; foreach (var lib in Libraries) { if (lib.Model == removal) { itemToRemove = lib; break; } } if (itemToRemove != null) { Libraries.Remove(itemToRemove); } } } }
public async Task SaveLibraryUpdateSuccess_Test() { Libraries library1 = new Libraries() { Id = 1, Name = "abc", Address = "123", Phone = "123456789", Email = "*****@*****.**" }; _dbContext.Set <Libraries>().Add(library1); LibraryViewModel model = new LibraryViewModel() { Id = 1, Name = "abc123", Address = "123", Phone = "123456789", Email = "*****@*****.**" }; await _dbContext.SaveChangesAsync(); var efRepository = new EfRepository <Libraries>(_dbContext); var saveLibraryCommand = new SaveLibraryCommand(efRepository); var result = await saveLibraryCommand.ExecuteAsync(model); var getListLibrary = new GetListLibraryQuery(efRepository); var library = (await getListLibrary.ExecuteAsync()).FirstOrDefault(); Assert.Equal(result.Data, model.Id); Assert.Equal(model.Name, library.Name); }
public async Task <ActionResult> Update([FromBody] LibraryFormModel model, int libraryId) { if (!Roles.IsLibrarian(User.Identity.Name) && !Roles.IsAdmin(User.Identity.Name)) { return(Forbid()); } var entity = Libraries.GetLibrary(libraryId); var location = Locations.GetLocation(model.LocationId); entity.Location = location; if (location == null) { return(NotFound()); } if (entity == null) { return(NotFound()); } Libraries.Update(entity, model); return(Accepted()); }
public string GetMissingDependenciesWarning(FrameworkName targetFramework) { var sb = new StringBuilder(); // TODO: Localize messages sb.AppendFormat("Failed to resolve the following dependencies for target framework '{0}':", targetFramework.ToString()); sb.AppendLine(); foreach (var d in Libraries.Where(d => !d.Resolved).OrderBy(d => d.Identity.Name)) { sb.AppendLine(" " + d.Identity.ToString()); } sb.AppendLine(); sb.AppendLine("Searched Locations:"); foreach (var path in GetAttemptedPaths(targetFramework)) { sb.AppendLine(" " + path); } sb.AppendLine(); sb.AppendLine("Try running 'kpm restore'."); return(sb.ToString()); }
public static async Task<Response> PostChatRoom(int Bobs_ID) { try { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(URL.BASE); var definition = new { Bobs_ID = Bobs_ID }; var newObject = JsonConvert.SerializeObject(definition); HttpResponseMessage result = await client.PostAsync(URL.CHATROOMS, new StringContent(newObject, Encoding.UTF8, "application/json")); string json = await result.Content.ReadAsStringAsync(); Response data = JsonConvert.DeserializeObject<Response>(json); return data; } } catch (JsonException jex) { return new Response() { Error = "Parse Error: " + jex.ToString(), Success = false }; } catch (Exception ex) { return new Response() { Error = ex.Message.ToString(), Success = false }; } }
public BookEditViewModel(ApplicationDbContext context) { Libraries = context.Library.Select(library => new SelectListItem { Text = library.Name, Value = library.LibraryId.ToString() }).ToList(); Libraries.Insert(0, new SelectListItem { Text = "No Library Selected", Value = "0" }); Patrons = context.Patron.Select(p => new SelectListItem { Text = p.FirstName + " " + p.LastName, Value = p.PatronId.ToString() }).ToList(); Patrons.Insert(0, new SelectListItem { Text = "No Patron Selected", Value = "0" }); }
public List <string> MediaCenterLibraryFolders(Libraries library) { List <string> output = new List <string>(); RegistryKey rkRoot = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\MediaFolders\\" + library.ToString() + "\\", false); if (rkRoot == null) { return(output); // NO folders } object oFolderCount = rkRoot.GetValue("FolderCount"); if (oFolderCount == null) { return(output); // No folders } int folderCount = (int)oFolderCount; if (folderCount > 0) { for (int i = 0; i < folderCount; i++) { object oFolderName = rkRoot.GetValue("Folder" + i.ToString()); if (oFolderName != null) { string sFolderName = (string)oFolderName; output.Add(sFolderName); } } } return(output); }
public void SetupConditionalSourcesAndLibrariesForConfig(DotsRuntimeCSharpProgramConfiguration config, DotNetAssembly setupGame) { NPath[] il2cppGeneratedFiles = SetupInvocation(setupGame); //todo: stop comparing identifier. Sources.Add(npc => ((DotsRuntimeNativeProgramConfiguration)npc).CSharpConfig == config, il2cppGeneratedFiles); Libraries.Add(npc => ((DotsRuntimeNativeProgramConfiguration)npc).CSharpConfig == config, setupGame.RecursiveRuntimeDependenciesIncludingSelf.SelectMany(r => r.Deployables.OfType <StaticLibrary>())); }
public static async Task<string> GetTotalPoints() { try { using (HttpClient client = new HttpClient()) { var definition = new { Points = "" }; var result = client.GetAsync(URL.USER_POINTSAMOUNT); string json = await result.Result.Content.ReadAsStringAsync(); var data = JsonConvert.DeserializeAnonymousType(json, definition); return data.Points; } } catch (JsonException jex) { Response res = new Response() { Error = "Parse Error: " + jex.ToString(), Success = false }; Debug.WriteLine(res); return null; } catch (Exception ex) { Response res = new Response() { Error = ex.Message.ToString(), Success = false }; Debug.WriteLine(res); return null; } }
/// <summary>Loads the libraries.</summary> /// <remarks>Attempts first to load from Database. If that fails, it loads from disk </remarks> internal async void LoadLibraries() { // Call to check if internet is present var libraries = new Libraries(); try { try { var libs = await libraries.GetLibrariesAsync(UserSettings.ReadUserId()) .ConfigureAwait(true); if (libs != null) { InsertLibrariesToCollection(libs); } else { await loadFromDisk(libraries).ConfigureAwait(true); } } catch (HttpRequestException) { // If the loading fails, try to load the library from disk await loadFromDisk(libraries); } } catch (System.Exception e) { ApplicationHasDataOutOfSync(); Console.WriteLine(e); // Shutdown } }
private void ReadDatabase() { string databaseXml = Path.Combine(App.IconLibPath, "database.xml"); if (!File.Exists(databaseXml)) { DoDatabaseUpdate(); return; } Libraries.Clear(); ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute( Owner, "Reading Database", () => { ProgressDialog.ProgressDialog.Current.Report("Reading ..."); XDocument database = XDocument.Load(databaseXml); if (!(database.Root is XElement eltLibraries) || eltLibraries.Name != NSIconMaker + "Libraries") { return; } int n = database .Descendants() .Count(d => d.Name.LocalName == "Overlay" || d.Name.LocalName == "Icon"); ProgressDialog.ProgressDialog.Current.Report(min: 0, max: n, value: 0); List <IconLibrary> libraries = new List <IconLibrary>(); libraries.AddRange(eltLibraries.Elements(NSIconMaker + "Library").Select(eltLibrary => new IconLibrary(eltLibrary))); ProgressDialog.ProgressDialog.Current.Arguments.Result = libraries; App.WaitForIdle(); });
private void generateNextLibrary(InputFile input) { var daysSpent = LibrariesStep.Sum(x => x.SignupProcess); var daysLast = input.DaysForScanning - daysSpent; foreach (var library in input.Libraries) { library.UpdateStepId(daysLast); } if (input.Libraries.Count == 0) { return; } var currentLibrary = input.Libraries.FirstOrDefault(x => input.Libraries.Max(z => z.StepID) == x.StepID); currentLibrary.ProcessType = ProcessType.SIGNUP; LibrariesStep.Add(currentLibrary); Libraries.Add(new Library() { ID = Libraries.Max(x => x.ID) + 1 }); input.Libraries.Remove(currentLibrary); }
public Il2CppOutputProgram(string name) : base(name) { AddLibIl2CppAsLibraryFor(this); Libraries.Add(BoehmGCProgram); Sources.Add(Distribution.Path.Combine("external").Combine("xxHash/xxhash.c")); this.DynamicLinkerSettingsForMsvc() .Add(l => l.WithSubSystemType(SubSystemType.Console).WithEntryPoint("wWinMainCRTStartup")); Libraries.Add(c => c.ToolChain.Platform is WindowsPlatform, new SystemLibrary("kernel32.lib")); Defines.Add(c => c.Platform is WebGLPlatform, "IL2CPP_DISABLE_GC=1"); this.DynamicLinkerSettingsForMsvc().Add(l => l .WithSubSystemType(SubSystemType.Console) .WithEntryPoint("wWinMainCRTStartup") ); Defines.Add(c => c.ToolChain.DynamicLibraryFormat == null, "FORCE_PINVOKE_INTERNAL=1"); this.DynamicLinkerSettingsForEmscripten().Add(c => c.WithShellFile(BuildProgram.BeeRoot.Combine("shell.html"))); Libraries.Add(c => c.Platform is WebGLPlatform, new PreJsLibrary(BuildProgram.BeeRoot.Combine("tiny_runtime.js"))); Defines.Add(ManagedDebuggingIsEnabled, "IL2CPP_MONO_DEBUGGER=1"); Defines.Add(ManagedDebuggingIsEnabled, "IL2CPP_DEBUGGER_PORT=56000"); CompilerSettings().Add(ManagedDebuggingIsEnabled, c => c.WithExceptions(true)); CompilerSettings().Add(ManagedDebuggingIsEnabled, c => c.WithRTTI(true)); MsvcNativeProgramExtensions.CompilerSettingsForMsvc(this).Add(c => c.WithWarningPolicies(new [] { new WarningAndPolicy("4102", WarningPolicy.Silent) })); CompilerSettings().Add(s => s.WithCppLanguageVersion(CppLanguageVersion.Cpp11)); }
public CALL(int FunctionAddress, Libraries lib, Functions func) : base(5, typeof(ICall)) { FuncAddress = FunctionAddress; this.lib = lib; this.func = func; }
public void Scanning(InputFile input) { var currentLibrary = input.Libraries.FirstOrDefault(x => input.Libraries.Max(x => x.StepID) == x.StepID); currentLibrary.ProcessType = ProcessType.SCANNED; LibrariesStep.Add(currentLibrary); input.Libraries.Remove(currentLibrary); Libraries.Add(new Library() { ID = 0 }); for (int i = currentLibrary.SignupProcess; i < input.DaysForScanning; i++) { generateNextLibrary(input); foreach (var item in LibrariesStep) { if (item.ProcessType == ProcessType.SCANNED) { scannBooks(item); } } UpdateLibrary(i); } }
private static void Register(IEmulatorServiceProvider serviceProvider) { // Register external apis var apis = Assembly .Load("BizHawk.Client.ApiHawk") .GetTypes() .Where(t => typeof(IExternalApi).IsAssignableFrom(t)) .Where(t => t.IsSealed) .Where(t => ServiceInjector.IsAvailable(serviceProvider, t)) .ToList(); apis.AddRange( Assembly .GetAssembly(typeof(ApiContainer)) .GetTypes() .Where(t => typeof(IExternalApi).IsAssignableFrom(t)) .Where(t => t.IsSealed) .Where(t => ServiceInjector.IsAvailable(serviceProvider, t))); foreach (var api in apis) { var instance = (IExternalApi)Activator.CreateInstance(api); ServiceInjector.UpdateServices(serviceProvider, instance); Libraries.Add(api, instance); } container = new ApiContainer(Libraries); GlobalWin.ApiProvider = new BasicApiProvider(container); }
public string reloadData(string newLibraryPath) { "In Reload data".info(); if (newLibraryPath.notNull()) { var tmConfig = TMConfig.Current; tmConfig.XmlLibrariesPath = newLibraryPath; tmConfig.SaveTMConfig(); } GuidanceItems_FileMappings.Clear(); GuidanceExplorers_XmlFormat.Clear(); Libraries.Clear(); Folders.Clear(); Views.Clear(); GuidanceItems.Clear(); if (newLibraryPath.valid()) { setLibraryPath_and_LoadDataIntoMemory(newLibraryPath); } else { TM_Xml_Database.loadDataIntoMemory(); } this.reCreate_GuidanceItemsCache(); this.xmlDB_Load_GuidanceItems(); this.createDefaultAdminUser(); // make sure this user exists return("In the library '{0}' there are {1} library(ies), {2} views and {3} GuidanceItems". format(TM_Xml_Database.Path_XmlLibraries.directoryName(), Libraries.size(), Views.size(), GuidanceItems.size())); }
public async Task GetListLibrary_Test() { var library1 = new Libraries { Id = 1, Name = "library1", Enabled = true }; _dbContext.Set <Libraries>().Add(library1); var library2 = new Libraries { Id = 2, Name = "library1", Enabled = false }; _dbContext.Set <Libraries>().Add(library2); await _dbContext.SaveChangesAsync(); var efRepository = new EfRepository <Libraries>(_dbContext); var getListLibrary = new GetListLibraryQuery(efRepository); var libraries = await getListLibrary.ExecuteAsync(); Assert.NotNull(libraries); Assert.Equal(2, libraries.Count); }
public void GenerateBookData() { StreamReader reader = new StreamReader("poetry.txt"); string line; while ((line = reader.ReadLine()) != null) { try { Book b = ParseLine(line); var rand = _generator.Next(100, 1000); for (int i = 0; i < rand; i++) { Library l = Libraries.SearchNode( new Library(libraryNames[_generator.Next(0, libraryNames.Length)]), Libraries.Root).Data; Book c = new Book(b.Author, b.Title, b.CodeIsbn, b.CodeEan, b.Genre, l, counterOfBooks); BooksByIsbn.Add(c); BooksByUniqueId.Add(c); BooksByName.Add(c); counterOfBooks++; } } catch (Exception e) { Console.WriteLine("While reading data from file, this exception occured: {0}", e.StackTrace); } } }
private void AddLibrary_OnClick(object sender, RoutedEventArgs e) { var button = sender as Button; if (button == null) { return; } var imageLibrary = button.DataContext as Type; if (imageLibrary == null) { return; } var newLibrary = imageLibrary.GetMethod("CreateLibrary").Invoke(null, null) as ImageLibrary; if (newLibrary == null) { return; } Libraries.Add(newLibrary); Browser.SetLibrary(newLibrary); }
public async Task <ActionResult> Update([FromBody] RoleFormModel model, int roleId) { var entity = Roles.GetRole(roleId); var user = Users.GetUser(model.UserId); var library = Libraries.GetLibrary(model.LibraryId); if (entity == null) { return(NotFound()); } if (user == null) { return(NotFound()); } if (library == null) { return(NotFound()); } entity.User = user; entity.Library = library; Roles.Update(entity, model); return(Accepted()); }
public void GivenIAddBelowParametersInURL(Table table) { var dictionary = Libraries.ToDictionary(table); _settings.Request.AddURLParameters(dictionary); _settings.Response = _settings.RestClient.ExecuteRequestWithResponseTime(_settings.Request); }
public void OnLoad() { using (var web = new WebClient()) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; // I want to check libs if (!File.Exists("./lib/YoutubeExplode.dll")) { web.DownloadFile( "https://github.com/weespin/reqdeps/blob/master/YoutubeExplode.dll?raw=true", "./lib/YoutubeExplode.dll"); Libraries.LoadFile("./lib/YoutubeExplode.dll"); } if (!File.Exists("./lib/AngleSharp.dll")) { web.DownloadFile( "https://github.com/weespin/reqdeps/blob/master/AngleSharp.dll?raw=true", "./lib/AngleSharp.dll"); Libraries.LoadFile("./lib/AngleSharp.dll"); } } Events.UndefinedMessage.OnUndefinedMessage += OnUndef; }
private void AiRateChanger_Load(object sender, EventArgs e) { TextBoxAdena.Enabled = false; TextBoxExp.Enabled = false; TextBoxSP.Enabled = false; CheckBoxAdena.Checked = false; CheckBoxExp.Checked = false; CheckBoxSP.Checked = false; string sTemp; var iTemp = default(int); OpenFileDialog.FileName = "questname-e.txt"; if (System.IO.File.Exists("questname-e.txt") == false) { OpenFileDialog.Title = "Select Questname-e.txt file..."; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } } var inFile = new System.IO.StreamReader(OpenFileDialog.FileName, System.Text.Encoding.Default, true, 1); while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); sTemp = Libraries.GetNeedParamFromStr(sTemp, "name").Replace("[", "").Replace("]", ""); if (QuestListBox.Items.IndexOf(sTemp) == -1) { QuestListBox.Items.Add(sTemp); QuestPchName[iTemp] = Libraries.GetNeedParamFromStr(sTemp, "id"); } } inFile.Close(); }
private void LibraryTreeList_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { var value = LibraryTreeList.SelectedItem as ImageLibrary; if (value != null) { Process.Start(value.SourceUrl); } else { var newValue = LibraryTreeList.SelectedItem as ImageData; if (newValue == null) { return; } ImageLibrary subLibrary = Browser.CurrentLibrary.CreateSubLibrary(newValue); if (subLibrary == null) { return; } Libraries.Add(subLibrary); Browser.SetLibrary(subLibrary); } }
public List<string> MediaCenterLibraryFolders(Libraries library) { List<string> output = new List<string>(); RegistryKey rkRoot = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\MediaFolders\\" + library.ToString() + "\\", false); if (rkRoot == null) return output; // NO folders object oFolderCount = rkRoot.GetValue("FolderCount"); if (oFolderCount == null) return output; // No folders int folderCount = (int)oFolderCount; if (folderCount > 0) { for (int i = 0; i < folderCount; i++) { object oFolderName = rkRoot.GetValue("Folder" + i.ToString()); if (oFolderName != null) { string sFolderName = (string)oFolderName; output.Add(sFolderName); } } } return output; }
public override int GetHashCode() { var combiner = new HashCodeCombiner(); combiner.AddObject(Version); HashProjectFileDependencyGroups(combiner, ProjectFileDependencyGroups); foreach (var item in Libraries.OrderBy(library => library.Name, StringComparer.OrdinalIgnoreCase)) { combiner.AddObject(item); } HashLockFileTargets(combiner, Targets); foreach (var item in PackageFolders) { combiner.AddObject(item); } combiner.AddObject(PackageSpec); HashLogMessages(combiner, LogMessages); return(combiner.CombinedHash); }
public static void Initialize(string[] args, Libraries libraryNames) { DllLoadUtils = Platform.IsLinux() ? (IDllLoadUtils) new DllLoadUtilsLinux() : new DllLoadUtilsWindows(); string platformMain; if (Platform.IsLinux()) { platformMain = "unixmain"; LibraryName = IntPtr.Size == 8 ? libraryNames.Linux64bit : libraryNames.Linux32bit; } else if (Platform.IsOSX()) { platformMain = "osxmain"; LibraryName = IntPtr.Size == 8 ? libraryNames.OSX64bit : libraryNames.OSX32bit; } else { platformMain = "winmain"; LibraryName = IntPtr.Size == 8 ? libraryNames.Windows64bit : libraryNames.Windows32bit; } Torque6LibHandle = DllLoadUtils.LoadLibrary(LibraryName); if (Torque6LibHandle == IntPtr.Zero) { throw new Exception("Unable to load " + (IntPtr.Size == 8 ? "64" : "32") + " bit dll: " + LibraryName); } var mainHandle = DllLoadUtils.GetProcAddress(Torque6LibHandle, platformMain); var setCallbacksHandle = DllLoadUtils.GetProcAddress(Torque6LibHandle, "SetCallbacks"); var setCallbacks = (T6SetCallFunction)Marshal.GetDelegateForFunctionPointer( setCallbacksHandle, typeof(T6SetCallFunction)); var main = (T6Main)Marshal.GetDelegateForFunctionPointer( mainHandle, typeof(T6Main)); CallFunction callDelegate = CallFunctionDelegate; CallMethod methodDelegate = CallMethodDelegate; IsMethod isMethodDelegate = IsMethodDelegate; IntPtr mainEntryPointPtr = IntPtr.Zero; if (Initializer.GetScriptEntry() != null) { mainEntryPointPtr = Marshal.GetFunctionPointerForDelegate( (MainEntryPoint)Initializer.GetScriptEntry().CreateDelegate(typeof(MainEntryPoint))); } setCallbacks(Marshal.GetFunctionPointerForDelegate(callDelegate) , Marshal.GetFunctionPointerForDelegate(methodDelegate) , Marshal.GetFunctionPointerForDelegate(isMethodDelegate) , mainEntryPointPtr); main(args.Length, args, IntPtr.Zero); DllLoadUtils.FreeLibrary(Torque6LibHandle); }
public async Task <CommandResult> ExecuteAsync(LibraryViewModel model) { try { if (!ValidationData(model)) { return(CommandResult.Failed(new CommandResultError() { Code = (int)HttpStatusCode.NotAcceptable, Description = "Data not correct" })); } if (model.Id != 0) { var publisher = await _libraryRepository.GetByIdAsync(model.Id); if (publisher == null) { return(CommandResult.Failed(new CommandResultError() { Code = (int)HttpStatusCode.NotFound, Description = "Data not found" })); } publisher.Name = model.Name; publisher.Address = model.Address; publisher.Phone = model.Phone; publisher.Email = model.Email; publisher.Enabled = model.Enabled; await _libraryRepository.UpdateAsync(publisher); } else { Libraries entity = new Libraries(); entity.Name = model.Name; entity.Address = model.Address; entity.Phone = model.Phone; entity.Email = model.Email; entity.Enabled = model.Enabled; await _libraryRepository.InsertAsync(entity); model.Id = entity.Id; } return(CommandResult.SuccessWithData(model.Id)); } catch (Exception ex) { return(CommandResult.Failed(new CommandResultError() { Code = (int)HttpStatusCode.InternalServerError, Description = ex.Message })); } }
public EmuLuaLibrary(IEmulatorServiceProvider serviceProvider) : this() { LuaWait = new AutoResetEvent(false); Docs.Clear(); // Register lua libraries var libs = Assembly .Load("BizHawk.Client.Common") .GetTypes() .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t)) .Where(t => t.IsSealed) .Where(t => ServiceInjector.IsAvailable(serviceProvider, t)) .ToList(); libs.AddRange( Assembly .GetAssembly(typeof(EmuLuaLibrary)) .GetTypes() .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t)) .Where(t => t.IsSealed) .Where(t => ServiceInjector.IsAvailable(serviceProvider, t))); foreach (var lib in libs) { bool addLibrary = true; var attributes = lib.GetCustomAttributes(typeof(LuaLibraryAttributes), false); if (attributes.Any()) { addLibrary = VersionInfo.DeveloperBuild || (attributes.First() as LuaLibraryAttributes).Released; } if (addLibrary) { var instance = (LuaLibraryBase)Activator.CreateInstance(lib, _lua); instance.LuaRegister(lib, Docs); instance.LogOutputCallback = ConsoleLuaLibrary.LogOutput; ServiceInjector.UpdateServices(serviceProvider, instance); Libraries.Add(lib, instance); } } _lua.RegisterFunction("print", this, GetType().GetMethod("Print")); EmulatorLuaLibrary.FrameAdvanceCallback = Frameadvance; EmulatorLuaLibrary.YieldCallback = EmuYield; // Add LuaCanvas to Docs Type luaCanvas = typeof(LuaCanvas); var methods = luaCanvas .GetMethods() .Where(m => m.GetCustomAttributes(typeof(LuaMethodAttributes), false).Any()); foreach (var method in methods) { Docs.Add(new LibraryFunction(nameof(LuaCanvas), luaCanvas.Description(), method)); } }
public LicensingDependencies Clone() { return(new LicensingDependencies { Libraries = LibrariesSpecified ? Libraries.Clone() : null, ThirdParty = ThirdPartySpecified ? ThirdParty.Clone() : null, }); } // Clone
/// <summary>Loads from disk.</summary> /// <param name="libraries">The libraries.</param> /// <returns></returns> private async Task loadFromDisk(Libraries libraries) { //if (ReachDb) await ApplicationIsRunningInOfflineMode().ConfigureAwait(true); var libs = await libraries.GetLibrariesOffDiskAsync().ConfigureAwait(true); InsertLibrariesToCollection(libs); }
public async void Run(IBackgroundTaskInstance taskInstance) { try { if (BackgroundWorkCost.CurrentBackgroundWorkCost == BackgroundWorkCostValue.High) { return; } BackgroundTaskDeferral deferal = taskInstance.GetDeferral(); string json = await readStringFromLocalFile("user.json"); var definition = new { Email = "", Password = "" }; var user = JsonConvert.DeserializeAnonymousType(json, definition); Location location = await LocationService.GetCurrent(); Response res = await LoginRepository.Login(user.Email, user.Password); if (res.Success == true) { if (location != null) { Response ok = await UserRepository.PostLocation(location); Debug.WriteLine(ok); } } deferal.Complete(); } catch (Exception ex) { } }
public static async Task<List<Bob>> FindBobs(int? rating, DateTime minDate, int BobsType_ID, Location location, int? maxDistance) { try { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(URL.BASE); var definition = new { Rating = rating, MinDate = minDate, BobsType_ID = BobsType_ID, Location = JsonConvert.SerializeObject(location), MaxDistance = maxDistance }; var newObject = JsonConvert.SerializeObject(definition); HttpResponseMessage result = await client.PostAsync(URL.BOBS_FIND, new StringContent(newObject, Encoding.UTF8, "application/json")); string json = await result.Content.ReadAsStringAsync(); List<Bob> data = JsonConvert.DeserializeObject<List<Bob>>(json); return data; } } catch (JsonException jex) { Response res = new Response() { Error = "Parse Error: " + jex.ToString(), Success = false }; Debug.WriteLine(res); return null; } catch (Exception ex) { Response res = new Response() { Error = ex.Message.ToString(), Success = false }; Debug.WriteLine(res); return null; } }
public HtmlResourcesAggregator AddJsLibrary(Libraries library, string version, ScriptFormats f, Cdns cdn) { if( (library == Libraries.UnobtrusiveMvc) && (cdn != Cdns.Microsoft) ) { throw new ArgumentException("Reuired CDN (" + cdn + ") does not host Microsoft Unobtrusive Ajax!"); } //version = version.StartsWith("-") ? version : string.Concat("-", version); if(version.EndsWith(".")) { version = version.Substring(0, version.Length - 1); } string jsFilename = _librariesNames[(int)library]; string baseUrl = "";// = cdn == Cdns.Google ? "//ajax.googleapis.com/ajax/libs/" : "//ajax.aspnetcdn.com/ajax/"; string urlFmt = ""; switch(cdn) { case Cdns.Google: // //ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js switch(library) { case Libraries.jQuery: urlFmt = "//ajax.googleapis.com/ajax/libs/%LIBRARY_SHORT_NAME%/%LIBRARY_VERSION%/%LIBRARY_SHORT_NAME%%FILE_FORMAT%.js"; break; default: throw new NotImplementedException("Google CDN is not supported yet!!!"); } break; case Cdns.Microsoft: // //ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js switch (library) { case Libraries.jQuery: //baseUrl = "//ajax.aspnetcdn.com/ajax/jquery/"; urlFmt = "//ajax.aspnetcdn.com/ajax/%LIBRARY_SHORT_NAME%/%LIBRARY_SHORT_NAME%-%LIBRARY_VERSION%.js"; break; case Libraries.jQueryUI: baseUrl = "//ajax.aspnetcdn.com/ajax/jquery.ui/"; break; case Libraries.UnobtrusiveMvc: baseUrl = "//ajax.aspnetcdn.com/ajax/mvc/3.0/"; break; } break; } if(string.IsNullOrEmpty(urlFmt)) { jsFilename = f == ScriptFormats.Min ? string.Concat(jsFilename, version, ".min.js") : string.Concat(jsFilename, version, ".js"); } else { jsFilename = urlFmt .Replace("%LIBRARY_SHORT_NAME%", "jquery") .Replace("%LIBRARY_VERSION%", version) .Replace("%FILE_FORMAT%", f == ScriptFormats.Min ? ".min" : ""); } this.JsFiles.Add(string.Format("{0}{1}", baseUrl, jsFilename)); return this; }
public void Initialize() { libraries = Libraries.Instance; }
private async Task<Boolean> RegisterUser(Libraries.Models.Register register) { if (PasswordRepeat == null) { this.Error = Libraries.Error.PasswordEmpty; RaiseAll(); return false; } else if (Password == PasswordRepeat) { register.Password = Password; //Controleer op bob if (register.IsBob == true) { register.BobsType_ID = SelectedTypeBob.ID; register.AutoType_ID = SelectedAutoType.ID; double price; Double.TryParse(PricePerKm, out price); register.PricePerKm = price; } else { register.BobsType_ID = null; register.AutoType_ID = null; register.PricePerKm = null; register.LicensePlate = null; } Response res = await UserRepository.Register(register); if (res.Success == true) { task = Login_task(register.Email, register.Password); /*Messenger.Default.Send<GoToPage>(new GoToPage() { //Keer terug naar login scherm Name = "Login" }); */ } else { this.Error = res.Error; RaiseAll(); } return res.Success; } else { this.Error = Libraries.Error.Password; RaiseAll(); return false; } }
public ActionResult Create(Libraries.Data.B2C.Admin.Product product) { return View("Index"); }
public static ServerCore SetNavigator(this ServerCore instance, Libraries.Cecer1.Navigator.Navigator navigatorInstance) { _navigatorInstance = navigatorInstance; return instance; }
public static async Task<Response> SetOffer(bool active, int bobs_ID) { try { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(URL.BASE); var definition = new { Active= active, Bobs_ID= bobs_ID}; var newObject = JsonConvert.SerializeObject(definition); HttpResponseMessage result = await client.PutAsync(URL.BOBS_ACTIVE, new StringContent(newObject, Encoding.UTF8, "application/json")); string json = await result.Content.ReadAsStringAsync(); Response data = JsonConvert.DeserializeObject<Response>(json); return data; } } catch (JsonException jex) { Response res = new Response() { Error = "Parse Error: " + jex.ToString(), Success = false }; Debug.WriteLine(res); return null; } catch (Exception ex) { Response res = new Response() { Error = ex.Message.ToString(), Success = false }; Debug.WriteLine(res); return null; } }
/// <summary> /// Asigna las propiedades de configuración al objeto de configuración de <see cref="Libraries.LibTwitter.ManagerTwitter"/> /// </summary> internal static void AssignProperties(Libraries.LibTwitter.ManagerTwitter objManager) { objManager.OAuthConsumerKey = OAuthConsumerKey; objManager.OAuthConsumerSecret = OAuthConsumerSecret; }