Exemplo n.º 1
0
		protected virtual void Dispose(bool isDisposing)
		{
			Logger.LogInfo("EMAILTRACKING: Disposing Mail Selection - " + isDisposing);
			if (isDisposing)
			{
				GC.SuppressFinalize(this);
            }

            if (_inspector != null)
                Marshal.ReleaseComObject(_inspector);

            if (_explorer != null)
                Marshal.ReleaseComObject(_explorer);

            if (_ns != null)
                Marshal.ReleaseComObject(_ns);

            if (_outlookApplication != null)
                Marshal.ReleaseComObject(_outlookApplication);

            _inspector = null;
			_explorer = null;
			_ns = null;
            _outlookApplication = null;
		}
Exemplo n.º 2
0
        private void AddFiles(String itemPath)
        {
            Boolean isFolder = File.GetAttributes(itemPath) == FileAttributes.Directory;
            FileInfo fileInfo = new FileInfo(itemPath);
            DirectoryInfo dirInfo = new DirectoryInfo(itemPath);

            String imageKey;
            Explorer explorerImages = new Explorer();

            if (isFolder)
            {
                imageKey = "folder.png";
                filesListView.Items.Add(new ListViewItem(new String[] { fileInfo.Name, "Folder", fileInfo.FullName }, imageKey));
            }
            else
            {
                imageKey = fileInfo.Extension;

                if (!imageList.Images.ContainsKey(imageKey))
                {
                    explorerImages.AddFileIcons(imageKey, imageList);
                }

                filesListView.Items.Add(new ListViewItem(new String[] { fileInfo.Name, fileInfo.Extension, fileInfo.FullName, (fileInfo.Length / 1024).ToString() + " KB" }, imageKey));
            }
        }
Exemplo n.º 3
0
        public ExplorerWrapper(Explorer explorer)
        {
            _explorer = explorer;
            ((ExplorerEvents_Event)_explorer).Close += ExplorerWrapper_Close;

            taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new TaskPaneControl("Explorer", _count++), "My task pane", _explorer);
            taskPane.VisibleChanged += TaskPane_VisibleChanged;
        }
Exemplo n.º 4
0
		public MailSelection()
		{
            _outlookApplication = new Application();
            _ns = _outlookApplication.GetNamespace("MAPI");
            _inspector = _outlookApplication.ActiveInspector();
            _explorer = _outlookApplication.ActiveExplorer();
			Logger.LogInfo("EMAILTRACKING: Initialised Mail Selection");
		}
Exemplo n.º 5
0
        private void ExplorerClose()
        {
            ((ExplorerEvents_10_Event)Explorer).Close -= ExplorerClose;

            var handler = Closed;
            if (handler != null) 
                Closed(this, new ExplorerEventArgs(Explorer));
            Explorer = null;
        }
Exemplo n.º 6
0
 private void ToggleExplorer(RibbonToggleButton button, Explorer explorer)
 {
     if (explorer == null) return;
     var inspectorWrapper = Globals.ThisAddIn.ExplorerWrappers[explorer];
     CustomTaskPane taskPane = inspectorWrapper.CustomTaskPane;
     if (taskPane != null)
     {
         taskPane.Visible = button.Checked;
     }
 }
Exemplo n.º 7
0
        private void Add(Explorer explorerImages, string f)
        {
            FileInfo fileInfo = new FileInfo(f);
            String imageKey = fileInfo.Extension;

            if (!imageList.Images.ContainsKey(imageKey))
            {
                explorerImages.AddFileIcons(imageKey, imageList);
            }
            searchListView.Items.Add(new ListViewItem(new String[] { fileInfo.Name, fileInfo.Extension, fileInfo.FullName, (fileInfo.Length / 1024).ToString() + " KB" }, imageKey));
        }
        void NewExplorer(Explorer explorer)
        {
            var wrapper = new ExplorerWrapper(explorer);
            wrapper.Closed += ExplorerClosed;

            var newViewEventArgs = new NewViewEventArgs(explorer, explorer, OutlookRibbonType.OutlookExplorer.GetEnumDescription());
            NewView(this, newViewEventArgs);

            if (!newViewEventArgs.Handled)
                explorer.ReleaseComObject();
        }
Exemplo n.º 9
0
    // bool isInit = false;
    // virtual public void Init(WeaponParameter _parameter, Robot _robot)
    // {
    // 	weaponParameter = _parameter;
    // 	robot = _robot;
    // 	if ( explorer != null )
    // 		explorer.Init(_robot);
    // 	isInit = true;
    // }
    public override void Init(DataRow data, Robot _robot)
    {
        type = Type.Weapon;
        weaponParameter =  DataManager.Instance.GetWeaponParameter( data );

        if (explorer == null )
        {
            explorer =  transform.GetComponentInChildren<Explorer>();
        }
        if ( explorer != null )
            explorer.Init(_robot,weaponParameter);

        base.Init(data, _robot);
    }
Exemplo n.º 10
0
        private void ExplorerWrapper_Close()
        {
            if (taskPane != null)
            {
                Globals.ThisAddIn.CustomTaskPanes.Remove(taskPane);
            }

            taskPane = null;
            Globals.ThisAddIn.ExplorerWrappers.Remove(_explorer);

            ((ExplorerEvents_Event)_explorer).Close -= ExplorerWrapper_Close;

            _explorer = null;
        }
Exemplo n.º 11
0
 private void OutlookTfsAddInStartup(object sender, EventArgs e)
 {
     _explorer = Application.ActiveExplorer();
     _container = new SimpleContainer() 
         .RegisterSingle(_explorer)
         .Register<TfsConnection>(container => TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(TfsServer)))
         .Register<IView>(container => new NewWorkItem())
         .Register<AppViewModel>(container => new AppViewModel())
         .Register<IPresenter>(container => new Presenter
         {
             View = container.Create<IView>(),
             ViewModel = container.Create<AppViewModel>()
         });
     // when an email selection changes this event will fire
     _explorer.SelectionChange += ExplorerSelectionChange;
 }
Exemplo n.º 12
0
 public ExplWrap(Explorer explorer)
 {
     const string SOURCE = CLASS_NAME + ".ctor";
     if (explorer == null) { return; }
     Key = Guid.NewGuid().ToString();
     Logger.Info(SOURCE,"initializing new ExplWrap with key " + Key);
     Explorer = explorer;
     var folder = Explorer.CurrentFolder;
     FolderId = folder.EntryID;
     StoreId = folder.StoreID;
     _timer = new Timer(TimerCallback);
     if (folder != null)
     {
         if (folder.DefaultItemType == OlItemType.olMailItem)
         {
             //launch async process to update message class on ECS messages
             _timer.Change(0, Settings.Default.TimerDelay);
         }
     }
     if (ThisAddIn.AppVersion >= 14) return;
     Logger.Info(SOURCE, "calling AddMenuOptions");
     //add Configuration option to menu
     AddMenuOptions();
 }
Exemplo n.º 13
0
 PakExplorer(Explorer Parent, string Loc) : this()
 {
     this.Parent   = Parent;
     this.Location = Path.Combine(Parent?.Location ?? string.Empty, Loc);
 }
Exemplo n.º 14
0
 private void OpenFile(object input)
 {
     Explorer.OpenFile((string)input);
 }
Exemplo n.º 15
0
 public void Initialize(Explorer explorer)
 {
     this.explorer = explorer;
 }
Exemplo n.º 16
0
 PakExplorer(Explorer Parent, FFileIndex Index, string Loc) : this(Parent, Loc)
 {
     Task.Run(() => ParseFileIndex(Index));
 }
 private void CloudFoundryExplorer(object sender, EventArgs e)
 {
     var window = new Explorer();
     var helper = new WindowInteropHelper(window);
     helper.Owner = (IntPtr)(dte.MainWindow.HWnd);
     window.ShowDialog();
 }
Exemplo n.º 18
0
 public void Cleanup()
 {
     explorer = null;
 }
Exemplo n.º 19
0
 protected override void OnThemeApplied()
 {
     base.OnThemeApplied();
     Explorer.ApplyTheme(_graph);
 }
