public GenericModel(Model m, ViewOptions opts) : base(m, opts) { foreach (var s in m.States) states.Add(new BaseState(this, s) { Name = s.Name }); foreach (var s in states) this.Flush(s.nodes); }
public BCTModel(Model m, ViewOptions opts) : base(m, opts) { f_heap_select = m.MkFunc("[3]", 3); foreach (Model.Func fn in m.Functions) { } }
public void Should_Show_Previous_If_OffSet_Not_Equal_Zero() { var result = new Mock<IViewResult>(); result.ExpectGet(x => x.OffSet).Returns(1); var options = new ViewOptions(); var model = new PageableModel(); model.UpdatePaging(options, result.Object); Assert.IsTrue(model.ShowPrev); }
public ILanguageSpecificModel GetLanguageSpecificModel(Model m, ViewOptions opts) { var dm = new BCTModel(m, opts); foreach (var s in m.States) { var sn = new StateNode(dm.states.Count, dm, s); dm.states.Add(sn); } dm.FinishStates(); return dm; }
public void Should_Skip_1_On_Next_Url_When_Offset_is_Not_Zero() { var result = new Mock<IViewResult>(); result.ExpectGet(x => x.OffSet).Returns(1); var options = new ViewOptions(); var model = new PageableModel(); model.UpdatePaging(options, result.Object); Assert.IsTrue(model.PrevUrlParameters.Contains("skip=1")); Assert.IsTrue(model.PrevUrlParameters.Contains("descending=true")); }
public static Plug With(this Plug plug, ViewOptions viewOptions) { if (viewOptions == null) return plug; if ((viewOptions.Key != null) && (viewOptions.Key.Count > 0)) plug = plug.With(Constants.KEY, viewOptions.Key.ToString()); if ((viewOptions.StartKey != null) && (viewOptions.StartKey.HasValues)) plug = plug.With(Constants.STARTKEY, viewOptions.StartKey.ToString()); if ((viewOptions.EndKey != null) && (viewOptions.EndKey.Count > 0)) plug = plug.With(Constants.ENDKEY, viewOptions.EndKey.ToString()); if (viewOptions.Limit.HasValue) plug = plug.With(Constants.LIMIT, viewOptions.Limit.Value); if (viewOptions.Skip.HasValue) plug = plug.With(Constants.SKIP, viewOptions.Skip.ToString()); if (viewOptions.Reduce.HasValue) plug = plug.With(Constants.REDUCE, viewOptions.Reduce.Value ? "true" : "false"); if (viewOptions.Group.HasValue) plug = plug.With(Constants.GROUP, viewOptions.Group.Value ? "true" : "false"); if (viewOptions.InclusiveEnd.HasValue) plug = plug.With(Constants.INCLUSIVE_END, viewOptions.InclusiveEnd.Value ? "true" : "false"); if (viewOptions.IncludeDocs.HasValue) plug = plug.With(Constants.INCLUDE_DOCS, viewOptions.IncludeDocs.Value ? "true" : "false"); if (viewOptions.GroupLevel.HasValue) plug = plug.With(Constants.GROUP_LEVEL, viewOptions.GroupLevel.Value); if (viewOptions.Descending.HasValue) plug = plug.With(Constants.DESCENDING, viewOptions.Descending.Value ? "true" : "false"); if (viewOptions.Stale.HasValue) { switch (viewOptions.Stale.Value) { case Stale.Normal: plug = plug.With(Constants.STALE, Constants.OK); break; case Stale.UpdateAfter: plug = plug.With(Constants.STALE, Constants.UPDATE_AFTER); break; default: throw new ArgumentException("Invalid Stale Option"); } } if (!string.IsNullOrEmpty(viewOptions.StartKeyDocId)) plug = plug.With(Constants.STARTKEY_DOCID, viewOptions.StartKeyDocId); if (!string.IsNullOrEmpty(viewOptions.EndKeyDocId)) plug = plug.With(Constants.ENDKEY_DOCID, viewOptions.EndKeyDocId); if (!string.IsNullOrEmpty(viewOptions.Etag)) plug = plug.WithHeader(DreamHeaders.IF_NONE_MATCH, viewOptions.Etag); return plug; }
public void Should_Show_Next_Unless_Offset_Plus_Limit_Gte_Count() { var result = new Mock<IViewResult>(); result.ExpectGet(x => x.OffSet).Returns(5); var options = new ViewOptions(); options.Limit = 5; result.ExpectGet(x => x.TotalRows).Returns(10); var model = new PageableModel(); model.UpdatePaging(options, result.Object); Assert.IsFalse(model.ShowNext); }
// Lifetime controls protected override void CoreInitialize(ViewOptions opts) { ExtendedOptionsCache.ShouldSwapAutomatically = opts.ShouldSwapAutomatically; ExtendedOptionsCache.IsEventDriven = opts.IsEventDriven; ExtendedOptionsCache.FramesPerSecond = opts.FramesPerSecond; ExtendedOptionsCache.UpdatesPerSecond = opts.UpdatesPerSecond; ExtendedOptionsCache.VSync = opts.VSync; ExtendedOptionsCache.API = opts.API; ExtendedOptionsCache.VideoMode = opts.VideoMode; ExtendedOptionsCache.PreferredDepthBufferBits = opts.PreferredDepthBufferBits; CoreInitialize(ExtendedOptionsCache); }
public ILanguageSpecificModel GetLanguageSpecificModel(Model m, ViewOptions opts) { var dm = new DafnyModel(m, opts); foreach (var s in m.States) { var sn = new StateNode(dm.states.Count, dm, s); dm.states.Add(sn); } dm.FinishStates(); return(dm); }
// ********************************************************************* // GetAllMessages // /// <summary> /// This method returns all of the messages for a particular forum /// (specified by ForumID) and returns the messages in a particular /// format (specified by ForumView). /// </summary> /// <param name="ForumID">The ID of the Forum whose posts you are interested in retrieving.</param> /// <param name="ForumView">How to view the posts. The three options are: Flat, Mixed, and Threaded.</param> /// <param name="PagesBack">How many pages back of posts to view. Each forum has a /// parameter indicating how many days worth of posts to show per page.</param> /// <returns>A PostCollection object containing the posts for the particular forum that fall within /// the particular page specified by PagesBack.</returns> /// // ********************************************************************/ public static PostCollection GetAllMessages(int forumID, ViewOptions forumView, int pagesBack) { // Create Instance of the IDataProviderBase IDataProviderBase dp = DataProvider.Instance(); // make sure ForumView is set if (forumView == ViewOptions.NotSet) { forumView = (ViewOptions)Globals.DefaultForumView; } return(dp.GetAllMessages(forumID, forumView, pagesBack)); }
public void TestGetInfoReturnsFileNotFound() { // Arrange var viewOptions = new ViewOptions { FileInfo = TestFiles.NotExist.ToFileInfo() }; var request = new GetInfoRequest(viewOptions); // Act & Assert Assert.Throws <ApiException>(() => { InfoApi.GetInfo(request); }); }
public void Should_Show_Next_Unless_Offset_Plus_Limit_Gte_Count() { var result = new Mock <IViewResult>(); result.ExpectGet(x => x.OffSet).Returns(5); var options = new ViewOptions(); options.Limit = 5; result.ExpectGet(x => x.TotalRows).Returns(10); var model = new PageableModel(); model.UpdatePaging(options, result.Object); Assert.IsFalse(model.ShowNext); }
public GenericModel(Model m, ViewOptions opts) : base(m, opts) { foreach (var s in m.States) { states.Add(new BaseState(this, s) { Name = s.Name }); } foreach (var s in states) { this.Flush(s.nodes); } }
public void TestGetInfoWithMinimalViewOptions() { // Arrange var viewOptions = new ViewOptions { FileInfo = TestFiles.PasswordProtectedDocx.ToFileInfo() }; var request = new GetInfoRequest(viewOptions); // Act & Assert var infoResult = InfoApi.GetInfo(request); Assert.AreEqual(4, infoResult.Pages.Count); Assert.AreEqual(0, infoResult.Attachments.Count); }
public override void Show() { base.Show(); view = GameManager.Instance.InstantiateUi <ViewOptions>("Options"); view.buttonMoveRight.onClick.AddListener(ClickMoveRight); view.buttonMoveLeft.onClick.AddListener(ClickMoveLeft); view.buttonBack.onClick.AddListener(ClickBack); view.sampleDropdown.onValueChanged.AddListener(DropdownValueChanged); view.background.SetActive(backgroundVisible); // use OptionsBehaviour to listen to Unity events (updates, keypresses etc.) OptionsBehaviour optionsBehaviour = view.gameObject.AddComponent <OptionsBehaviour>(); optionsBehaviour.state = this; }
public void GroupCarByBrand() { ViewOptions option = new ViewOptions(); option.GroupLevel = 1; ViewResult result = Db.View("groupbybrand", option, "car"); foreach (var item in result.Rows) { groupingCarDTO groupingCar = JsonConvert.DeserializeObject <groupingCarDTO>(item.ToString()); Console.Write("\n"); Console.WriteLine("Marka : " + groupingCar.Key[0]); Console.WriteLine("Adet :" + groupingCar.Value); } }
public void ViewStaleOptions() { ViewOptions viewOptions = new ViewOptions(); viewOptions.Stale = Stale.Normal; Plug p = Plug.New("http://localhost").With(viewOptions); Assert.AreEqual("http://localhost?stale=ok", p.ToString()); viewOptions.Stale = Stale.UpdateAfter; Plug p2 = Plug.New("http://localhost").With(viewOptions); Assert.AreEqual("http://localhost?stale=update_after", p2.ToString()); }
public static int ExecuteViewAndReturnExitCode(ViewOptions options) { try { var fileView = Api.View(options.FileName, options.Password); Console.WriteLine($"File: {fileView.FileName}"); Console.WriteLine($"Time Remaining: {fileView.RemainingMinutes} Minutes"); Console.WriteLine($"Downloads Remaining: {fileView.RemainingDownloads?.ToString() ?? "Infinite"}"); } catch { Console.WriteLine("Operation unsuccessful."); return(1); } return(0); }
public DafnyModel(Model m, ViewOptions opts) : base(m, opts) { f_heap_select = m.MkFunc("[3]", 3); f_set_select = m.MkFunc("[2]", 2); f_seq_length = m.MkFunc("Seq#Length", 1); f_seq_index = m.MkFunc("Seq#Index", 2); f_box = m.MkFunc("$Box", 1); f_dim = m.MkFunc("FDim", 1); f_index_field = m.MkFunc("IndexField", 1); f_multi_index_field = m.MkFunc("MultiIndexField", 2); f_dtype = m.MkFunc("dtype", 1); f_null = m.MkFunc("null", 0); // collect the array dimensions from the various array.Length functions, and // collect all known datatype values foreach (var fn in m.Functions) { if (Regex.IsMatch(fn.Name, "^_System.array[0-9]*.Length[0-9]*$")) { int j = fn.Name.IndexOf('.', 13); int dims = j == 13 ? 1 : int.Parse(fn.Name.Substring(13, j - 13)); int idx = j == 13 ? 0 : int.Parse(fn.Name.Substring(j + 7)); foreach (var tpl in fn.Apps) { var elt = tpl.Args[0]; var len = tpl.Result; Model.Element[] ar; if (!ArrayLengths.TryGetValue(elt, out ar)) { ar = new Model.Element[dims]; ArrayLengths.Add(elt, ar); } Contract.Assert(ar[idx] == null); ar[idx] = len; } } else if (fn.Name.StartsWith("#") && fn.Name.IndexOf('.') != -1 && fn.Name[1] != '#') { foreach (var tpl in fn.Apps) { var elt = tpl.Result; DatatypeValues.Add(elt, tpl); } } } }
public IEnumerable <long> Produce(int freshnessInMinutes, int limit) { try { var options = new ViewOptions { Limit = limit }; options.EndKey.Add(freshnessInMinutes); return(GetSummonerIds(options)); } catch (Exception ex) { Log.Error("Error reading from the CouchDB index.", ex); return(Enumerable.Empty <long>()); } }
/// <summary> /// Send download request /// </summary> /// <param name="">TODO</param> /// <returns>true if request was successful and false if unsuccessful</returns> public static bool View(ViewOptions options) { var outbound = new Payload(); var inbound = new Payload(); var aggregateResult = true; foreach (var filename in options.Filenames) { outbound.Filename = filename; outbound.Password = options.Password; outbound.Status = Core.Config.RequestInfo; var payloadSerializer = new XmlSerializer(typeof(Payload)); var tcpClient = new TcpClient(Core.Config.ServerIpAddress, Core.Config.ServerPortNumber); using (var stream = tcpClient.GetStream()) { payloadSerializer.Serialize(stream, outbound); tcpClient.Client.Shutdown(SocketShutdown.Send); inbound = (Payload)payloadSerializer.Deserialize(stream); if (inbound.Status == Core.Config.ServerError) { Console.WriteLine(Client.Config.MessageViewError, filename); tcpClient.Close(); aggregateResult = false; } else { var downloadsLeft = (inbound.DownloadsLeft == Core.Config.OptionUnlimitedDownload) ? Client.Config.StatusDownloadsUnlimited : $"{inbound.DownloadsLeft}"; Console.WriteLine(Client.Config.MessageViewSuccess, filename, inbound.TimeCreated, downloadsLeft, inbound.TimeLeft.ToString(Client.Config.TimeFormat) ); } } tcpClient.Close(); } return(aggregateResult); }
public void TestCreateViewWithFontsPathOption() { // Arrange var testFile = TestFiles.UsesCustomFontPptx; var viewOptions = new ViewOptions { FileInfo = testFile.ToFileInfo(), ViewFormat = ViewOptions.ViewFormatEnum.PNG, FontsPath = "font/ttf" }; var request = new CreateViewRequest(viewOptions); // Act & Assert var viewResult = ViewApi.CreateView(request); Assert.AreEqual(1, viewResult.Pages.Count); }
public void Defaults() { ViewOptions options = new ViewOptions(); Assert.AreEqual(Color4.Gray, options.BuildAreaLineColor); Assert.AreEqual(Color4.Black, options.MajorGridlineColor); Assert.AreEqual(Color4.DarkGray, options.MinorGridlineColor); Assert.AreEqual(Color4.Red, options.AxisColor); Assert.AreEqual(true, options.ShowBuildArea); Assert.AreEqual(true, options.ShowAxes); Assert.AreEqual(5, options.MajorGridlineFactor); Assert.AreEqual(Color4.Yellow, options.SliceLineColor); Assert.AreEqual(3f, options.SliceLineWidth); Assert.AreEqual(Color4.Yellow, options.FillLineColor); Assert.AreEqual(1f, options.FillLineWidth); Assert.AreEqual(Color4.CornflowerBlue, options.ModelColor); }
public void Should_Populate_Items_When_IncludeDocs_Set_In_ViewOptions() { string designDoc = "test"; string viewName = "testView"; var settings = new JsonSerializerSettings(); var converters = new List <JsonConverter> { new IsoDateTimeConverter() }; settings.Converters = converters; settings.ContractResolver = new CamelCasePropertyNamesContractResolver(); settings.NullValueHandling = NullValueHandling.Ignore; var doc = new { _id = "_design/" + designDoc, Language = "javascript", Views = new { TestView = new { Map = "function(doc) {\n if(doc.type == 'company') {\n emit(doc._id, null);\n }\n}" } } }; var db = client.GetDatabase(baseDatabase); db.CreateDocument(doc._id, JsonConvert.SerializeObject(doc, Formatting.Indented, settings)); var company = new Company(); company.Name = "foo"; db.CreateDocument(company); // Without IncludeDocs Assert.IsNull(db.View <Company>(viewName, designDoc).Items.ToList()[0]); // With IncludeDocs ViewOptions options = new ViewOptions { IncludeDocs = true }; Assert.AreEqual("foo", db.View <Company>(viewName, options, designDoc).Items.ToList()[0].Name); }
public void ComplexViews() { var db = _client.GetDatabase(DB_NAME); var options = new ViewOptions(); // generate ["foo"] startkey parameter options.StartKey.Add("foo"); // generate ["foo",{},{}] endkey parameter //options.EndKey.Add("foo", CouchValue.Empty, CouchValue.Empty); var results = db.View <FakePOCO>("view_name", options); // loop through strongly typed results foreach (var item in results.Items) { // do something } }
public void TestCreateViewPdfWithOutputPath() { // Arrange var testFile = TestFiles.OnePageDocx; var viewOptions = new ViewOptions { FileInfo = testFile.ToFileInfo(), ViewFormat = ViewOptions.ViewFormatEnum.PDF, OutputPath = OutputPath }; var request = new CreateViewRequest(viewOptions); // Act & Assert var viewResult = ViewApi.CreateView(request); Assert.IsTrue(viewResult.File.Path.StartsWith(OutputPath)); }
public void OrderByDescendingForYear() { ViewOptions option = new ViewOptions(); option.Descending = true; ViewResult result = Db.View("descendingbyyear", option, "car"); foreach (var item in result.Rows) { descendingCarDTO descendingCar = JsonConvert.DeserializeObject <descendingCarDTO>(item.ToString()); Console.Write("\n"); Console.WriteLine("Araç Saşi No: " + descendingCar.Id); Console.WriteLine("Araç Motor No: " + descendingCar.Value[0]); Console.WriteLine("Marka: " + descendingCar.Value[1]); Console.WriteLine("Model: " + descendingCar.Value[2]); Console.WriteLine("Yıl : " + descendingCar.Key); } }
public static void Run() { var apiInstance = new ViewApi(Constants.GetConfig()); try { var viewOptions = new ViewOptions { FileInfo = new FileInfo { FilePath = "SampleFiles/sample.msg" }, ViewFormat = ViewOptions.ViewFormatEnum.HTML, RenderOptions = new HtmlOptions { EmailOptions = new EmailOptions { FieldLabels = new List <FieldLabel> { new FieldLabel { Field = "From", Label = "Sender" }, new FieldLabel { Field = "To", Label = "Receiver" }, new FieldLabel { Field = "Sent", Label = "Date" }, new FieldLabel { Field = "Subject", Label = "Topic" } } } } }; var response = apiInstance.CreateView(new CreateViewRequest(viewOptions)); Console.WriteLine("RenameEmailFields completed: " + response.Pages.Count); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } }
public static IEnumerable <string> GetAllImageIds(string library) { List <string> images = new List <string>(); if (library != null) { CouchDatabase db = GetDatabase(library); var options = new ViewOptions(); options.IncludeDocs = true; var imgDocs = db.View <JObject>("all", options, "screenshots"); foreach (JObject doc in imgDocs.Items) { images.Add(doc["_id"].Value <string>()); } } return(images); }
public void TestGetInfoWithRenderHiddenPages() { // Arrange var testFile = TestFiles.TwoHiddenPagesVsd; var viewOptions = new ViewOptions { FileInfo = testFile.ToFileInfo(), RenderOptions = new RenderOptions { RenderHiddenPages = true } }; var request = new GetInfoRequest(viewOptions); // Act & Assert var infoResult = InfoApi.GetInfo(request); Assert.AreEqual(3, infoResult.Pages.Count); }
/// <summary> /// Adds watermark on document if its specified in configuration file. /// </summary> /// <param name="options"></param> private static void SetWatermarkOptions(ViewOptions options) { Watermark watermark = null; if (!string.IsNullOrEmpty(globalConfiguration.GetViewerConfiguration().GetWatermarkText())) { // Set watermark properties watermark = new Watermark(globalConfiguration.GetViewerConfiguration().GetWatermarkText()) { Color = System.Drawing.Color.Blue, Position = Position.Diagonal, }; } if (watermark != null) { options.Watermark = watermark; } }
public void Toggle_should_trigger_options_changed() { _navigator.Initialize("http://localhost/"); var options = new ViewOptions(_navigator); var counter = 0; options.OptionsChanged += () => counter++; options.ToggleUnplanned(); counter.ShouldBe(1); options.ToggleClosed(); counter.ShouldBe(2); options.ToggleTodayIndicator(); counter.ShouldBe(3); options.ToggleCardDetails(); counter.ShouldBe(4); options.ToggleSelectedProjects("px"); counter.ShouldBe(5); }
/// <summary> /// The operation to view refined and unrefined shapes. /// </summary> /// <param name="options">The options object which contains extra information /// which helps during the exeuction of this modus.</param> public static void Start(ViewOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } // Load in new shapes to view. if (options.HasDirectories) { foreach (string dir in options.ShapeDirectories) { Settings.FileManager.AddDirectoryDirect(dir); } } // Notify the user of their options. ShowShapeCount(); // Prompt them to choose a file. DisplayShapes(); }
public void TestCreateViewWithDefaultOutputPath() { // Arrange var testFile = TestFiles.OnePageDocx; var viewOptions = new ViewOptions { FileInfo = testFile.ToFileInfo() }; var request = new CreateViewRequest(viewOptions); // Act & Assert var viewResult = ViewApi.CreateView(request); Assert.AreEqual(1, viewResult.Pages.Count); var page = viewResult.Pages[0]; Assert.IsTrue(page.Path.StartsWith(DefaultOutputPath)); }
private bool TryGetValue(object model, string expression, bool onlyUseModel, out object value) { if (TryHitCache(model, expression, out value) == true) { return(true); } var pathComponents = expression.Split('.'); if (TryGetModelValue(model, pathComponents, out value) == true) { UpdateCache(model, expression, value); return(true); } else if (onlyUseModel == false && ViewOptions.TryResolveUnresolvedModelKey(expression, pathComponents, model, out value) == true) { return(true); } return(false); }
public void Views() { var db = _client.GetDatabase(DB_NAME); // get view results var results = db.View <FakePOCO>("view_name"); // get view results with parameters var options = new ViewOptions(); options.StartKey.Add("Atlanta"); options.EndKey.Add("Washington"); var results2 = db.View <FakePOCO>("view_name", options); // loop through strongly typed results foreach (var item in results.Items) { // do something } }
public void TestGetInfoWithDefaultViewFormat() { // Arrange var testFile = TestFiles.OnePageDocx; var viewOptions = new ViewOptions { FileInfo = testFile.ToFileInfo(), }; var request = new GetInfoRequest(viewOptions); // Act & Assert var infoResult = InfoApi.GetInfo(request); Assert.AreEqual(1, infoResult.Pages.Count); Assert.AreEqual(0, infoResult.Attachments.Count); var page = infoResult.Pages[0]; Assert.AreEqual(1, page.Number); }
public ILanguageSpecificModel GetLanguageSpecificModel(Model m, ViewOptions opts) { return new GenericModel(m, opts); }
public void ViewStaleOptions() { ViewOptions viewOptions = new ViewOptions(); viewOptions.Stale = Stale.Normal; Plug p = Plug.New("http://localhost").With(viewOptions); Assert.AreEqual("http://localhost?stale=ok",p.ToString()); viewOptions.Stale = Stale.UpdateAfter; Plug p2 = Plug.New("http://localhost").With(viewOptions); Assert.AreEqual("http://localhost?stale=update_after", p2.ToString()); }
private void buttonXPrint_Click(object sender, EventArgs e) { SelectedOption = ViewOptions.Print; DialogResult = DialogResult.OK; Close(); }
public abstract void ToggleOptions(string username, bool hideReadThreads, ViewOptions viewOptions);
private void buttonXEmailBin_Click(object sender, EventArgs e) { SelectedOption = ViewOptions.EmailBinAdd; DialogResult = DialogResult.OK; Close(); }
// ********************************************************************* // ToggleOptions // /// <summary> /// Toggle various user options /// </summary> /// <param name="username">Name of user we're updating</param> /// <param name="hideReadThreads">Hide threads that the user has already read</param> /// <param name="viewOptions">How the user views posts</param> /// // ********************************************************************/ public static void ToggleOptions(string username, bool hideReadThreads, ViewOptions viewOptions) { // Create Instance of the CommonDataProvider CommonDataProvider dp = CommonDataProvider.Instance(); dp.ToggleOptions(username, hideReadThreads, viewOptions); }