void AssertPatternContains(string filePattern) { var modifier = new HandlebarsFileSearchModifier(); var fileSearch = new FileSearch(); modifier.Modify(fileSearch); filePattern.ShouldContain(filePattern); }
public void ModifyAddsLessPattern() { var modifier = new LessFileSearchModifier(); var fileSearch = new FileSearch(); modifier.Modify(fileSearch); fileSearch.Pattern.ShouldContain("*.less"); }
public void ModifyAddsCoffeePattern() { var modifier = new CoffeeScriptFileSearchModifier(); var fileSearch = new FileSearch(); modifier.Modify(fileSearch); fileSearch.Pattern.ShouldContain("*.coffee"); }
public HtmlTemplatesContainerConfiguration_Tests() { container = new TinyIoCContainer(); configuration = new HtmlTemplatesContainerConfiguration(type => new Type[0]); configuration.Configure(container); fileSearch = (FileSearch)container.Resolve<IFileSearch>(HostBase.FileSearchComponentName(typeof(HtmlTemplateBundle))); }
public ScriptsContainerConfiguration_Tests() { container = new TinyIoCContainer(); container.Register<IJavaScriptMinifier, MicrosoftJavaScriptMinifier>(); container.Register(typeof(IUrlModifier), Mock.Of<IUrlModifier>()); container.Register<IUrlGenerator>((c, x) => new UrlGenerator(c.Resolve<IUrlModifier>(), "cassette.axd/")); configuration = new ScriptContainerConfiguration(type => new Type[0]); configuration.Configure(container); fileSearch = (FileSearch)container.Resolve<IFileSearch>(HostBase.FileSearchComponentName(typeof(ScriptBundle))); }
/// <summary> /// Searches for the specified show and its episode. /// </summary> /// <param name="episode">The episode to search for.</param> public void Search(Episode episode) { _ep = episode; var paths = Settings.Get<List<string>>("Download Paths"); if (paths.Count == 0) { new TaskDialog { CommonIcon = TaskDialogIcon.Stop, Title = "Search path not configured", Instruction = "Search path not configured", Content = "To use this feature you must set your download path." + Environment.NewLine + Environment.NewLine + "To do so, click on the logo on the upper left corner of the application, then select 'Configure Software'. On the new window click the 'Browse' button under 'Download Path'." }.Show(); return; } _td = new TaskDialog { Title = "Searching...", Instruction = string.Format("{0} S{1:00}E{2:00}", _ep.Show.Name, _ep.Season, _ep.Number), Content = "Searching for the episode...", CommonButtons = TaskDialogButton.Cancel, ShowProgressBar = true }; _td.SetMarqueeProgressBar(true); _td.Destroyed += TaskDialogDestroyed; _td.ButtonClick += TaskDialogDestroyed; _active = true; new Thread(() => { Thread.Sleep(500); if (_active) { _res = _td.Show().CommonButton; } }).Start(); _fs = new FileSearch(paths, _ep); _fs.FileSearchDone += FileSearchDone; _fs.FileSearchProgressChanged += FileSearchProgressChanged; _fs.BeginSearch(); Utils.Win7Taskbar(state: TaskbarProgressBarState.Indeterminate); }
public ScriptBundleContainerModuleWithFileSearchModifierTests() { container = new TinyIoCContainer(); container.Register<IJavaScriptMinifier, MicrosoftJavaScriptMinifier>(); container.Register<IUrlGenerator, UrlGenerator>(); container.Register(typeof(IUrlModifier), Mock.Of<IUrlModifier>()); var modifier = new Mock<IFileSearchModifier<ScriptBundle>>(); modifier .Setup(m => m.Modify(It.IsAny<FileSearch>())) .Callback<FileSearch>(fs => fs.Pattern += ";*.other"); container.Register(typeof(IFileSearchModifier<ScriptBundle>), modifier.Object); configuration = new ScriptContainerConfiguration(type => new Type[0]); configuration.Configure(container); fileSearch = (FileSearch)container.Resolve<IFileSearch>(HostBase.FileSearchComponentName(typeof(ScriptBundle))); }
private Dictionary <PackageItem, WixItem> ProcessIntermediates(IEnumerable <Intermediate> intermediates) { Dictionary <PackageItem, WixItem> wixItems = new Dictionary <PackageItem, WixItem>(); foreach (Intermediate intermediate in intermediates) { foreach (PackageItem item in intermediate.Items) { File file = item as File; if (file != null) { WixFile msiFile = new WixFile(this, file); wixItems.Add(file, msiFile); NgenPackageItem ngen; if (Ngen.TryGetPackageItem(file, out ngen)) { ngen.LineNumber = file.LineNumber; file.Items.Add(ngen); WixNativeImage nativeImage = new WixNativeImage(this, ngen); wixItems.Add(ngen, nativeImage); } } else { Folder folder = item as Folder; if (folder != null) { if (folder.External) { WixFolderReference msiFolderRef = new WixFolderReference(this, folder); wixItems.Add(folder, msiFolderRef); } else { WixFolder msiFolder = new WixFolder(this, folder); wixItems.Add(folder, msiFolder); } } else { InprocServer inprocServer = item as InprocServer; if (null != inprocServer) { WixClassId classId = new WixClassId(this, inprocServer); wixItems.Add(inprocServer, classId); } else { OutprocServer outprocServer = item as OutprocServer; if (null != outprocServer) { WixClassId classId = new WixClassId(this, outprocServer); wixItems.Add(outprocServer, classId); } else { Property property = item as Property; if (property != null) { WixProperty prop = new WixProperty(this, property); wixItems.Add(property, prop); } else { FileSearch fileSearch = item as FileSearch; if (fileSearch != null) { WixFileSearch fs = new WixFileSearch(this, fileSearch); wixItems.Add(fileSearch, fs); } else { Group group = item as Group; if (group != null) { WixGroup msiGroup = new WixGroup(this, group); wixItems.Add(group, msiGroup); } else if (item is Package) { // TODO: send an error message since library files cannot process Package elements. } } } } } } } } } // Fix up all the item parents and groups now that we have them // all processed into a single look up dictionary. foreach (var kv in wixItems) { PackageItem pi = kv.Key; WixItem wi = kv.Value; if (pi.Parent != null) { wi.Parent = wixItems[pi.Parent]; } if (pi.Group != null) { wi.Group = (WixGroup)wixItems[pi.Group]; wi.Group.ContainedWixItems.Add(wi); } } return(wixItems); }
public void LoadTypes(bool p_clearCaches) { m_types.Clear(); m_externalTypes.Clear(); m_combinedTypes.Clear(); if (p_clearCaches) { Dialog.m_loadedDialogs.Clear(); Quest.m_loadedQuests.Clear(); CleanUp(); } TextAsset[] types = Resources.LoadAll <TextAsset>("NPCTypes"); foreach (TextAsset typeText in types) { NPCType type = JsonUtility.FromJson <NPCType>(typeText.text); if (type != null) { m_types.Add(type); } } List <string> files = new List <string>(); FileSearch.RecursiveRetrieval(Application.dataPath + "/Data/NPCTypes/", ref files); if (files.Count > 0) { foreach (string file in files) { if (file.ToLower().EndsWith(".json")) { StreamReader reader = new StreamReader(file); NPCType type = JsonUtility.FromJson <NPCType>(reader.ReadToEnd()); if (type != null) { m_externalTypes.Add(type); } reader.Close(); } } } foreach (NPCType type in m_types) { NPCType external = m_externalTypes.Find(nt => nt.m_type == type.m_type); if (external != null) { NPCType combined = type.Clone(); combined.Combine(external, true); m_combinedTypes.Add(combined); } else { m_combinedTypes.Add(type); } } if (m_externalTypes.Count > 0) { foreach (NPCType external in m_externalTypes) { if (!m_types.Exists(nt => nt.m_type == external.m_type)) { external.AppendDataMarker(); m_combinedTypes.Add(external); } } } }
public FileSearchItem(FileSearch search) { icon = Gui.LoadIcon(16, "system-search"); this.search = search; pageWidget = new SearchResultsPage(search); }
public object Get(FileSearch request) => GetSearchResultWithCache <File, DocEntityFile, FileSearch>(DocConstantModelName.FILE, request, _ExecSearch);
public SearchResultsPage (FileSearch search) { VPaned paned; TreeViewColumn column; ToolItem spacerItem; ToolItem filterItem; Alignment filterAlignment; ToolButton searchAgainToolButton; this.search = search; downloadToolButton = new ToolButton(new Image("gtk-save", IconSize.LargeToolbar), "Download"); downloadToolButton.IsImportant = true; downloadToolButton.Sensitive = false; downloadToolButton.Clicked += DownloadToolButtonClicked; searchAgainToolButton = new ToolButton(new Image("gtk-refresh", IconSize.LargeToolbar), "Search Again"); searchAgainToolButton.IsImportant = true; searchAgainToolButton.Clicked += SearchAgainToolButtonClicked; spacerItem = new ToolItem(); spacerItem.Expand = true; filterButton = new ToggleButton("Filter Results"); filterButton.Image = new Image(Gui.LoadIcon(16, "application-x-executable")); filterButton.Toggled += delegate (object o, EventArgs args) { this.ShowFilter = filterButton.Active; }; filterAlignment = new Alignment(0.5f, 0.5f, 0, 0); filterAlignment.Add(filterButton); filterItem = new ToolItem(); filterItem.Add(filterAlignment); browseToolButton = new ToolButton(new Image("gtk-open", IconSize.LargeToolbar), "Browse"); browseToolButton.IsImportant = true; browseToolButton.Sensitive = false; browseToolButton.Clicked += BrowseToolButtonClicked; toolbar = new Toolbar(); toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; toolbar.Insert(downloadToolButton, -1); toolbar.Insert(browseToolButton, -1); toolbar.Insert(spacerItem, -1); toolbar.Insert(filterItem, -1); toolbar.Insert(new SeparatorToolItem(), -1); toolbar.Insert(searchAgainToolButton, -1); toolbar.ShowAll(); this.PackStart(toolbar, false, false, 0); resultCountByTypeCache = new Dictionary<FilterType, int>(); Gdk.Pixbuf audioPixbuf = Gui.LoadIcon(16, "audio-x-generic"); Gdk.Pixbuf videoPixbuf = Gui.LoadIcon(16, "video-x-generic"); Gdk.Pixbuf imagePixbuf = Gui.LoadIcon(16, "image-x-generic"); Gdk.Pixbuf docPixbuf = Gui.LoadIcon(16, "x-office-document"); unknownPixbuf = Gui.LoadIcon(16, "text-x-generic"); folderPixbuf = Gui.LoadIcon(16, "folder"); typeStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(FilterType)); typeStore.AppendValues(null, "All Results", FilterType.All); typeStore.AppendValues(null, "-"); typeStore.AppendValues(audioPixbuf, "Audio", FilterType.Audio); typeStore.AppendValues(videoPixbuf, "Video", FilterType.Video); typeStore.AppendValues(imagePixbuf, "Images", FilterType.Image); typeStore.AppendValues(docPixbuf, "Documents", FilterType.Document); typeStore.AppendValues(folderPixbuf, "Folders", FilterType.Folder); typeStore.AppendValues(unknownPixbuf, "Other", FilterType.Other); typeTree = new TreeView(); typeTree.HeadersVisible = false; typeTree.RowSeparatorFunc = delegate (TreeModel m, TreeIter i) { string text = (string)m.GetValue(i, 1); return (text == "-"); }; typeTree.Selection.Changed += TypeSelectionChanged; typeTree.Model = typeStore; CellRendererPixbuf pixbufCell = new CellRendererPixbuf(); CellRendererText textCell = new CellRendererText(); CellRendererText countTextCell = new CellRendererText(); countTextCell.Sensitive = false; countTextCell.Alignment = Pango.Alignment.Right; countTextCell.Xalign = 1; column = new TreeViewColumn(); column.PackStart(pixbufCell, false); column.PackStart(textCell, true); column.PackStart(countTextCell, false); column.AddAttribute(pixbufCell, "pixbuf", 0); column.AddAttribute(textCell, "text", 1); column.SetCellDataFunc(countTextCell, new TreeCellDataFunc(TypeCountCellFunc)); typeTree.AppendColumn(column); TreeView artistTree = new TreeView(); artistTree.HeadersVisible = false; TreeView albumTree = new TreeView(); albumTree.HeadersVisible = false; HBox topBox = new HBox(); topBox.PackStart(Gui.AddScrolledWindow(typeTree), true, true, 0); topBox.PackStart(Gui.AddScrolledWindow(artistTree), true, true, 1); topBox.PackStart(Gui.AddScrolledWindow(albumTree), true, true, 0); topBox.Homogeneous = true; resultsStore = new ListStore(typeof(SearchResult)); resultsStore.RowInserted += delegate { Refilter(); }; resultsStore.RowDeleted += delegate { Refilter(); }; resultsTree = new TreeView(); resultsTree.RowActivated += resultsTree_RowActivated; resultsTree.ButtonPressEvent += resultsTree_ButtonPressEvent; resultsTree.Selection.Changed += ResultsTreeSelectionChanged; imageColumns = new List<TreeViewColumn>(); audioColumns = new List<TreeViewColumn>(); videoColumns = new List<TreeViewColumn>(); fileOnlyColumns = new List<TreeViewColumn>(); folderOnlyColumns = new List<TreeViewColumn>(); column = new TreeViewColumn(); column.Title = "File Name"; column.Clickable = true; column.Sizing = TreeViewColumnSizing.Autosize; column.Resizable = true; column.SortColumnId = 0; //resultsTree.ExpanderColumn = column; CellRenderer cell = new CellRendererPixbuf(); column.PackStart(cell, false); column.SetCellDataFunc(cell, new TreeCellDataFunc(IconFunc)); cell = new CellRendererText(); column.PackStart(cell, true); column.SetCellDataFunc(cell, new TreeCellDataFunc(FileNameFunc)); resultsTree.AppendColumn(column); column = resultsTree.AppendColumn("Codec", new CellRendererText(), new TreeCellDataFunc(CodecFunc)); column.Clickable = true; column.Sizing = TreeViewColumnSizing.Fixed; column.FixedWidth = 120; column.Resizable = true; column.SortColumnId = 1; videoColumns.Add(column); column = resultsTree.AppendColumn("Format", new CellRendererText(), new TreeCellDataFunc(FormatFunc)); column.Clickable = true; column.Sizing = TreeViewColumnSizing.Fixed; column.FixedWidth = 90; column.Resizable = true; column.SortColumnId = 2; imageColumns.Add(column); column = resultsTree.AppendColumn("Resolution", new CellRendererText(), new TreeCellDataFunc(ResolutionFunc)); column.Clickable = true; column.Sizing = TreeViewColumnSizing.Fixed; column.FixedWidth = 90; column.Resizable = true; column.SortColumnId = 3; videoColumns.Add(column); imageColumns.Add(column); column = resultsTree.AppendColumn("Artist", new CellRendererText(), new TreeCellDataFunc(ArtistFunc)); column.Clickable = true; column.Sizing = TreeViewColumnSizing.Fixed; column.FixedWidth = 110; column.Resizable = true; column.SortColumnId = 4; audioColumns.Add(column); column = resultsTree.AppendColumn("Album", new CellRendererText(), new TreeCellDataFunc(AlbumFunc)); column.Clickable = true; column.Sizing = TreeViewColumnSizing.Fixed; column.FixedWidth = 110; column.Resizable = true; column.SortColumnId = 5; audioColumns.Add(column); column = resultsTree.AppendColumn("Bitrate", new CellRendererText(), new TreeCellDataFunc(BitrateFunc)); column.Clickable = true; column.Sizing = TreeViewColumnSizing.Fixed; column.FixedWidth = 70; column.Resizable = true; column.SortColumnId = 6; audioColumns.Add(column); column = resultsTree.AppendColumn("Size", new CellRendererText(), new TreeCellDataFunc(SizeFunc)); column.Clickable = true; column.Sizing = TreeViewColumnSizing.Fixed; column.FixedWidth = 70; column.SortColumnId = 7; column.Resizable = true; fileOnlyColumns.Add(column); column = resultsTree.AppendColumn("Sources", new CellRendererText(), new TreeCellDataFunc(SourcesFunc)); column.Clickable = true; column.Sizing = TreeViewColumnSizing.Fixed; column.FixedWidth = 85; column.SortColumnId = 8; column.Resizable = true; fileOnlyColumns.Add(column); column = resultsTree.AppendColumn("User", new CellRendererText(), new TreeCellDataFunc(UserFunc)); column.Clickable = true; column.Sizing = TreeViewColumnSizing.Fixed; column.FixedWidth = 85; column.SortColumnId = 8; column.Resizable = true; folderOnlyColumns.Add(column); column = resultsTree.AppendColumn("Full Path", new CellRendererText(), new TreeCellDataFunc(FullPathFunc)); column.Clickable = true; column.Resizable = true; column.SortColumnId = 9; column = resultsTree.AppendColumn("Info Hash", new CellRendererText(), new TreeCellDataFunc(InfoHashFunc)); column.Clickable = true; column.Resizable = true; column.SortColumnId = 10; fileOnlyColumns.Add(column); resultsFilter = new TreeModelFilter(resultsStore, null); resultsFilter.VisibleFunc = resultsFilterFunc; resultsSort = new TreeModelSort(resultsFilter); for (int x = 0; x < resultsTree.Columns.Length; x++) { resultsSort.SetSortFunc(x, resultsSortFunc); } resultsTree.Model = resultsSort; ScrolledWindow resultsTreeSW = new ScrolledWindow(); resultsTreeSW.Add(resultsTree); paned = new VPaned(); paned.Add1(topBox); paned.Add2(resultsTreeSW); paned.Position = 160; paned.ShowAll(); filterWidget = new FilterWidget(search); filterWidget.FiltersChanged += filterWidget_FiltersChanged; filterWidget.Hidden += filterWidget_Hidden; this.PackStart(filterWidget, false, false, 0); this.PackStart(paned, true, true, 0); TypeSelectionChanged(typeTree, EventArgs.Empty); search.NewResults += (NewResultsEventHandler)DispatchService.GuiDispatch(new NewResultsEventHandler(search_NewResults)); search.ClearedResults += (EventHandler)DispatchService.GuiDispatch(new EventHandler(search_ClearedResults)); resultPopupMenu = new Menu(); browseResultMenuItem = new ImageMenuItem("Browse"); browseResultMenuItem.Image = new Image(Gui.LoadIcon(16, "document-open")); browseResultMenuItem.Activated += BrowseToolButtonClicked; resultPopupMenu.Append(browseResultMenuItem); downloadResultMenuItem = new ImageMenuItem("Download"); downloadResultMenuItem.Image = new Image(Gui.LoadIcon(16, "go-down")); downloadResultMenuItem.Activated += DownloadToolButtonClicked; resultPopupMenu.Append(downloadResultMenuItem); resultPropertiesMenuItem = new ImageMenuItem(Gtk.Stock.Properties, null); resultPropertiesMenuItem.Activated += FilePropertiesButtonClicked; resultPopupMenu.Append(resultPropertiesMenuItem); }
public Stream OpenFileRead(string relativePath, bool allowCopyFiles, out Pack foundInPack, string gameDirectory, FileSearch searchFlags) { bool found; DateTime lastModified; return OpenFileRead(relativePath, allowCopyFiles, out foundInPack, null, searchFlags, false, out found, out lastModified); }
public void GetFiles_MultiDirectory_MatchingFilesFound() { var files = FileSearch.GetFiles(Path.Combine(FileManager.GetFilesDirectory(), "*ode*", "*.cs")).ToArray(); Assert.AreEqual(1, files.Length); }
public WixFileSearch(WixBackendCompiler backend, FileSearch fileSearch) : base(backend, fileSearch) { }
public static void LoadAll() { m_patterns.Clear(); m_externalPatterns.Clear(); m_combinedPatterns.Clear(); foreach (TextAsset loadedPattern in Resources.LoadAll <TextAsset>("ShotPatterns")) { ShotPattern pattern = Load(loadedPattern.text); if (pattern) { m_patterns.Add(pattern); } } List <string> files = new List <string>(); FileSearch.RecursiveRetrieval(Application.dataPath + "/Data/ShotPatterns/", ref files); if (files.Count > 0) { foreach (string file in files) { if (file.ToLower().EndsWith(".json")) { StreamReader reader = new StreamReader(file); ShotPattern pattern = Load(reader.ReadToEnd()); if (pattern) { m_externalPatterns.Add(pattern); } reader.Close(); } } } foreach (ShotPattern pattern in m_patterns) { ShotPattern external = m_externalPatterns.Find(sp => sp.m_name == pattern.m_name); if (external) { m_combinedPatterns.Add(external); } else { m_combinedPatterns.Add(pattern); } } if (m_externalPatterns.Count > 0) { foreach (ShotPattern external in m_externalPatterns) { if (!m_patterns.Exists(sp => sp.m_name == external.m_name)) { m_combinedPatterns.Add(external); } } } // foreach(ShotPattern pattern in m_combinedPatterns) // then generate the mana cost for each of them }
private void ButtonClick_Search(object sender, RoutedEventArgs e) { if (!Directory.Exists(textBox_PathSearch.Text)) { MessageBox.Show("Данной директории не существует!"); return; } StartLog(FileSearch.logPath); List <FileSearch> fileSearches = new List <FileSearch>(); List <Thread> threads = new List <Thread>(); string fileName = "*.*"; if (!string.IsNullOrEmpty(TextBox_FileName.Text) && fileName.Contains('.')) { fileName = TextBox_FileName.Text; } if (DatePicker_FileCreation.SelectedDate != null) { var fileSearch = new FileSearch(textBox_PathSearch.Text, fileName, new DateCreation(DatePicker_FileCreation.SelectedDate)); fileSearches.Add(fileSearch); Thread thread = new Thread(fileSearch.StartThread); thread.Name = "DateCreation"; threads.Add(thread); } if (DatePicker_FileModification.SelectedDate != null) { var fileSearch = new FileSearch(textBox_PathSearch.Text, fileName, new DateModification(DatePicker_FileModification.SelectedDate)); fileSearches.Add(fileSearch); Thread thread = new Thread(fileSearch.StartThread); thread.Name = "DateModification"; threads.Add(thread); } if (!string.IsNullOrEmpty(TextBox_MinValue.Text)) { if (long.TryParse(TextBox_MinValue.Text, out long result)) { if (result != 0) { result = GetTypeSize(result, (TypeSize)ComboBox_MinSize.SelectedIndex); var fileSearch = new FileSearch(textBox_PathSearch.Text, fileName, new MinSize(result)); fileSearches.Add(fileSearch); Thread thread = new Thread(fileSearch.StartThread); thread.Name = "MinValue"; threads.Add(thread); } } else { MessageBox.Show("Минимальный размер должен иметь корректное число!"); return; } } if (!string.IsNullOrEmpty(TextBox_MaxValue.Text)) { if (long.TryParse(TextBox_MaxValue.Text, out long result)) { result = GetTypeSize(result, (TypeSize)ComboBox_MaxSize.SelectedIndex); var fileSearch = new FileSearch(textBox_PathSearch.Text, fileName, new MaxSize(result)); fileSearches.Add(fileSearch); Thread thread = new Thread(fileSearch.StartThread); thread.Name = "MaxValue"; threads.Add(thread); } else { MessageBox.Show("Максимальный размер должен иметь корректное число!"); return; } } if (!string.IsNullOrEmpty(TextBox_OccurenceSymbols.Text)) { var fileSearch = new FileSearch(textBox_PathSearch.Text, fileName, new OccurrenceSymbols(TextBox_OccurenceSymbols.Text)); fileSearches.Add(fileSearch); Thread thread = new Thread(fileSearch.StartThread); thread.Name = "OccurenceSymbols"; threads.Add(thread); } List <FileView> fileViews = new List <FileView>(); if (threads.Count == 0) { var fileSearch = new FileSearch(textBox_PathSearch.Text, fileName, new MinSize(0)); fileSearches.Add(fileSearch); fileSearch.Start(); foreach (var it in fileSearch.list) { fileViews.Add(new FileView(it)); } } else { foreach (var thread in threads) { thread.Start(); } foreach (var thread in threads) { thread.Join(); } List <FileView> totalFileInfos = new List <FileView>(); foreach (var fileSearch in fileSearches) { foreach (var fileInfo in fileSearch.list) { totalFileInfos.Add(new FileView(fileInfo)); } } fileViews = totalFileInfos.GroupBy(it => it.Path) .Where(pair => pair.Count() == threads.Count || threads.Count == 1) .Select(it => it.First()) .ToList(); } TableFiles.ItemsSource = fileViews; if (fileViews.Count() == 0) { MessageBox.Show("Файлов не найдено!"); } }
/// <summary> /// Modifies the specified file search. /// </summary> /// <param name="fileSearch">The file search.</param> public void Modify(FileSearch fileSearch) { fileSearch.Pattern += ";*.jsx"; }
public void Modify(FileSearch fileSearch) { fileSearch.Pattern += ";*.scss;*.sass"; }
private IQueryable <DocEntityFile> _ExecSearch(FileSearch request, DocQuery query) { request = InitSearch <File, FileSearch>(request); IQueryable <DocEntityFile> entities = null; query.Run(session => { entities = query.SelectAll <DocEntityFile>(); if (!DocTools.IsNullOrEmpty(request.FullTextSearch)) { var fts = new FileFullTextSearch(request); entities = GetFullTextSearch <DocEntityFile, FileFullTextSearch>(fts, entities); } if (null != request.Ids && request.Ids.Any()) { entities = entities.Where(en => en.Id.In(request.Ids)); } if (!DocTools.IsNullOrEmpty(request.Updated)) { entities = entities.Where(e => null != e.Updated && e.Updated.Value.Date == request.Updated.Value.Date); } if (!DocTools.IsNullOrEmpty(request.UpdatedBefore)) { entities = entities.Where(e => null != e.Updated && e.Updated <= request.UpdatedBefore); } if (!DocTools.IsNullOrEmpty(request.UpdatedAfter)) { entities = entities.Where(e => null != e.Updated && e.Updated >= request.UpdatedAfter); } if (!DocTools.IsNullOrEmpty(request.Created)) { entities = entities.Where(e => null != e.Created && e.Created.Value.Date == request.Created.Value.Date); } if (!DocTools.IsNullOrEmpty(request.CreatedBefore)) { entities = entities.Where(e => null != e.Created && e.Created <= request.CreatedBefore); } if (!DocTools.IsNullOrEmpty(request.CreatedAfter)) { entities = entities.Where(e => null != e.Created && e.Created >= request.CreatedAfter); } if (true == request.Archived?.Any() && currentUser.HasProperty(DocConstantModelName.FILE, nameof(Reference.Archived), DocConstantPermission.VIEW)) { entities = entities.Where(en => en.Archived.In(request.Archived)); } else { entities = entities.Where(en => !en.Archived); } if (true == request.Locked?.Any()) { entities = entities.Where(en => en.Locked.In(request.Locked)); } if (request.Cost.HasValue) { entities = entities.Where(en => request.Cost.Value == en.Cost); } if (!DocTools.IsNullOrEmpty(request.FileLabel)) { entities = entities.Where(en => en.FileLabel.Contains(request.FileLabel)); } if (!DocTools.IsNullOrEmpty(request.FileLabels)) { entities = entities.Where(en => en.FileLabel.In(request.FileLabels)); } if (!DocTools.IsNullOrEmpty(request.FileName)) { entities = entities.Where(en => en.FileName.Contains(request.FileName)); } if (!DocTools.IsNullOrEmpty(request.FileNames)) { entities = entities.Where(en => en.FileName.In(request.FileNames)); } if (!DocTools.IsNullOrEmpty(request.OriginalFileName)) { entities = entities.Where(en => en.OriginalFileName.Contains(request.OriginalFileName)); } if (!DocTools.IsNullOrEmpty(request.OriginalFileNames)) { entities = entities.Where(en => en.OriginalFileName.In(request.OriginalFileNames)); } if (request.Rights.HasValue) { entities = entities.Where(en => request.Rights.Value == en.Rights); } if (!DocTools.IsNullOrEmpty(request.Rightss)) { entities = entities.Where(en => en.Rights.In(request.Rightss)); } if (true == request.ScopesIds?.Any()) { entities = entities.Where(en => en.Scopes.Any(r => r.Id.In(request.ScopesIds))); } if (request.Source.HasValue) { entities = entities.Where(en => request.Source.Value == en.Source); } if (!DocTools.IsNullOrEmpty(request.Sources)) { entities = entities.Where(en => en.Source.In(request.Sources)); } if (request.Type.HasValue) { entities = entities.Where(en => request.Type.Value == en.Type); } if (!DocTools.IsNullOrEmpty(request.Types)) { entities = entities.Where(en => en.Type.In(request.Types)); } entities = ApplyFilters <DocEntityFile, FileSearch>(request, entities); if (request.Skip > 0) { entities = entities.Skip(request.Skip.Value); } if (request.Take > 0) { entities = entities.Take(request.Take.Value); } if (true == request?.OrderBy?.Any()) { entities = entities.OrderBy(request.OrderBy); } if (true == request?.OrderByDesc?.Any()) { entities = entities.OrderByDescending(request.OrderByDesc); } }); return(entities); }
/// <summary> /// Initializes a new instance of the <see cref="ReportConfiguration" /> class. /// </summary> /// <param name="reportBuilderFactory">The report builder factory.</param> /// <param name="reportFilePatterns">The report file patterns.</param> /// <param name="targetDirectory">The target directory.</param> /// <param name="historyDirectory">The history directory.</param> /// <param name="reportTypes">The report types.</param> /// <param name="sourceDirectories">The source directories.</param> /// <param name="assemblyFilters">The assembly filters.</param> /// <param name="classFilters">The class filters.</param> /// <param name="verbosityLevel">The verbosity level.</param> public ReportConfiguration( IReportBuilderFactory reportBuilderFactory, IEnumerable <string> reportFilePatterns, string targetDirectory, string historyDirectory, IEnumerable <string> reportTypes, IEnumerable <string> sourceDirectories, IEnumerable <string> assemblyFilters, IEnumerable <string> classFilters, string verbosityLevel) { if (reportBuilderFactory == null) { throw new ArgumentNullException(nameof(reportBuilderFactory)); } if (reportFilePatterns == null) { throw new ArgumentNullException(nameof(reportFilePatterns)); } if (targetDirectory == null) { throw new ArgumentNullException(nameof(targetDirectory)); } if (reportTypes == null) { throw new ArgumentNullException(nameof(reportTypes)); } if (sourceDirectories == null) { throw new ArgumentNullException(nameof(sourceDirectories)); } if (assemblyFilters == null) { throw new ArgumentNullException(nameof(assemblyFilters)); } if (classFilters == null) { throw new ArgumentNullException(nameof(classFilters)); } this.ReportBuilderFactory = reportBuilderFactory; foreach (var reportFilePattern in reportFilePatterns) { try { this.reportFiles.AddRange(FileSearch.GetFiles(reportFilePattern)); } catch (Exception) { this.failedReportFilePatterns.Add(reportFilePattern); } } this.TargetDirectory = targetDirectory; this.HistoryDirectory = historyDirectory; if (reportTypes.Any()) { this.ReportTypes = reportTypes; } else { this.ReportTypes = new[] { "Html" }; } this.SourceDirectories = sourceDirectories; this.AssemblyFilters = assemblyFilters; this.ClassFilters = classFilters; if (verbosityLevel != null) { VerbosityLevel parsedVerbosityLevel = VerbosityLevel.Verbose; this.verbosityLevelValid = Enum.TryParse <VerbosityLevel>(verbosityLevel, true, out parsedVerbosityLevel); this.VerbosityLevel = parsedVerbosityLevel; } }
public Stream OpenFileRead(string relativePath, bool allowCopyFiles, out Pack foundInPack, FileSearch searchFlags) { return OpenFileRead(relativePath, allowCopyFiles, out foundInPack, null, searchFlags); }
public void GetFiles_MultiDirectory_AllFilesFound() { var files = FileSearch.GetFiles(Path.Combine(FileManager.GetFilesDirectory(), "*", "*", "*")).ToArray(); Assert.IsTrue(files.Length >= 39); }
public Stream OpenFileRead(string relativePath, bool allowCopyFiles, out Pack foundInPack, string gameDirectory, FileSearch searchFlags, bool checkOnly, out bool found, out DateTime lastModified) { lastModified = DateTime.MinValue; if(_searchPaths.Count == 0) { idConsole.FatalError("Filesystem call made without initialization"); } if((relativePath == null) || (relativePath == string.Empty)) { idConsole.FatalError("open file read: null 'relativePath' parameter passed"); } found = false; foundInPack = null; // qpaths are not supposed to have a leading slash. relativePath = relativePath.TrimEnd('/'); // make absolutely sure that it can't back up the path. // the searchpaths do guarantee that something will always // be prepended, so we don't need to worry about "c:" or "//limbo". if((relativePath.Contains("..") == true) || (relativePath.Contains("::") == true)) { return null; } // // search through the path, one element at a time // foreach(SearchPath searchPath in _searchPaths) { if((searchPath.Directory != null) && ((searchFlags & FileSearch.SearchDirectories) == FileSearch.SearchDirectories)) { // check a file in the directory tree. // if we are running restricted, the only files we // will allow to come from the directory are .cfg files. if((idE.CvarSystem.GetBool("fs_restrict") == true) /* TODO: serverPaks.Num()*/) { if(FileAllowedFromDirectory(relativePath) == false) { continue; } } idDirectory dir = searchPath.Directory; if((gameDirectory != null) && (gameDirectory != string.Empty)) { if(dir.GameDirectory != gameDirectory) { continue; } } string netPath = CreatePath(dir.Path, dir.GameDirectory, relativePath); Stream file = null; if(File.Exists(netPath) == true) { try { file = File.OpenRead(netPath); lastModified = File.GetLastWriteTime(netPath); } catch(Exception x) { idConsole.DeveloperWriteLine("OpenFileRead Exception: {0}", x.ToString()); continue; } } if(file == null) { continue; } if(idE.CvarSystem.GetInteger("fs_debug") > 0) { idConsole.WriteLine("open file read: {0} (found in '{1}/{2}')", relativePath, dir.Path, dir.GameDirectory); } if((_loadedFileFromDir == false) && (FileAllowedFromDirectory(relativePath) == false)) { // TODO /*if(restartChecksums.Num()) { common->FatalError("'%s' loaded from directory: Failed to restart with pure mode restrictions for server connect", relativePath); }*/ idConsole.DeveloperWriteLine("filesystem: switching to pure mode will require a restart. '{0}' loaded from directory.", relativePath); _loadedFileFromDir = true; } // TODO: if fs_copyfiles is set /*if(allowCopyFiles && fs_copyfiles.GetInteger()) { idStr copypath; idStr name; copypath = BuildOSPath(fs_savepath.GetString(), dir->gamedir, relativePath); netpath.ExtractFileName(name); copypath.StripFilename(); copypath += PATHSEPERATOR_STR; copypath += name; bool isFromCDPath = !dir->path.Cmp(fs_cdpath.GetString()); bool isFromSavePath = !dir->path.Cmp(fs_savepath.GetString()); bool isFromBasePath = !dir->path.Cmp(fs_basepath.GetString()); switch(fs_copyfiles.GetInteger()) { case 1: // copy from cd path only if(isFromCDPath) { CopyFile(netpath, copypath); } break; case 2: // from cd path + timestamps if(isFromCDPath) { CopyFile(netpath, copypath); } else if(isFromSavePath || isFromBasePath) { idStr sourcepath; sourcepath = BuildOSPath(fs_cdpath.GetString(), dir->gamedir, relativePath); FILE* f1 = OpenOSFile(sourcepath, "r"); if(f1) { ID_TIME_T t1 = Sys_FileTimeStamp(f1); fclose(f1); FILE* f2 = OpenOSFile(copypath, "r"); if(f2) { ID_TIME_T t2 = Sys_FileTimeStamp(f2); fclose(f2); if(t1 > t2) { CopyFile(sourcepath, copypath); } } } } break; case 3: if(isFromCDPath || isFromBasePath) { CopyFile(netpath, copypath); } break; case 4: if(isFromCDPath && !isFromBasePath) { CopyFile(netpath, copypath); } break; } }*/ if(file != null) { found = true; } return file; } /*else if(search->pack && (searchFlags & FSFLAG_SEARCH_PAKS)) { if(!search->pack->hashTable[hash]) { continue; } // disregard if it doesn't match one of the allowed pure pak files if(serverPaks.Num()) { GetPackStatus(search->pack); if(search->pack->pureStatus != PURE_NEVER && !serverPaks.Find(search->pack)) { continue; // not on the pure server pak list } } // look through all the pak file elements pak = search->pack; if(searchFlags & FSFLAG_BINARY_ONLY) { // make sure this pak is tagged as a binary file if(pak->binary == BINARY_UNKNOWN) { int confHash; fileInPack_t* pakFile; confHash = HashFileName(BINARY_CONFIG); pak->binary = BINARY_NO; for(pakFile = search->pack->hashTable[confHash]; pakFile; pakFile = pakFile->next) { if(!FilenameCompare(pakFile->name, BINARY_CONFIG)) { pak->binary = BINARY_YES; break; } } } if(pak->binary == BINARY_NO) { continue; // not a binary pak, skip } } for(pakFile = pak->hashTable[hash]; pakFile; pakFile = pakFile->next) { // case and separator insensitive comparisons if(!FilenameCompare(pakFile->name, relativePath)) { idFile_InZip* file = ReadFileFromZip(pak, pakFile, relativePath); if(foundInPak) { *foundInPak = pak; } if(!pak->referenced && !(searchFlags & FSFLAG_PURE_NOREF)) { // mark this pak referenced if(fs_debug.GetInteger()) { common->Printf("idFileSystem::OpenFileRead: %s -> adding %s to referenced paks\n", relativePath, pak->pakFilename.c_str()); } pak->referenced = true; } if(fs_debug.GetInteger()) { common->Printf("idFileSystem::OpenFileRead: %s (found in '%s')\n", relativePath, pak->pakFilename.c_str()); } return file; } } } }*/ // TODO /*if ( searchFlags & FSFLAG_SEARCH_ADDONS ) { for ( search = addonPaks; search; search = search->next ) { assert( search->pack ); fileInPack_t *pakFile; pak = search->pack; for ( pakFile = pak->hashTable[hash]; pakFile; pakFile = pakFile->next ) { if ( !FilenameCompare( pakFile->name, relativePath ) ) { idFile_InZip *file = ReadFileFromZip( pak, pakFile, relativePath ); if ( foundInPak ) { *foundInPak = pak; } // we don't toggle pure on paks found in addons - they can't be used without a reloadEngine anyway if ( fs_debug.GetInteger( ) ) { common->Printf( "idFileSystem::OpenFileRead: %s (found in addon pk4 '%s')\n", relativePath, search->pack->pakFilename.c_str() ); } return file; } } }*/ } if(idE.CvarSystem.GetInteger("fs_debug") > 0) { idConsole.WriteLine("Can't find {0}", relativePath); } return null; }
private void btnSearch_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtSearch.Text) && String.IsNullOrEmpty(txtQRCodePath.Text)) { return; } Running = true; try { tabMain.AllowSelect = false; btnSearch.Enabled = false; btnRemove.Enabled = false; AutoResetEvent areFinish = new AutoResetEvent(false); Thread waitTime = new Thread(() => { DateTime dtStart = DateTime.Now; Invoke(new MethodInvoker(() => { toolStripStatusLabel2.Text = "正在搜索文件和解码二维码"; })); areFinish.WaitOne(); DateTime dtFinish = DateTime.Now; Invoke(new MethodInvoker(() => { toolStripStatusLabel2.Text = "搜索完成,所用时间:" + ((int)(dtFinish - dtStart).TotalSeconds).ToString("d") + "秒"; btnSearch.Enabled = true; btnRemove.Enabled = true; tabMain.AllowSelect = true; Running = false; })); }); waitTime.IsBackground = true; waitTime.Name = "计时线程"; waitTime.Start(); string source = String.Empty; if (String.IsNullOrEmpty(txtQRCodePath.Text)) { source = txtSearch.Text; } else { source = QRcodeHelper.Decode(txtQRCodePath.Text); } lvFileSearch.Items.Clear(); string Dir = txtSelectPath.Text; string SearchPattern = "*.jpg,*.png,*gif,*.bmp"; FileSearch fs = new FileSearch(Dir, SearchPattern, source, this); Thread searchFileThread = new Thread(() => { fs.Start(); areFinish.Set(); }); searchFileThread.IsBackground = true; searchFileThread.Name = "搜索主线程"; searchFileThread.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private static async Task Run() { ForegroundColor = Cyan; WriteLine($@" -----SEARCH----- 1. Search -----MANAGE----- 2. Index All 3. Index Text/Objects 4. Index Files 5. Index Media -----CONTENT----- 6. Upload and Analyse Media 7. Upload File -----DELETE----- 99. Delete Indexes, Sources and Skills Select option to continue:"); ResetColor(); var apiKey = File.ReadAllText($"{AzureCredentialsPath}/search.private-azure-key"); var mediaServicesAuth = JsonConvert.DeserializeObject <MediaServicesAuth>(File.ReadAllText($"{AzureCredentialsPath}/media.private-azure-key")); var storageKey = File.ReadAllText($"{AzureCredentialsPath}/storage.private-azure-key"); var rootPath = "../AzureSearch"; switch (ReadLine()) { case "1": SearchService .Create(apiKey, storageKey, mediaServicesAuth) .StartSearch(); break; case "2": await TextSearch .Create(apiKey, rootPath) .Index(); await FileSearch .Create(apiKey, storageKey, rootPath) .Index(); await MediaSearch .Create(apiKey, mediaServicesAuth, rootPath) .Index(); break; case "3": await TextSearch .Create(apiKey, rootPath) .Index(); break; case "4": await FileSearch .Create(apiKey, storageKey, rootPath) .Index(); break; case "5": await MediaSearch .Create(apiKey, mediaServicesAuth, rootPath) .Index(); break; case "6": await MediaSearch .Create(apiKey, mediaServicesAuth, rootPath) .AnalyseMediaAssets(); break; case "7": await FileSearch .Create(apiKey, storageKey, rootPath) .UploadFileToStorage(); break; case "99": await FileSearch .Create(apiKey, storageKey, rootPath) .Delete(); break; default: WriteLine("Invalid option selected"); break; } WriteLine($"Press any key to return to main menu"); ReadKey(); await Run(); }
public void GetFiles_SingleDirectory_XmlFilesFound() { var files = FileSearch.GetFiles(Path.Combine(FileManager.GetReportDirectory(), "*.xml")).ToArray(); Assert.AreEqual(13, files.Length); }
public void GetFiles_RelativePath_DllFound() { var files = FileSearch.GetFiles("..\\*\\*.dll").ToArray(); Assert.IsTrue(files.Any(f => f.EndsWith(this.GetType().Assembly.GetName().Name + ".dll", StringComparison.OrdinalIgnoreCase))); }
public object Post(FileSearch request) => Get(request);
/// <summary> /// Downloads the specified link near the specified video. /// </summary> /// <param name="link">The link.</param> /// <param name="episode">The episode to search for.</param> public void DownloadNearVideoOld(Subtitle link, Episode episode) { _link = link; _ep = episode; var paths = Settings.Get<List<string>>("Download Paths"); if (paths.Count == 0) { TaskDialog.Show(new TaskDialogOptions { MainIcon = VistaTaskDialogIcon.Error, Title = "Search path not configured", MainInstruction = "Search path not configured", Content = "To use this feature you must set your download path." + Environment.NewLine + Environment.NewLine + "To do so, click on the logo on the upper left corner of the application, then select 'Configure Software'. On the new window click the 'Browse' button under 'Download Path'.", AllowDialogCancellation = true, CustomButtons = new[] { "OK" } }); return; } _active = true; _tdstr = "Searching for the episode..."; var showmbp = false; var mthd = new Thread(() => TaskDialog.Show(new TaskDialogOptions { Title = "Searching...", MainInstruction = link.Release, Content = "Searching for the episode...", CustomButtons = new[] { "Cancel" }, ShowProgressBar = true, ShowMarqueeProgressBar = true, EnableCallbackTimer = true, AllowDialogCancellation = true, Callback = (dialog, args, data) => { if (!showmbp && _tdpos == 0) { dialog.SetProgressBarMarquee(true, 0); showmbp = true; } if (_tdpos > 0 && showmbp) { dialog.SetMarqueeProgressBar(false); dialog.SetProgressBarState(VistaProgressBarState.Normal); dialog.SetProgressBarPosition(_tdpos); showmbp = false; } if (_tdpos > 0) { dialog.SetProgressBarPosition(_tdpos); } dialog.SetContent(_tdstr); if (args.ButtonId != 0) { if (_active) { try { if (_fs != null) { _fs.CancelSearch(); } if (_dl != null) { _dl.CancelAsync(); } } catch { } } return false; } if (!_active) { dialog.ClickButton(500); return false; } return true; } })); mthd.SetApartmentState(ApartmentState.STA); mthd.Start(); _fs = new FileSearch(paths, _ep); _fs.FileSearchDone += NearVideoFileSearchDoneOld; _fs.FileSearchProgressChanged += NearVideoFileSearchProgressChangedOld; _fs.BeginSearch(); Utils.Win7Taskbar(state: TaskbarProgressBarState.Indeterminate); }
public void GetFiles_UncPath_NoFilesFound() { var files = FileSearch.GetFiles(@"\\DoesNotExist\*.xml").ToArray(); Assert.AreEqual(0, files.Length); }
public void GetFiles_EmptyDirectory_NoFilesFound() { var files = FileSearch.GetFiles(Path.Combine(FileManager.GetFilesDirectory(), "*")).ToArray(); Assert.AreEqual(0, files.Length); }
//public void parseGameSettingsData() //{ // // Commented temporarly by EG // try // { // if (gameSettings.data != "") // { // // parse the nData into variables // string[] parts = gameSettings.data.Split(','); // if (parts.Length != 17) // { // throw new Exception("Invalid number of parameters in settings.data string(" // + parts.Length.ToString() + ", should be 17)"); // } // maxCardDisplayMode = int.Parse(parts[0]); // bPPatternIndex = int.Parse(parts[1]); // bPPatternCount = int.Parse(parts[2]); // bPPercent = double.Parse(parts[3]); // bPSeed = decimal.Parse(parts[4]); // levelInfo[0].POSetNum = int.Parse(parts[5]); // levelInfo[1].POSetNum = int.Parse(parts[6]); // levelInfo[2].POSetNum = int.Parse(parts[7]); // levelInfo[3].POSetNum = int.Parse(parts[8]); // levelInfo[0].costMulti = int.Parse(parts[9]); // levelInfo[1].costMulti = int.Parse(parts[10]); // levelInfo[2].costMulti = int.Parse(parts[11]); // levelInfo[3].costMulti = int.Parse(parts[12]); // levelInfo[0].prizeMulti = int.Parse(parts[13]); // levelInfo[1].prizeMulti = int.Parse(parts[14]); // levelInfo[2].prizeMulti = int.Parse(parts[15]); // levelInfo[3].prizeMulti = int.Parse(parts[16]); // } // else // { // string tmpErr = "This Game has not been configured by the POS, can not continue!"; // logError(tmpErr); // MessageBox.Show(tmpErr); // Application.Exit(); // } // } // catch (Exception ex) // { // string tmpErr = "Invalid Data String in GameSettings, " + ex.Message; // logError(tmpErr); // MessageBox.Show(tmpErr); // Application.Exit(); // } //} /// <summary> /// constructor /// </summary> /// <param name="standAlone">run in standalone mode.. no db connection required</param> public Bingo(string[] args) { singleton = this; // hide the cursor //Cursor.Hide(); // new generic gameSettings data this.FormClosing += new FormClosingEventHandler(Bingo_FormClosing); Screen Srn = Screen.PrimaryScreen; tempWidth = Srn.Bounds.Width; tempHeight = Srn.Bounds.Height; StartScreen stScr = new StartScreen(); System.Console.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString()); isXP = (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor <= 1); if (isXP) { FixWidth = 1366; } stScr.Show(); //try to change resolution... bool success = false; int i = 0; do { if (i >= resArray.Length) { MessageBox.Show("None of resolutions worked for this hardware..."); Application.Exit(); return; } Resolution.CResolution ChangeRes = new Resolution.CResolution(resArray[i].X, resArray[i].Y, ref success); i++; }while (!success); moneySymbol = String.Format("{0:C}", 1.00f); moneySymbol = moneySymbol.Substring(0, moneySymbol.IndexOf("1")); terminalID = GameCore.Utility.Functions.GetMachineID(); string tmpStartupPath = Application.StartupPath; FileSearch.SetStartingSearchDirectory(tmpStartupPath + "\\Media\\"); string tmpErr = ""; //PARSE COMMAND LINE ARGS int commandLinePIN = 0; string webServiceAddress = ""; //if (args.Length >= 3) //{ // if (args[1].Contains("http")) // { // webServiceAddress = args[1].ToString(); // } // else // { // tmpErr = "Invalid command line WEB Service Address: " + args[1].Trim() + ", terminating Program!"; // Logger.Log(tmpErr); // Bingo.singleton.CloseApplication(tmpErr); // return; // } // // get the installed Game ID from the command line // try // { // commandLinePIN = int.Parse(args[0].Trim()); // } // catch // { // tmpErr = "Invalid command line PIN: " + args[0].Trim() + ", terminating Program!"; // Logger.Log(tmpErr); // commandLinePIN = 0; // Bingo.singleton.CloseApplication(tmpErr); // return; // } //} //else //{ // tmpErr = "Invalid command line Params, terminating Program!"; // Logger.Log(tmpErr); // Bingo.singleton.CloseApplication(tmpErr); // return; //} //=============================== //global::BreakTheBankTabs1063.Properties.Settings.Default.MagicTouchTabs1034_WEBService_Service = webServiceAddress; //// ******* CONNECT TO THE DATABASE... *********************** //// CONNECT TO DATABASE SERVICE //if (service == null) //{ // int tries = 0; // while (tries < 5) // { // service = new WEBService.Service(); // if (service != null) // { // service.Timeout = 10000; // break; // } // Logger.Log("Attempt to connect to WEB Service #" + tries.ToString() + " failed!"); // tries++; // } // if (service == null) // { // Logger.Log("ALL Attempts to connect to WEB Service failed, Closing Application!"); // Bingo.singleton.CloseApplication("Error Connecting to WEB Service"); // } //} //try //{ // // sync with server date and time // setLocalTime.SYSTEMTIME tmpTime = new setLocalTime.SYSTEMTIME(); // tmpTime.FromDateTime(service.getServerDateTime()); // setLocalTime.SetLocalTime(ref tmpTime); //} //catch (Exception ex) //{ // tmpErr = "Exception connecting to WEB Service calling 'service.getServerDateTime()' " // + "Possibly Launcher passed incorrect WEB Service Address, CANNOT CONTINUE!\n\r" + ex.Message; // Logger.Log(tmpErr); // Bingo.singleton.CloseApplication(tmpErr); // return; //} // get the EGM status curEGMData = new WEBService.EGMTerminals(); // get serial number from command line //serialNum = args[2]; //curEGMData.serialNum = serialNum; //if (curEGMData.terminalID == "0") //{ // // could not get just created EGMTerminals record // tmpErr = service.lastError(); // if (tmpErr == "") // { // tmpErr = "Could not get EGMTerminals record for this Unit (TerminalID = " + terminalID.ToString() + "), terminating Program!"; // } // logError(tmpErr); // Bingo.singleton.CloseApplication(tmpErr); // return; //} // now get the system settings settings = new WEBService.Settings(); settings.verifyWinAmt = 1000; //gameSettings = service.getGameSettings(""); //parseGameSettingsData(); // now get command line PIN data //if (commandLinePIN == settings.demoPIN) //{ // usingDemoPIN = true; // curPIN.PIN = settings.demoPIN; // curPIN.balance = settings.demoAmt; // curPIN.playing = true; // curPIN.playingAt = curEGMData.terminalID; // curPIN.transactionID = 0; // curPIN.netSeconds = (int)Math.Round((settings.demoAmt * 100) / settings.penniesPerMinute); // curPIN.winBalance = 0M; //} //else { curPIN = new WEBService.PINs(); curPIN.balance = 200; ////////////////////////////////////////////////////////////////////// // curPIN.netSeconds = 0; // curPIN.winBalance = 0M; //////////////////////////////////////////////////////////////////// //if (curPIN.PIN == 0) //{ // // command line PIN not found // tmpErr = service.lastError(); // if (tmpErr == "") // { // tmpErr = "Could not get PINs record for PIN " + commandLinePIN.ToString() + ", can not continue!"; // } // logError(tmpErr); // Bingo.singleton.CloseApplication(tmpErr); // return; //} } guiManager = new GuiManager(); // frmWinVerification = new WinVerification(); // Logger.Log("Finished 'Bingo(string[] args)'"); }