Пример #1
0
 protected override void OnStart(string[] args)
 {
     if (!Directory.Exists(path))
     {
         DirectoryInfo di = Directory.CreateDirectory(path);
     }
     System.Threading.Thread.Sleep(500);
     _backend = new Backend.Backend(this.ReceiveFile);
     FileSystemWatcher watcher = new FileSystemWatcher(path, "*.txt");
     watcher.Created += new FileSystemEventHandler(OnCreated);
     watcher.EnableRaisingEvents = true;
 }
Пример #2
0
        private static async Task initializeBackend()
        {
            await Task.Delay(5000);

            try
            {
                _backend = Backend.Backend.Initialize(Program.Port, Startup.Lifetime);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                throw;
            }
        }
Пример #3
0
        // System.IO.Path.GetTempFileName()

        private static void Main()
        {
            var args       = Environment.GetCommandLineArgs();
            var parameters = Parameters.parse(args);

            if (parameters == null)
            {
                printHelp(args);
                return;
            }
            if (parameters.outputFile == null)
            {
                parameters.outputFile = System.IO.Path.GetTempFileName();
            }

            var inputFile = new FileOrigin(args[1]);

            try
            {
                var parseTree = CSTBuilder.Build(inputFile);
                Console.WriteLine(parseTree.ToString());

                var backendFunctions = new Frontend().FromParseTreeToBackend(parseTree);

                var    backend      = new Backend.Backend();
                string assemblyFile = parameters.outputFile;
                if (!parameters.onlyAssembly)
                {
                    assemblyFile = System.IO.Path.GetTempFileName();
                }
                generateAssemblyFile(assemblyFile, backend.FromFunctionsToNasm(backendFunctions));
                if (!parameters.onlyAssembly)
                {
                    // TODO invoke NASM (using parameters)
                    var nasm = new Process();
                    nasm.StartInfo.FileName  = "nasm";  // take $PATH into account
                    nasm.StartInfo.Arguments = assemblyFile + " -o " + parameters.outputFile;
                    nasm.Start();
                    nasm.WaitForExit();
                }
            }
            catch (CSTBuilder.LexerFailure ex)
            {
                Console.WriteLine("Syntax error:");
                var diagnostics = new SourceDiagnostic();
                diagnostics.PrintFragmentInLine(ex.Fragment);
            }
        }
 public Authenticator(Backend.Backend backend)
 {
     _backend = backend;
 }
Пример #5
0
        private static async Task initializeBackend()
        {
            await Task.Delay(5000);

            _backend = Backend.Backend.Initialize(Program.Port);
        }
Пример #6
0
        void BuildConnectBackend()
        {
            _report.AppendLine("Connect to target: " + _job.JobTarget.TargetServer);
            _backend = Backend.Backend.OpenBackend(_job.JobTarget);
            _zipFile = new ZipFile()
            {
                CompressionLevel = CompressionLevel.BestCompression,
                UseZip64WhenSaving = Zip64Option.Always
            };

            if (!string.IsNullOrWhiteSpace(_job.JobTarget.ZipPassword))
            {
                _zipFile.Password = _job.JobTarget.ZipPassword;
                _zipFile.Encryption = EncryptionAlgorithm.WinZipAes256;
            }

            _zipFile.SaveProgress += zip_SaveProgress;
        }
Пример #7
0
 public void Dispose()
 {
     if(_zipFile!=null) { _zipFile.Dispose(); _zipFile=null;}
     if(_backend!=null) { _backend.Dispose(); _backend=null;}
     if(_backup!=null) { _backup.Dispose(); _backup=null;}
 }