コード例 #1
0
        private void miOpen_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog
            {
                Filter = "Image files (*.jpg; *.jpeg; *.bmp; *.png) | *.jpg; *.jpeg; *.bmp; *.png"
            };

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var filePath = ofd.FileName;
            var fileName = Path.GetFileNameWithoutExtension(filePath);

            var imageName = string.Empty;
            var enterForm = new EnterStringForm();

            if (enterForm.GetString("Enter image's name:", fileName, ref imageName) != DialogResult.OK)
            {
                return;
            }

            OnFileOpen?.Invoke(filePath, imageName);
        }
コード例 #2
0
 public void InitDragDropFile()
 {
     scintillaCode.AllowDrop  = true;
     scintillaCode.DragEnter += delegate(object sender, DragEventArgs e)
     {
         if (e.Data.GetDataPresent(DataFormats.FileDrop))
         {
             e.Effect = DragDropEffects.Copy;
         }
         else
         {
             e.Effect = DragDropEffects.None;
         }
     };
     scintillaCode.DragDrop += delegate(object sender, DragEventArgs e)
     {
         // get file drop
         if (e.Data.GetDataPresent(DataFormats.FileDrop))
         {
             Array a = (Array)e.Data.GetData(DataFormats.FileDrop);
             if (a != null)
             {
                 string path = a.GetValue(0).ToString();
                 OnFileOpen?.Invoke(path);
             }
         }
     };
 }
コード例 #3
0
        public async Task Invoke()
        {
            var cfg = new IgniteConfiguration
            {
                JvmOptions = new[] { //"-Xms256m",
                    $"-Xmx{maxOnHeap}m",
                    "-XX:+AlwaysPreTouch",
                    "-XX:+UseG1GC",
                    "-XX:+ScavengeBeforeFullGC",
                    "-XX:+DisableExplicitGC",
                    $"-XX:MaxDirectMemorySize={maxOffHeap}m"
                },
                DiscoverySpi = new Apache.Ignite.Core.Discovery.Tcp.TcpDiscoverySpi
                {
                    IpFinder = new TcpDiscoveryStaticIpFinder
                    {
                        Endpoints = new[] { $"{ClusterNode.Address}:{(ClusterNode.Port != 0 ? ClusterNode.Port : DEFAULT_PORT)}" }
                    },
                }
            };

            Ignition.ClientMode = true;
            using (var client = Ignition.Start(cfg))
            {
                foreach (var fileInfo in SourceFiles)
                {
                    OnFileOpen?.Invoke(this, fileInfo);
                    using (var device = new FastPcapFileReaderDevice(fileInfo.FullName))
                    {
                        await ProcessFile(client, fileInfo, device);
                    }
                    OnFileCompleted?.Invoke(this, fileInfo);
                }
            }
        }
コード例 #4
0
        public async Task Invoke()
        {
            var cfg = new IgniteClientConfiguration
            {
                Host = ClusterNode.Address.ToString(),
                Port = ClusterNode.Port != 0 ? ClusterNode.Port : DEFAULT_PORT,
            };

            using (var client = Ignition.StartClient(cfg))
            {
                foreach (var fileInfo in SourceFiles)
                {
                    OnFileOpen?.Invoke(this, fileInfo);
                    using (var device = new FastPcapFileReaderDevice(fileInfo.FullName))
                    {
                        await ProcessFile(client, fileInfo, device);
                    }
                    OnFileCompleted?.Invoke(this, fileInfo);
                }
            }
        }