Exemplo n.º 1
0
        public void InitTaskLocal(string taskName, string workDir, string[] mainFileList, string[] extraFileList)
        {
            if (_tasks.ContainsKey(taskName))
                throw new Exception("Такая задача уже была ранее проинициализирована");

            var t = new TaskScheduler(taskName, workDir, mainFileList, _finder, _connection);
            if(_isStarted)
                t.Start();
            _tasks.Add(taskName, t);
        }
Exemplo n.º 2
0
        public void InitTaskRemote(string taskName, KeyValuePair<string, byte[]>[] mainFileList, KeyValuePair<string, byte[]>[] extraFileList)
        {
            if(_tasks.ContainsKey(taskName))
                throw new Exception("Такая задача уже была ранее проинициализирована");

            Directory.CreateDirectory(taskName);
            foreach (var f in mainFileList)
                File.WriteAllBytes(f.Key, f.Value);
            if(extraFileList != null)
                foreach (var f in extraFileList)
                    File.WriteAllBytes(f.Key, f.Value);

            var t = new TaskScheduler(taskName, taskName, mainFileList.Select(p => p.Key).ToArray(), _finder, _connection);
            if (_isStarted)
                t.Start();
            _tasks.Add(taskName, t);
        }