Exemplo n.º 20
0
        private static void Main()
        {
            ConfigLogger.Instance.LogDebug("Checking to see if there is an instance running.");
            if (IsAlreadyRunning())
            {
                // let the user know the program is already running.
                ConfigLogger.Instance.LogWarning("Instance is already running, exiting.");
                MessageBox.Show(Resources.ProgramIsAlreadyRunning, Resources.ProgramIsAlreadyRunningCaption,
                                MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else
            {
                if (!IsOutlook2003OrHigherInstalled())
                {
                    ConfigLogger.Instance.LogDebug("Outlook is not avaliable or installed.");
                    MessageBox.Show(
                        Resources.Office2000Requirement + Environment.NewLine +
                        Resources.InstallOutlookMsg, Resources.MissingRequirementsCapation, MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }

                try
                {
                    OutlookApp = new Application();
                    OutlookNameSpace = OutlookApp.GetNamespace("MAPI");
                    OutlookFolder = OutlookNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);

                    // WORKAROUND: Beginning wih Outlook 2007 SP2, Microsoft decided to kill all outlook instances
                    // when opening and closing an item from the view control, even though the view control was still running.
                    // The only way I've found to work around it and keep the view control from crashing after opening an item,
                    // is to get this global instance of the active explorer and keep it going until the user closes the app.
                    OutlookExplorer = OutlookFolder.GetExplorer();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Resources.ErrorInitializingApp + ' ' + ex, Resources.ErrorCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                System.Windows.Forms.Application.EnableVisualStyles();

                ConfigLogger.Instance.LogInfo("Starting the instance manager and loading instances.");
                var instanceManager = new InstanceManager();
                instanceManager.LoadInstances();

                System.Windows.Forms.Application.Run(instanceManager);
            }
        }
Exemplo n.º 21
0
 private void ctlConfigLinkPathOpen_Click(object sender, RoutedEventArgs e)
 {
     Explorer.Open(ConfigManager.Instance.UrlLinkPath);
 }
Exemplo n.º 22
0
 private void ctlConfigDownloadPathOpen_Click(object sender, RoutedEventArgs e)
 {
     Explorer.Open(ConfigManager.Instance.SavePath);
 }
Exemplo n.º 23
0
        public ServerTester(string directory)
        {
            SetEnvironment();
            try
            {
                var rootTestData = "TestData";
                directory  = Path.Combine(rootTestData, directory);
                _Directory = directory;
                if (!Directory.Exists(rootTestData))
                {
                    Directory.CreateDirectory(rootTestData);
                }

                var cryptoSettings = new NBXplorerNetworkProvider(NetworkType.Regtest).GetFromCryptoCode(CryptoCode);
                NodeBuilder = NodeBuilder.Create(nodeDownloadData, Network, directory);


                User1    = NodeBuilder.CreateNode();
                User2    = NodeBuilder.CreateNode();
                Explorer = NodeBuilder.CreateNode();
                foreach (var node in NodeBuilder.Nodes)
                {
                    node.WhiteBind  = true;
                    node.CookieAuth = cryptoSettings.SupportCookieAuthentication;
                }
                NodeBuilder.StartAll();

                User1.CreateRPCClient().Generate(1);
                User1.Sync(Explorer, true);
                Explorer.CreateRPCClient().Generate(1);
                Explorer.Sync(User2, true);
                User2.CreateRPCClient().EnsureGenerate(Network.Consensus.CoinbaseMaturity + 1);
                User1.Sync(User2, true);

                var port    = CustomServer.FreeTcpPort();
                var datadir = Path.Combine(directory, "explorer");
                DeleteFolderRecursive(datadir);
                List <(string key, string value)> keyValues = new List <(string key, string value)>();
                keyValues.Add(("conf", Path.Combine(directory, "explorer", "settings.config")));
                keyValues.Add(("datadir", datadir));
                keyValues.Add(("port", port.ToString()));
                keyValues.Add(("network", "regtest"));
                keyValues.Add(("chains", CryptoCode.ToLowerInvariant()));
                keyValues.Add(("verbose", "1"));
                keyValues.Add(($"{CryptoCode.ToLowerInvariant()}rpcauth", Explorer.GetRPCAuth()));
                keyValues.Add(($"{CryptoCode.ToLowerInvariant()}rpcurl", Explorer.CreateRPCClient().Address.AbsoluteUri));
                keyValues.Add(("cachechain", "0"));
                keyValues.Add(("rpcnotest", "1"));
                keyValues.Add(("mingapsize", "3"));
                keyValues.Add(("maxgapsize", "8"));
                keyValues.Add(($"{CryptoCode.ToLowerInvariant()}startheight", Explorer.CreateRPCClient().GetBlockCount().ToString()));
                keyValues.Add(($"{CryptoCode.ToLowerInvariant()}nodeendpoint", $"{Explorer.Endpoint.Address}:{Explorer.Endpoint.Port}"));
                keyValues.Add(("asbcnstr", AzureServiceBusTestConfig.ConnectionString));
                keyValues.Add(("asbblockq", AzureServiceBusTestConfig.NewBlockQueue));
                keyValues.Add(("asbtranq", AzureServiceBusTestConfig.NewTransactionQueue));
                keyValues.Add(("asbblockt", AzureServiceBusTestConfig.NewBlockTopic));
                keyValues.Add(("asbtrant", AzureServiceBusTestConfig.NewTransactionTopic));

                var args = keyValues.SelectMany(kv => new[] { $"--{kv.key}", kv.value }).ToArray();
                Host = new WebHostBuilder()
                       .UseConfiguration(new DefaultConfiguration().CreateConfiguration(args))
                       .UseKestrel()
                       .ConfigureLogging(l =>
                {
                    l.SetMinimumLevel(LogLevel.Information)
                    .AddFilter("Microsoft", LogLevel.Error)
                    .AddFilter("Hangfire", LogLevel.Error)
                    .AddFilter("NBXplorer.Authentication.BasicAuthenticationHandler", LogLevel.Critical)
                    .AddProvider(Logs.LogProvider);
                })
                       .UseStartup <Startup>()
                       .Build();

                RPC = ((RPCClientProvider)Host.Services.GetService(typeof(RPCClientProvider))).GetRPCClient(CryptoCode);
                var nbxnetwork = ((NBXplorerNetworkProvider)Host.Services.GetService(typeof(NBXplorerNetworkProvider))).GetFromCryptoCode(CryptoCode);
                Network = nbxnetwork.NBitcoinNetwork;
                var conf = (ExplorerConfiguration)Host.Services.GetService(typeof(ExplorerConfiguration));
                Host.Start();
                Configuration = conf;
                _Client       = new ExplorerClient(nbxnetwork, Address);
                _Client.SetCookieAuth(Path.Combine(conf.DataDir, ".cookie"));
                this.Client.WaitServerStarted();
            }
            catch
            {
                Dispose();
                throw;
            }
        }
Exemplo n.º 24
0
 /// <summary>
 /// New super file with its explorer.
 /// </summary>
 /// <param name="explorer">The file's explorer.</param>
 /// <param name="file">The base file.</param>
 public SuperFile(Explorer explorer, FarFile file)
     : base(file)
 {
     _Explorer = explorer ?? throw new ArgumentNullException("explorer");
 }
Exemplo n.º 25
0
 internal static Explorer ExploreSuperDirectory(Explorer explorer, ExplorerModes mode, FarFile file)
 {
     try
     {
         if (explorer.CanExploreLocation)
             return explorer.ExploreLocation(new ExploreLocationEventArgs(mode, file.Name));
         else
             return explorer.ExploreDirectory(new ExploreDirectoryEventArgs(mode, file));
     }
     catch (Exception ex)
     {
         FarNet.Log.TraceException(ex);
         return null;
     }
 }
Exemplo n.º 26
0
 private void generationDirectory_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     Explorer explorer = new Explorer(codeGenerationPath.Text);
     explorer.Open();
 }
        public CalDavSynchronizerToolBar(Explorer explorer, object missing, bool wireClickEvents)
        {
            _toolBar = explorer.CommandBars.Add("CalDav Synchronizer", MsoBarPosition.msoBarTop, false, true);

            _toolBarBtnOptions         = (CommandBarButton)_toolBar.Controls.Add(1, missing, missing, missing, missing);
            _toolBarBtnOptions.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            _toolBarBtnOptions.Caption = Strings.Get($"Synchronization Profiles");
            _toolBarBtnOptions.FaceId  = 222; // builtin icon: hand hovering above a property list
            _toolBarBtnOptions.Tag     = Strings.Get($"View or set CalDav Synchronization profiles");
            if (wireClickEvents)
            {
                _toolBarBtnOptions.Click += ToolBarBtn_Options_OnClick;
            }


            _toolBarBtnGeneralOptions         = (CommandBarButton)_toolBar.Controls.Add(1, missing, missing, missing, missing);
            _toolBarBtnGeneralOptions.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            _toolBarBtnGeneralOptions.Caption = Strings.Get($"General Options");
            _toolBarBtnGeneralOptions.FaceId  = 222; // builtin icon: hand hovering above a property list
            _toolBarBtnGeneralOptions.Tag     = Strings.Get($"View or set CalDav Synchronizer general options");
            if (wireClickEvents)
            {
                _toolBarBtnGeneralOptions.Click += ToolBarBtn_GeneralOptions_OnClick;
            }

            _toolBarBtnSyncNow         = (CommandBarButton)_toolBar.Controls.Add(1, missing, missing, missing, missing);
            _toolBarBtnSyncNow.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            _toolBarBtnSyncNow.Caption = Strings.Get($"Synchronize now");
            _toolBarBtnSyncNow.FaceId  = 107; // builtin icon: lightning hovering above a calendar table
            _toolBarBtnSyncNow.Tag     = Strings.Get($"Start a manual synchronization of all active profiles.");
            if (wireClickEvents)
            {
                _toolBarBtnSyncNow.Click += ToolBarBtn_SyncNow_OnClick;
            }

            _toolBarBtnAboutMe         = (CommandBarButton)_toolBar.Controls.Add(1, missing, missing, missing, missing);
            _toolBarBtnAboutMe.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            _toolBarBtnAboutMe.Caption = Strings.Get($"About");
            _toolBarBtnAboutMe.FaceId  = 487; // builtin icon: blue round sign with "i" letter
            _toolBarBtnAboutMe.Tag     = Strings.Get($"About CalDav Synchronizer");
            if (wireClickEvents)
            {
                _toolBarBtnAboutMe.Click += ToolBarBtn_About_OnClick;
            }

            _toolBarBtnReports         = (CommandBarButton)_toolBar.Controls.Add(1, missing, missing, missing, missing);
            _toolBarBtnReports.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            _toolBarBtnReports.Caption = Strings.Get($"Reports");
            _toolBarBtnReports.FaceId  = 433; // builtin icon: statistics
            _toolBarBtnReports.Tag     = Strings.Get($"Show reports of last sync runs.");
            if (wireClickEvents)
            {
                _toolBarBtnReports.Click += ToolBarBtn_Reports_OnClick;
            }

            _toolBarBtnStatus         = (CommandBarButton)_toolBar.Controls.Add(1, missing, missing, missing, missing);
            _toolBarBtnStatus.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            _toolBarBtnStatus.Caption = Strings.Get($"Status");
            _toolBarBtnStatus.FaceId  = 433; // builtin icon: statistics
            _toolBarBtnStatus.Tag     = Strings.Get($"Show status of sync runs.");
            if (wireClickEvents)
            {
                _toolBarBtnStatus.Click += ToolBarBtn_Status_OnClick;
            }

            _toolBar.Visible = true;
        }
 private void explorers_NewExplorer(Explorer Explorer)
 {
     log.Info("Detected new Explorer window.");
     watchForPasteEvents(Explorer);
 }
Exemplo n.º 29
0
 private void ExplorersNewExplorer(Explorer explorer)
 {
     //add to list
     AddWrapper(explorer);
 }
Exemplo n.º 30
0
 public MyPanel(Explorer explorer)
     : base(explorer)
 {
     SortMode = PanelSortMode.FullName;
     ViewMode = PanelViewMode.Descriptions;
 }
Exemplo n.º 31
0
        private void BuildUI()
        {
            _desktop = new Desktop();

            _ui = new StudioWidget();

            _ui._menuFileNew.Selected          += NewItemOnClicked;
            _ui._menuFileOpen.Selected         += OpenItemOnClicked;
            _ui._menuFileSave.Selected         += SaveItemOnClicked;
            _ui._menuFileSaveAs.Selected       += SaveAsItemOnClicked;
            _ui._menuFileExportToCS.Selected   += ExportCsItemOnSelected;
            _ui._menuFileDebugOptions.Selected += DebugOptionsItemOnSelected;
            _ui._menuFileQuit.Selected         += QuitItemOnDown;

            _ui._menuControlsAddButton.Selected += (s, a) =>
            {
                AddStandardControl <Button>();
            };
            _ui._menuControlsAddCheckBox.Selected += (s, a) =>
            {
                AddStandardControl <CheckBox>();
            };
            _ui._menuControlsAddImageButton.Selected += (s, a) =>
            {
                AddStandardControl <ImageButton>();
            };
            _ui._menuControlsAddTextButton.Selected += (s, a) =>
            {
                AddStandardControl <TextButton>();
            };
            _ui._menuControlsAddHorizontalSlider.Selected += (s, a) =>
            {
                AddStandardControl <HorizontalSlider>();
            };
            _ui._menuControlsAddVerticalSlider.Selected += (s, a) =>
            {
                AddStandardControl <VerticalSlider>();
            };
            _ui._menuControlsAddHorizontalProgressBar.Selected += (s, a) =>
            {
                AddStandardControl <HorizontalProgressBar>();
            };
            _ui._menuControlsAddVerticalProgressBar.Selected += (s, a) =>
            {
                AddStandardControl <VerticalProgressBar>();
            };
            _ui._menuControlsAddComboBox.Selected += (s, a) =>
            {
                AddStandardControl <ComboBox>();
            };
            _ui._menuControlsAddListBox.Selected += (s, a) =>
            {
                AddStandardControl <ListBox>();
            };
            _ui._menuControlsAddPanel.Selected += (s, a) =>
            {
                AddStandardControl <Myra.Graphics2D.UI.Panel>();
            };
            _ui._menuControlsAddGrid.Selected += (s, a) =>
            {
                AddStandardControl <Grid>();
            };
            _ui._menuControlsAddImage.Selected += (s, a) =>
            {
                AddStandardControl <Image>();
            };
            _ui._menuControlsAddHorizontalMenu.Selected += (s, a) =>
            {
                AddStandardControl(new HorizontalMenu());
            };
            _ui._menuControlsAddVerticalMenu.Selected += (s, a) =>
            {
                AddStandardControl(new VerticalMenu());
            };
            _ui._menuControlsAddScrollPane.Selected += (s, a) =>
            {
                AddStandardControl <ScrollPane>();
            };
            _ui._menuControlsAddHorizontalSplitPane.Selected += (s, a) =>
            {
                AddStandardControl(new HorizontalSplitPane());
            };
            _ui._menuControlsAddVerticalSplitPane.Selected += (s, a) =>
            {
                AddStandardControl(new VerticalSplitPane());
            };
            _ui._menuControlsAddTextBlock.Selected += (s, a) =>
            {
                AddStandardControl <TextBlock>();
            };
            _ui._menuControlsAddTextField.Selected += (s, a) =>
            {
                AddStandardControl <TextField>();
            };
            _ui._menuControlsAddSpinButton.Selected += (s, a) =>
            {
                AddStandardControl <SpinButton>();
            };
            _ui._menuControlsAddMenuItem.Selected += (s, a) =>
            {
                AddMenuItem(new MenuItem());
            };
            _ui._menuControlsAddMenuSeparator.Selected += (s, a) =>
            {
                AddMenuItem(new MenuSeparator());
            };

            if (_customWidgetTypes != null && _customWidgetTypes.Length > 0)
            {
                _ui._menuControls.Items.Add(new MenuSeparator());

                var customMenuWidgets = new List <MenuItem>();
                foreach (var type in _customWidgetTypes)
                {
                    var item = new MenuItem
                    {
                        Text = "Add " + type.Name
                    };

                    item.Selected += (s, a) =>
                    {
                        AddStandardControl(type);
                    };

                    _ui._menuControls.Items.Add(item);

                    customMenuWidgets.Add(item);
                }

                _customWidgetMenuItems = customMenuWidgets.ToArray();
            }

            _ui._menuControls.Items.Add(new MenuSeparator());

            _deleteItem = new MenuItem
            {
                Text = "Delete"
            };
            _deleteItem.Selected += DeleteItemOnSelected;

            _ui._menuControls.Items.Add(_deleteItem);

            _ui._menuHelpAbout.Selected += AboutItemOnClicked;

            _explorer = new Explorer();
            _explorer.Tree.SelectionChanged += WidgetOnSelectionChanged;
            _ui._explorerHolder.Widgets.Add(_explorer);

            _propertyGrid = new PropertyGrid();
            _propertyGrid.PropertyChanged    += PropertyGridOnPropertyChanged;
            _propertyGrid.ColorChangeHandler += ColorChangeHandler;

            _ui._propertyGridPane.Widget = _propertyGrid;

            _ui._topSplitPane.SetSplitterPosition(0, _state != null ? _state.TopSplitterPosition : 0.75f);
            _ui._rightSplitPane.SetSplitterPosition(0, _state != null ? _state.RightSplitterPosition : 0.5f);

            _desktop.Widgets.Add(_ui);

            _statisticsGrid = new Grid
            {
                Visible = false
            };

            _statisticsGrid.RowsProportions.Add(new Grid.Proportion());
            _statisticsGrid.RowsProportions.Add(new Grid.Proportion());
            _statisticsGrid.RowsProportions.Add(new Grid.Proportion());

            _gcMemoryLabel = new TextBlock
            {
                Text = "GC Memory: ",
                Font = DefaultAssets.FontSmall
            };
            _statisticsGrid.Widgets.Add(_gcMemoryLabel);

            _fpsLabel = new TextBlock
            {
                Text          = "FPS: ",
                Font          = DefaultAssets.FontSmall,
                GridPositionY = 1
            };

            _statisticsGrid.Widgets.Add(_fpsLabel);

            _widgetsCountLabel = new TextBlock
            {
                Text          = "Total Widgets: ",
                Font          = DefaultAssets.FontSmall,
                GridPositionY = 2
            };

            _statisticsGrid.Widgets.Add(_widgetsCountLabel);

            _drawCallsLabel = new TextBlock
            {
                Text          = "Draw Calls: ",
                Font          = DefaultAssets.FontSmall,
                GridPositionY = 3
            };

            _statisticsGrid.Widgets.Add(_drawCallsLabel);

            _statisticsGrid.HorizontalAlignment = HorizontalAlignment.Left;
            _statisticsGrid.VerticalAlignment   = VerticalAlignment.Bottom;
            _statisticsGrid.XHint = 10;
            _statisticsGrid.YHint = -10;
            _desktop.Widgets.Add(_statisticsGrid);

            UpdateEnabled();
        }
 public void Initialised(object context)
 {
     explorer = (Explorer)CurrentView;
     explorer.SelectionChange += ExplorerOnSelectionChange;
 }
        // [Hack] Assumption :: getItemCount() always gets called before other get* callbacks
        public int catGallery_getItemCount(Office.IRibbonControl control)
        {
            if (objNameSpace == null)
            {
                objNameSpace = Globals.ThisAddIn.Application.GetNamespace("MAPI");
            }

            // Check the categories which are already set on the selected items
            catsAllHave  = new HashSet <String>();
            catsSomeHave = new HashSet <String>();
            if (control.Id == "SetCategory")
            {
                // Explorer window
                ex = Globals.ThisAddIn.Application.ActiveExplorer();
                if (ex != null)
                {
                    int       itemnum     = 0;
                    Selection convHeaders = ex.Selection.GetSelection(OlSelectionContents.olConversationHeaders) as Selection;
                    if (convHeaders.Count > 0)
                    {
                        // If a conversation header is selected, we'll examine/set "always set" categories on a conversation
                        foreach (ConversationHeader item in convHeaders)
                        {
                            String[] cats = cSplit(getCat(item));
                            foreach (String cat in cats)
                            {
                                catsSomeHave.Add(cat);
                            }
                            if (itemnum++ == 0)
                            {
                                foreach (String cat in cats)
                                {
                                    catsAllHave.Add(cat);
                                }
                            }
                            catsAllHave.RemoveWhere(cat => !cats.Contains <String>(cat));
                        }
                    }
                    else
                    {
                        // If conversation header is not selected, we'll examine/set categories on individual items
                        foreach (Object item in ex.Selection)
                        {
                            String[] cats = cSplit(getCat(item));
                            foreach (String cat in cats)
                            {
                                catsSomeHave.Add(cat);
                            }
                            if (itemnum++ == 0)
                            {
                                foreach (String cat in cats)
                                {
                                    catsAllHave.Add(cat);
                                }
                            }
                            catsAllHave.RemoveWhere(cat => !cats.Contains <String>(cat));
                        }
                    }
                }
            }
            else
            {
                // Inspector window
                Inspector ix   = Globals.ThisAddIn.Application.ActiveInspector();
                String[]  cats = cSplit(getCat(ix.CurrentItem));
                foreach (String cat in cats)
                {
                    catsAllHave.Add(cat);
                }
            }

            // Sort the categories and save for later access by get* methods
            sorted_cats = from Category cat in objNameSpace.Categories orderby cat.Name select cat;

            return(objNameSpace.Categories.Count);
        }
Exemplo n.º 34
0
        public async Task Handle(string[] args, CallbackQuery query)
        {
            var page    = args.GetInt(1);
            var userId  = query.From.Id;
            var address = args[0];

            var userAddress = await Db.Set <UserAddress>()
                              .SingleOrDefaultAsync(x => x.Address == address && x.UserId == userId);

            if (userAddress == null)
            {
                throw new ArgumentException($"Address {args[0]} not found");
            }

            var user = await Db.Users.ByIdAsync(userAddress.UserId);

            var pager = TransactionsRepository.GetPage(userAddress.Address, page, takePerPage);

            var message = new MessageBuilder()
                          .AddLine(
                lang.Get(
                    Res.AddressTransactionListTitle,
                    user.Language,
                    new { addressName = userAddress.DisplayName() }
                    )
                )
                          .AddEmptyLine()
                          .WithHashTag("transaction_list")
                          .WithHashTag(userAddress);

            foreach (var tx in pager.Items)
            {
                var isReceive = tx.Target.address == address;
                var txAddress = isReceive ? tx.Sender : tx.Target;
                var data      = new TemplateData
                {
                    Hash        = tx.Hash,
                    Icon        = BuildIcon(tx),
                    Amount      = Utils.AmountToString(tx.Amount / TezosDecimals, null),
                    AddressName = txAddress.DisplayName(),
                    Address     = txAddress.address,
                    Timestamp   = tx.Timestamp.ToLocaleString(user.Language),
                    Explorer    = Explorer.FromId(user.Explorer),
                    IsReceive   = isReceive,
                };

                if (tx.Parameter?.entrypoint != null)
                {
                    if (tx.Parameter.entrypoint == "transfer")
                    {
                        if (tx.Parameter.value is JArray param)
                        {
                            var tokenId = param[0]["txs"]?[0]?["token_id"]?.Value <int>();
                            if (tokenId is null)
                            {
                                continue;
                            }
                            var token = await TokenService.GetToken(tx.Target.address, (int)tokenId);

                            var amount = param[0]["txs"]?[0]?["amount"]?.Value <decimal>();
                            var target = param[0]["txs"]?[0]?["to_"]?.Value <string>();

                            if (token != null && amount != null && target != null)
                            {
                                data.AddressName = target.ShortAddr();
                                data.Address     = target;
                                data.Amount      = Utils.AmountToString((decimal)amount, token);
                            }
                        }
                    }
                    else
                    {
                        continue;
                    }
                }


                message.AddLine(lang.Get(Res.AddressTransactionListItem, user.Language, data));
            }

            await Bot.EditText(
                query.From.Id,
                query.Message.MessageId,
                message.Build(!userAddress.User.HideHashTags),
                parseMode : ParseMode.Html,
                disableWebPagePreview : true,
                replyMarkup : BuildKeyboard()
                );

            string BuildIcon(Transaction transaction)
            {
                if (transaction.Sender.address == address)
                {
                    return("➖");
                }
                if (transaction.Target.address == address)
                {
                    return("➕");
                }
                return("?");
            }

            InlineKeyboardMarkup BuildKeyboard()
            {
                var callback = $"address-transaction-list {userAddress.Address}";

                if (pager.Page == 1 && !pager.HasNext)
                {
                    return(new InlineKeyboardMarkup(
                               InlineKeyboardButton.WithCallbackData(
                                   lang.Get(Res.AddressTransactionListRefresh, user.Language), $"{callback} 1")
                               ));
                }

                var older = InlineKeyboardButton.WithCallbackData(
                    lang.Get(Res.AddressTransactionListOlder, user.Language), $"{callback} {pager.Page + 1}");
                var newer = InlineKeyboardButton.WithCallbackData(
                    lang.Get(Res.AddressTransactionListNewer, user.Language), $"{callback} {pager.Page - 1}");
                var latest =
                    InlineKeyboardButton.WithCallbackData(lang.Get(Res.AddressTransactionListLatest, user.Language),
                                                          $"{callback} 1");

                if (pager.Page == 1)
                {
                    return(new InlineKeyboardMarkup(older));
                }
                if (pager.HasPrev && !pager.HasNext)
                {
                    return(new InlineKeyboardMarkup(new[] { newer, latest, }));
                }

                return(new InlineKeyboardMarkup(new[] { newer, latest, older, }));
            }
        }
Exemplo n.º 35
0
        private static void Main()
        {
            Logger.Debug("Checking to see if there is an instance running.");
            if (IsAlreadyRunning())
            {
                // let the user know the program is already running.
                Logger.Warn("Instance is already running, exiting.");
                MessageBox.Show(Resources.ProgramIsAlreadyRunning, Resources.ProgramIsAlreadyRunningCaption,
                                MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else
            {
                if (!IsOutlook2003OrHigherInstalled())
                {
                    Logger.Debug("Outlook is not available or installed.");
                    MessageBox.Show(
                        Resources.Office2000Requirement + Environment.NewLine +
                        Resources.InstallOutlookMsg, Resources.MissingRequirementsCapation, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                try
                {
                    OutlookApp       = new Application();
                    OutlookNameSpace = OutlookApp.GetNamespace("MAPI");

                    // Before we do anything else, wait for the RPC server to be available, as the program will crash if it's not.
                    // This is especially likely when OotD is set to start with windows.
                    if (!IsRPCServerAvailable(OutlookNameSpace))
                    {
                        return;
                    }

                    OutlookFolder = OutlookNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);

                    // WORKAROUND: Beginning with Outlook 2007 SP2, Microsoft decided to kill all outlook instances
                    // when opening and closing an item from the view control, even though the view control was still running.
                    // The only way I've found to work around it and keep the view control from crashing after opening an item,
                    // is to get this global instance of the active explorer and keep it going until the user closes the app.
                    OutlookExplorer = OutlookFolder.GetExplorer();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Resources.ErrorInitializingApp + ' ' + ex, Resources.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                System.Windows.Forms.Application.EnableVisualStyles();

                Logger.Info("Starting the instance manager and loading instances.");
                var instanceManager = new InstanceManager();

                try
                {
                    instanceManager.LoadInstances();
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "Could not load instances");
                    return;
                }

                System.Windows.Forms.Application.Run(instanceManager);
            }
        }
 public void Cleanup()
 {
     CleanupFolder();
     explorer = null;
 }
Exemplo n.º 37
0
        public static void InitializeScriptCommands(IExplorerViewModel explorerModel,
                                                    IWindowManager windowManager, IEventAggregator events, params IProfile[] profiles)
        {
            var initilizer = AppViewModel.getInitializer(windowManager, events, explorerModel.RootModels.ToArray(),
                                                         new ColumnInitializers(),
                                                         new ScriptCommandsInitializers(windowManager, events),
                                                         new ToolbarCommandsInitializers(windowManager));


            explorerModel.FileList.Commands.Commands.Open =
                FileList.IfSelection(evm => evm.Count() == 1,
                                     FileList.IfSelection(evm => evm[0].EntryModel.IsDirectory,
                                                          FileList.OpenSelectedDirectory,        //Selected directory
                                                          FileList.AssignSelectionToParameter(
                                                              new OpenWithScriptCommand(null))), //Selected non-directory
                                     ResultCommand.NoError                                       //Selected more than one item, ignore.
                                     );


            explorerModel.FileList.Commands.Commands.NewFolder =
                FileList.Do(flvm => WPFScriptCommands.CreatePath(
                                flvm.CurrentDirectory, "NewFolder", true, true,
                                //FileList.Do(flvm => CoreScriptCommands.DiskCreateFolder(
                                //        flvm.CurrentDirectory, "NewFolder", "{DestinationFolder}", NameGenerationMode.Rename,
                                m => FileList.Refresh(FileList.Select(fm => fm.Equals(m), ResultCommand.OK), true)));

            explorerModel.FileList.Commands.Commands.Delete =
                FileList.IfSelection(evm => evm.Count() >= 1,
                                     WPFScriptCommands.IfOkCancel(windowManager, pd => "Delete",
                                                                  pd => String.Format("Delete {0} items?", (pd["FileList"] as IFileListViewModel).Selection.SelectedItems.Count),
                                                                  WPFScriptCommands.ShowProgress(windowManager, "Delete",
                                                                                                 ScriptCommands.RunInSequence(
                                                                                                     FileList.AssignSelectionToParameter(
                                                                                                         IOScriptCommands.DeleteFromParameter),
                                                                                                     new HideProgress())),
                                                                  ResultCommand.NoError),
                                     NullScriptCommand.Instance);


            explorerModel.FileList.Commands.Commands.Copy =
                FileList.IfSelection(evm => evm.Count() >= 1,
                                     WPFScriptCommands.IfOkCancel(windowManager, pd => "Copy",
                                                                  pd => String.Format("Copy {0} items?", (pd["FileList"] as IFileListViewModel).Selection.SelectedItems.Count),
                                                                  ScriptCommands.RunInSequence(FileList.AssignSelectionToParameter(ClipboardCommands.Copy)),
                                                                  ResultCommand.NoError),
                                     NullScriptCommand.Instance);

            explorerModel.FileList.Commands.Commands.Cut =
                FileList.IfSelection(evm => evm.Count() >= 1,
                                     WPFScriptCommands.IfOkCancel(windowManager, pd => "Cut",
                                                                  pd => String.Format("Cut {0} items?", (pd["FileList"] as IFileListViewModel).Selection.SelectedItems.Count),
                                                                  ScriptCommands.RunInSequence(FileList.AssignSelectionToParameter(ClipboardCommands.Cut)),
                                                                  ResultCommand.NoError),
                                     NullScriptCommand.Instance);

            explorerModel.DirectoryTree.Commands.Commands.Delete =
                WPFScriptCommands.IfOkCancel(windowManager, pd => "Delete",
                                             pd => String.Format("Delete {0}?", ((pd["DirectoryTree"] as IDirectoryTreeViewModel).Selection.RootSelector.SelectedValue.Label)),
                                             WPFScriptCommands.ShowProgress(windowManager, "Delete",
                                                                            ScriptCommands.RunInSequence(
                                                                                DirectoryTree.AssignSelectionToParameter(
                                                                                    IOScriptCommands.DeleteFromParameter),
                                                                                new HideProgress())),
                                             ResultCommand.NoError);


            //explorerModel.DirectoryTree.Commands.Commands.Map =
            //    UIScriptCommands.ExplorerShow

            if (profiles.Length > 0)
            {
                explorerModel.DirectoryTree.Commands.CommandDictionary.Map =
                    Explorer.PickDirectory(initilizer, profiles,
                                           dir => Explorer.BroadcastRootChanged(RootChangedEvent.Created(dir)), ResultCommand.NoError);
            }



            //explorerModel.Commands.ScriptCommands.Transfer =
            //    TransferCommand =
            //    new TransferCommand((effect, source, destDir) =>
            //        source.Profile is IDiskProfile ?
            //            IOScriptCommands.Transfer(source, destDir, effect == DragDropEffects.Move)
            //            : ResultCommand.Error(new NotSupportedException())
            //        , _windowManager);
        }
Exemplo n.º 38
0
        IEnumerable<FarFile> DoInvokeDeep(ProgressBox progress, Explorer explorer, int depth)
        {
            // stop?
            if (Stopping || progress != null && UIUserStop())
                yield break;

            ++ProcessedDirectoryCount;

            // progress
            if (progress != null && progress.ElapsedFromShow.TotalMilliseconds > 500)
            {
                var directoryPerSecond = ProcessedDirectoryCount / progress.ElapsedFromStart.TotalSeconds;
                progress.Activity = string.Format(null, Res.SearchActivityDeep,
                    FoundFileCount, ProcessedDirectoryCount, directoryPerSecond);
                progress.ShowProgress();
            }

            var args = new GetFilesEventArgs(ExplorerModes.Find);
            foreach (var file in explorer.GetFiles(args))
            {
                // stop?
                if (Stopping)
                    break;

                // process and add
                bool add = Directory || !file.IsDirectory;
                if (add && Filter != null)
                    add = Filter(explorer, file);
                if (add)
                {
                    ++FoundFileCount;
                    yield return new SuperFile(explorer, file);
                }

                // skip if deep or leaf
                if (Depth > 0 && depth >= Depth || !file.IsDirectory)
                    continue;

                Explorer explorer2 = SuperExplorer.ExploreSuperDirectory(explorer, ExplorerModes.Find, file);
                if (explorer2 == null)
                    continue;

                foreach (var file2 in DoInvokeDeep(progress, explorer2, depth + 1))
                    yield return file2;
            }
        }
Exemplo n.º 39
0
 /// <summary>
 /// 构造函数,初始化当前的数据输出类
 /// </summary>
 /// <param name="mainWindow"></param>
 /// <param name="drawingKernel"></param>
 public Output(MainWindow mainWindow, Explorer drawingKernel)
 {
     this.mainWindow    = mainWindow;
     this.drawingKernel = drawingKernel;
 }
Exemplo n.º 40
0
        public void writeAsJson(Object o, TextWriter writer, TypeAliaser typeAliaser = null)
        {
            if (LeafDefaultSet != null && OmitDefaultLeafValuesInJs && OmitMarkAsArrayFunction)
            {
                throw new Exception("Leaf defaulting requires Array marker for js code");
            }


            ObjectIDGenerator idGenerator = null;

            if (UseReferences)
            {
                idGenerator = new ObjectIDGenerator();
            }
            Stack <ExploreStackFrame> exploreStack = new Stack <ExploreStackFrame>();
            Explorer explorerImpl = ExplorerFactory();

            ((Explorer)explorerImpl).NodeExpander = NodeExpander;
            MoveAway down = delegate(Object from, string propertyName, Object to, bool isIndexed, int?index)
            {
                ExploreStackFrame currentFrame = exploreStack.Count > 0 ? exploreStack.Peek():null;
                if (currentFrame != null)
                {
                    if (currentFrame.propertyCount > 0)
                    {
                        writer.Write(", ");
                    }
                    currentFrame.propertyCount++;
                }
                if (from != null && propertyName != null)
                {
                    writePropertyName(propertyName, writer);
                    writer.Write(":");
                }
                ExploreStackFrame childFrame = new ExploreStackFrame();
                exploreStack.Push(childFrame);
                writeIndent(writer, exploreStack);
                if (UseReferences)
                {
                    bool firstTime;
                    long objectid = idGenerator.GetId(to, out firstTime);
                    if (firstTime)
                    {
                        // could be done like this ! (function() {var x=[1,2]; x.id="uuu";return x;})()
                        if (!isIndexed)
                        {
                            writer.Write("{" + this.IdTag + ":" + objectid + ' ');
                            childFrame.propertyCount++;
                            childFrame.propertyCount += writeTypeAliasProperty(writer, to, typeAliaser, childFrame.propertyCount);
                        }
                        else
                        {
                            // no need for type alias
                            writer.Write(AttachId2ArrayFunctionName + "(" + objectid + ",[");
                        }
                    }
                    else
                    {
                        writer.Write("{" + this.ReferenceTag + ":" + objectid);
                        return(false);
                    }
                }
                else // !Use References
                {
                    if (!isIndexed)
                    {
                        writer.Write('{');
                        // todo -- check this out ............
                        childFrame.propertyCount += writeTypeAliasProperty(writer, to, typeAliaser, childFrame.propertyCount);
                    }
                    else
                    {
                        if (!OmitMarkAsArrayFunction)
                        {
                            writer.Write(markAsArrayFunctionName);
                            writer.Write("([");
                        }
                        else
                        {
                            writer.Write("[");
                        }
                    }
                }

                return(true);
            };

            MoveBack up = (from, propertyName, to, isIndexed) =>
            {
                if (!isIndexed)
                {
                    writer.Write('}');
                }
                else
                {
                    writer.Write(']');
                    // is there a function wrapper ?
                    if (!OmitMarkAsArrayFunction || UseReferences)
                    {
                        writer.Write(")");
                    }
                }
                exploreStack.Pop();
                writeIndent(writer, exploreStack);
            };

            OnLeaf leaf = (from, propertyName, to, index) =>
            {
                //check for default leaf values
                if (!this.OmitDefaultLeafValuesInJs ||
                    !isDefaultLeafValue(from, propertyName, to, LeafDefaultSet))
                {
                    ExploreStackFrame currentFrame = exploreStack.Peek();
                    if (currentFrame.propertyCount > 0)
                    {
                        writer.Write(", ");
                    }
                    currentFrame.propertyCount++;
                    if (propertyName != null)
                    {
                        writePropertyName(propertyName, writer);
                        writer.Write(":");
                    }
                    writeLeafValue(writer, to, propertyName);
                }
            };

            explorerImpl.explore(o, down, up, leaf);
        }
Exemplo n.º 41
0
 public static bool HasAggregateFunction(this Expression expression, IQueryContext context)
 {
     var explorer = new Explorer(context);
     return explorer.Explore(expression);
 }
Exemplo n.º 42
0
        public ServerTester(string directory)
        {
            nodeDownloadData = bitcoinDownloadData;
            var networkString = "regtest";

            try
            {
                var rootTestData = "TestData";
                directory  = Path.Combine(rootTestData, directory);
                _Directory = directory;
                if (!Directory.Exists(rootTestData))
                {
                    Directory.CreateDirectory(rootTestData);
                }

                NodeBuilder = CreateNodeBuilder(directory);



                User1    = NodeBuilder.CreateNode();
                User2    = NodeBuilder.CreateNode();
                Explorer = NodeBuilder.CreateNode();
                foreach (var node in NodeBuilder.Nodes)
                {
                    node.WhiteBind = true;
                }
                NodeBuilder.StartAll();

                User1.CreateRPCClient().Generate(1);
                User1.Sync(Explorer, true);
                Explorer.CreateRPCClient().Generate(1);
                Explorer.Sync(User2, true);
                User2.CreateRPCClient().Generate(101);
                User1.Sync(User2, true);

                var creds   = RPCCredentialString.Parse(Explorer.AuthenticationString).UserPassword;
                var datadir = Path.Combine(directory, "explorer");
                DeleteRecursivelyWithMagicDust(datadir);
                List <(string key, string value)> keyValues = new List <(string key, string value)>();
                keyValues.Add(("conf", Path.Combine(directory, "explorer", "settings.config")));
                keyValues.Add(("datadir", datadir));
                keyValues.Add(("network", networkString));
                keyValues.Add(("verbose", "1"));
                keyValues.Add(("btcrpcuser", creds.UserName));
                keyValues.Add(("btcrpcpassword", creds.Password));
                keyValues.Add(("btcrpcurl", Explorer.CreateRPCClient().Address.AbsoluteUri));
                keyValues.Add(("cachechain", "0"));
                keyValues.Add(("rpcnotest", "1"));
                keyValues.Add(("mingapsize", "2"));
                keyValues.Add(("maxgapsize", "4"));
                keyValues.Add(("btcstartheight", Explorer.CreateRPCClient().GetBlockCount().ToString()));
                keyValues.Add(("btcnodeendpoint", $"{Explorer.Endpoint.Address}:{Explorer.Endpoint.Port}"));

                var args = keyValues.SelectMany(kv => new[] { $"--{kv.key}", kv.value }).ToArray();
                Host = new WebHostBuilder()
                       .UseConfiguration(new DefaultConfiguration().CreateConfiguration(args))
                       .UseKestrel()
                       .ConfigureLogging(l =>
                {
                    l.SetMinimumLevel(LogLevel.Information)
                    .AddFilter("Microsoft", LogLevel.Error)
                    .AddFilter("Hangfire", LogLevel.Error)
                    .AddFilter("NBXplorer.Authentication.BasicAuthenticationHandler", LogLevel.Critical)
                    .AddProvider(Logs.LogProvider);
                })
                       .UseStartup <Startup>()
                       .Build();

                string cryptoCode = "BTC";
                RPC = ((RPCClientProvider)Host.Services.GetService(typeof(RPCClientProvider))).GetRPCClient(cryptoCode);
                var nbxnetwork = ((NBXplorerNetworkProvider)Host.Services.GetService(typeof(NBXplorerNetworkProvider))).GetFromCryptoCode(cryptoCode);
                Network = nbxnetwork.NBitcoinNetwork;
                var conf = (ExplorerConfiguration)Host.Services.GetService(typeof(ExplorerConfiguration));
                Host.Start();

                _Client = new ExplorerClient(nbxnetwork, Address);
                _Client.SetCookieAuth(Path.Combine(conf.DataDir, ".cookie"));
            }
            catch
            {
                Dispose();
                throw;
            }
        }
Exemplo n.º 43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExplorerWrapper"/> class.
 /// </summary>
 /// <param name="explorer">The explorer.</param>
 public ExplorerWrapper(Explorer explorer)
 {
     Explorer = explorer;
     ((ExplorerEvents_10_Event)Explorer).Close += ExplorerClose;
 }
Exemplo n.º 44
0
        //Create callback methods here. For more information about adding callback methods, visit https://go.microsoft.com/fwlink/?LinkID=271226

        public void Ribbon_Load(Office.IRibbonUI ribbonUI)
        {
            this.ribbon = ribbonUI;
            _explorer   = Globals.ThisAddIn.Application.ActiveExplorer();
        }
        public override bool Execute()
        {
            if (!Debugger.IsAttached && OptionDebug)
            {
                Debugger.Launch();
            }

            var logger = new Logger(Log);

            try
            {
                var items = ItemsProperties.Enumerate().ToDictionary(pair => pair.Key,
                                                                     pair =>
                {
                    var taskItems = pair.Value?.GetValue(this) as IEnumerable <ITaskItem>;
                    if (taskItems == null)
                    {
                        return(Enumerable.Empty <Item>());
                    }
                    return(taskItems.Select(c => new Item(c)));
                });

                var references  = References.Enumerate().Select(c => new Item(c));
                var properties  = PropertiesProperties.Enumerate().ToDictionary(pair => pair.Key, pair => pair.Value?.GetValue(this) as string);
                var directories = DirectoryProperties.Enumerate().ToDictionary(pair => pair.Key, pair => pair.Value?.GetValue(this) as string);
                //Check solution folder property
                if (string.IsNullOrWhiteSpace(directories[BuildDirectory.Solution]) || directories[BuildDirectory.Solution] == "*Undefined*")
                {
                    directories[BuildDirectory.Solution] = FindSolutionDirectory(properties[BuildProperty.ProjectFile],
                                                                                 directories[BuildDirectory.Project]);
                }

                //Normilize all pathes and make sure all directories has slash
                foreach (var directory in directories.Keys.ToArray())
                {
                    var sourceDirectory = directories[directory];
                    if (sourceDirectory == null)
                    {
                        continue;
                    }
                    if (!sourceDirectory.IsAbsolutePath())
                    {
                        sourceDirectory = Path.Combine(directories[BuildDirectory.Project], sourceDirectory);
                    }
                    directories[directory] = sourceDirectory.NormalizePath().TrimEnd('\\') + "\\";
                }

                var explorer = new Explorer(references,
                                            items,
                                            directories,
                                            properties);

                var sandbox = new Sanbox(explorer, logger);
                BuildEngine4.RegisterTaskObject(BuildEngine.ProjectFileOfTaskNode, sandbox, RegisteredTaskObjectLifetime.Build, false);
                var artifacts = sandbox.Client.ExecutePreBuildAdaptations(logger);
                if (artifacts.Any())
                {
                    logger.Debug("------------");
                    logger.Info("Adding additional TaskItems to build");

                    foreach (var builder in artifacts)
                    {
                        logger.Info($"+ {builder}");
                    }

                    FillOutputTaskItems(artifacts);
                }

                ArtifactsTemporary = artifacts.Where(a => !a.IsPermanent)
                                     .Select(a => new TaskItem(a.Path))
                                     .OfType <ITaskItem>()
                                     .ToArray();
            }
            catch (Exception e)
            {
                logger.Error($"Assembly adaptation initialization failed. Details: {e.GetBaseException().Message}");
            }

            return(!Log.HasLoggedErrors);
        }
Exemplo n.º 46
0
        private void TrainMenuItem_Click(object sender, EventArgs e)
        {
            var form = new Explorer();

            form.Show();
        }
Exemplo n.º 47
0
 /// <summary>
 /// New super file with its explorer.
 /// </summary>
 /// <param name="explorer">The file's explorer.</param>
 /// <param name="file">The base file.</param>
 public SuperFile(Explorer explorer, FarFile file)
     : base(file)
 {
     if (explorer == null) throw new ArgumentNullException("explorer");
     _Explorer = explorer;
 }
Exemplo n.º 48
0
 public FixedIntervalSmtHeuristic CreateHeuristic(Explorer explorer)
 {
     return(new FixedIntervalSmtHeuristic(this.interval));
 }
Exemplo n.º 49
0
 /// <summary>
 /// New command with the search root.
 /// </summary>
 /// <param name="root">The root explorer.</param>
 public SearchFileCommand(Explorer root)
 {
     if (root == null) throw new ArgumentNullException("root");
     _RootExplorer = root;
 }
Exemplo n.º 50
0
        IniFile MyIni = new IniFile("Settings.ini"); //creates / loads the settings file
        public Path(int currGame, FormStartPosition pos)
        {
            this.StartPosition = pos;
            intGame            = currGame;
            Boolean worked = false;

            if (MyIni.KeyExists("Path" + intGame)) //Path contains the pathes of the GTA folders.
            {
                var GamePath = MyIni.Read("Path" + intGame);
                if (Directory.Exists(GamePath))
                {
                    if (Directory.GetFiles(GamePath, gameEXE(intGame), SearchOption.TopDirectoryOnly).Count() > 0 || Directory.GetFiles(GamePath, "gta-sa.exe", SearchOption.TopDirectoryOnly).Count() == 1)
                    {
                        worked = true;
                        Explorer explorerForm = new Explorer(intGame, GamePath);
                        explorerForm.Closed += (s, args) => Application.Exit();
                        explorerForm.Show(); //Opens the explorer form, if the path was found and exists. Parameters: int of the current game and path of the current game.
                    }
                }
            }
            if (!(worked))
            {
                this.Show();
            }
            //Following lines search in the registry for game pathes
            InitializeComponent();
            label1.Text = label1.Text + " " + gameString(currGame) + OpenRW.Resources._internal.ResourceManager.GetString("lblATR") + "!";
            RegistryKey rk  = Registry.LocalMachine;
            RegistryKey sk1 = rk.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 12100"); // III Steam
            RegistryKey sk2 = rk.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 12110"); // Vice City Steam
            RegistryKey sk3 = rk.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 12120"); // San Andreas Steam

            if (intGame == 0)
            {
                if (sk1 != null)
                {
                    if (sk1.GetValueNames().Contains("InstallLocation") && sk1.GetValue("InstallLocation").ToString() != "")
                    {
                        textBox1.Text = sk1.GetValue("InstallLocation").ToString();
                    }
                }
            }
            else if (intGame == 1)
            {
                if (sk2 != null)
                {
                    if (sk2.GetValueNames().Contains("InstallLocation") && sk2.GetValue("InstallLocation").ToString() != "")
                    {
                        textBox1.Text = sk2.GetValue("InstallLocation").ToString();
                    }
                }
            }
            else if (intGame == 2)
            {
                if (sk3 != null)
                {
                    if (sk3.GetValueNames().Contains("InstallLocation") && sk3.GetValue("InstallLocation").ToString() != "")
                    {
                        textBox1.Text = sk3.GetValue("InstallLocation").ToString();
                    }
                }
            }
        }
Exemplo n.º 51
0
        JobResult DeleteFilesOfExplorer(Explorer explorer, List<SuperFile> xfilesToDelete, IList<FarFile> xfilesToStay, ExplorerModes mode, bool force, ref object codata)
        {
            // explorer files
            var efilesToDelete = new List<FarFile>(xfilesToDelete.Count);
            foreach (var file in xfilesToDelete)
                efilesToDelete.Add(file.File);

            // delete, mind co-data
            Log.Source.TraceInformation("DeleteFiles Count='{0}' Location='{1}'", efilesToDelete.Count, explorer.Location);
            var argsDelete = new DeleteFilesEventArgs(mode, efilesToDelete, force);
            argsDelete.Data = codata;
            explorer.DeleteFiles(argsDelete);
            codata = argsDelete.Data;

            // result: break to delete
            switch (argsDelete.Result)
            {
                default:
                    return JobResult.Ignore;

                case JobResult.Done:
                    break;

                case JobResult.Incomplete:

                    // recover that files to stay
                    if (argsDelete.FilesToStay.Count == 0)
                    {
                        var filesAfterDelete = explorer.GetFiles(new GetFilesEventArgs(ExplorerModes.Silent));
                        var hashAfterDelete = Works.Kit.HashFiles(filesAfterDelete, explorer.FileComparer);
                        foreach (var file in efilesToDelete)
                            if (hashAfterDelete.ContainsKey(file))
                                argsDelete.FilesToStay.Add(file);
                    }

                    // convert that files to this files to stay
                    foreach (SuperFile xfile in SuperFile.SuperFilesOfExplorerFiles(xfilesToDelete, argsDelete.FilesToStay, explorer.FileComparer))
                    {
                        xfilesToDelete.Remove(xfile);
                        xfilesToStay.Add(xfile);
                    }

                    break;
            }

            // remove remaining super files
            foreach (var file in xfilesToDelete)
                _Cache.Remove(file);

            return argsDelete.Result;
        }
Exemplo n.º 52
0
        private void generationDirectory_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Explorer explorer = new Explorer(codeGenerationPath.Text);

            explorer.Open();
        }
Exemplo n.º 53
0
 public void CurrentViewChanged(object currentView)
 {
     explorer = (Explorer)currentView;
     explorer.SelectionChange += ExplorerOnSelectionChange;
 }
Exemplo n.º 54
0
    private Vector3[] nextTargetTile(Vector3 target)
    {
        Vector3[]  result        = null;
        Vector3Int min           = WallCalculator.instance.getMin();
        Vector3Int myTilePos     = WallCalculator.instance.tilemapWalls.WorldToCell(t.position) - min;
        Vector3Int targetTilePos = WallCalculator.instance.tilemapWalls.WorldToCell(target) - min;

        // grid = new int[WallCalculator.instance.bounds.size.y, WallCalculator.instance.bounds.size.x,3];

        explorers     = new List <Explorer>();
        nextExplorers = new List <Explorer>();
        oldExplorers  = new List <Explorer>();
        used          = new List <Vector3Int>();
        used.Add(myTilePos);

        explorers.Add(new Explorer(myTilePos));
        bool     found  = false;
        Explorer theOne = null;

        //int debu = 0;
        while (explorers.Count > 0)
        {
            foreach (Explorer e in explorers)
            {
                int n = e.pos.x + e.pos.y * WallCalculator.instance.tilemapWalls.cellBounds.size.x;
                for (int i = 0; i < 4; i++)
                {
                    Vector3Int newPos = e.pos + WallCalculator.instance.directions[i];
                    //debu++;
                    if (newPos.y < 0)
                    {
                        Debug.Log("num");
                    }

                    if (WallCalculator.instance.adjMatrix[n, i] && !used.Contains(newPos))
                    {
                        oldExplorers.Add(e);
                        nextExplorers.Add(new Explorer(newPos, e));
                        used.Add(newPos);
                    }
                    if (newPos != targetTilePos)
                    {
                        //nothing
                    }
                    else
                    {
                        theOne = e;
                        found  = true;
                        goto TargetFound;
                    }
                }
            }
            //explorers.Clear();

            // List<Explorer> temp = explorers;
            explorers = new List <Explorer>(nextExplorers.ToArray());
            //nextExplorers = temp;
            nextExplorers = new List <Explorer>();
        }
TargetFound:
        if (found)
        {
            List <Vector3> path     = new List <Vector3>();
            int            n        = WallCalculator.instance.adjMatrix.Length;
            Vector3        toCenter = new Vector3(0.5f, 0.5f);
            for (int i = 0; theOne != null && i < n; i++)
            {
                path.Add(WallCalculator.instance.tilemapWalls.CellToWorld(theOne.pos + min) + toCenter);
                theOne = theOne.previous;
            }
            path.Reverse();
            return(path.ToArray());
        }


        //result = myTilePos;

        return(null);
    }
Exemplo n.º 55
0
 /// <summary>
 ///      Implements the OnStartupComplete method of the IDTExtensibility2 interface.
 ///      Receives notification that the host application has completed loading.
 /// </summary>
 /// <param term='custom'>
 ///      Array of parameters that are host application specific.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnStartupComplete(ref System.Array custom)
 {
     activeExplorer = (Explorer)applicationObject.GetType().InvokeMember("ActiveExplorer",BindingFlags.GetProperty,null,applicationObject,null);
     CommandBars currentBars = (CommandBars)activeExplorer.GetType().InvokeMember("CommandBars",BindingFlags.GetProperty,null,activeExplorer,null);
     try {
         btnLaunchPaperless = (CommandBarButton)currentBars["Standard"].Controls["Lovetts Paperless"];
         btnLaunchPaperless.Caption = "Lovetts Paperless";
         btnLaunchPaperless.Style = MsoButtonStyle.msoButtonIconAndCaption;
         btnLaunchPaperless.FaceId = 610;
         btnLaunchPaperless.Tag = "Paperless";
     } catch {
         btnLaunchPaperless = (CommandBarButton)currentBars["Standard"].Controls.Add( 1, missingVal, missingVal, missingVal, missingVal );
         btnLaunchPaperless.Caption = "Lovetts Paperless";
         btnLaunchPaperless.Style = MsoButtonStyle.msoButtonIconAndCaption;
         btnLaunchPaperless.FaceId = 610;
         btnLaunchPaperless.Tag = "Paperless";
     }
     btnLaunchPaperless.Visible = true;
         // Rig-up the Click event for the new CommandBarButton type.
     btnLaunchPaperless.Click += new _CommandBarButtonEvents_ClickEventHandler( btnLaunchPaperless_Click );
 }
Exemplo n.º 56
0
 public Explorer(Vector3Int pos, Explorer previous)
 {
     this.pos      = pos;
     this.previous = previous;
 }
Exemplo n.º 57
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExplorerEventArgs"/> class.
 /// </summary>
 /// <param name="explorer">The explorer.</param>
 public ExplorerEventArgs(Explorer explorer)
 {
     Explorer = explorer;
 }
Exemplo n.º 58
0
 public void SetExplorer(Explorer explorer)
 {
     AssociatedExplorer =
         explorer ?? throw new ArgumentNullException(nameof(explorer), "Explorer cannot be null.");
 }
Exemplo n.º 59
0
 internal void AddWrapper(Explorer explorer)
 {
     var wrapper = new ExplWrap(explorer);
     //don't know how this could happen, but just in case
     if (_explWrappers.ContainsKey(wrapper.Key))
     {
         _explWrappers.Remove(wrapper.Key);
     }
     _explWrappers.Add(wrapper.Key, wrapper);
 }
Exemplo n.º 60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExplorerWrapper"/> class.
 /// </summary>
 /// <param name="explorer">The explorer.</param>
 public ExplorerWrapper(Explorer explorer)
 {
     Explorer = explorer;
     ((ExplorerEvents_10_Event)Explorer).Close += ExplorerClose;
 }