public static DirectoryHandler getInstance() { if (DirectoryHandler.instance == null){ DirectoryHandler.instance = new DirectoryHandler(); } return DirectoryHandler.instance; }
private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { var ai = e.ClickedItem; var menuAction = ai.Tag.ToString(); var mclickedMusicItem = (MusicItem)(GetCurrentGrid()).CurrentRow.DataBoundItem; if (menuAction == "usb") { DbController.AddToUsbList(mclickedMusicItem); } if (menuAction == "plst") { DbController.AddToPlayList(mclickedMusicItem); } if (menuAction == "dir") { var dir = Path.GetDirectoryName(mclickedMusicItem.FullFileName); DirectoryHandler.OpenContaingFolder(dir); return; } //DbController.Update(mclickedMusicItem); currentIndex = null; RefreshGrid(); }
public Form1() { Debugger.Log(1, "locura", $"form id: {Thread.CurrentThread.ManagedThreadId}"); InitializeComponent(); DirectoryHandler = new DirectoryHandler(); DirectoryHandler.NewFileCopied += AddFilePathIntoListBox; }
public async Task <ICollection <UnitTestResult> > GenerateResultsImpl(SubmissionData data, string snapshot, DevAssignment assignment, ICollection <SnapshotMethod> snapshotMethods) { using (var handler = new DirectoryHandler(GetTestDirectory(data))) { var testProject = new TestProjectObj(handler.Directory, assignment.TestProject); testProject.MoveFilesToProject(data.SnapshotSourceFiles(snapshot)); var preprocessorArguments = GetPreprocessorArguments(snapshotMethods); var process = new EngineProcess(GetEngineProcessData(handler.Directory, testProject, preprocessorArguments)); var exitCode = process.Run(); if (exitCode == 0) { process.Stop(); return(GetUnitTestResults(assignment.TestProject, ResultsFile(handler.Directory))); } EngineReportExceptionData exception; using (var reader = process.StandardError) { exception = new EngineReportExceptionData(reader.ReadToEnd()) { Type = "Build", }; } process.Stop(); throw exception; } }
/*********************************************************************/ public void createHandler(string directory) { IDirectoryHandler h = new DirectoryHandler(directory, controller); CommandRecieved += h.onCommandReceived; h.OnCloseServer += onCloseServer; }
/// <summary> /// Creates the handler. /// </summary> /// <param name="dirPath">The directory path.</param> private void createHandler(string dirPath) { IDirectoryHandler handler = new DirectoryHandler(dirPath, m_controller, m_logging); CommandRecievedEvent += handler.OnCommandReceived; handler.DirectoryCloseEvent += onCloseServer; }
public void ShouldDestoryDirectory() { using (var directory = new DirectoryHandler(Directory)) { } Assert.IsFalse(System.IO.Directory.Exists(Directory)); }
public event EventHandler <CommandRecievedEventArgs> CommandRecieved; // The event that notifies about a new Command being recieved #endregion /// <summary> /// constructor /// </summary> /// <param name="log"></param> public ImageServer(ILoggingService log) { //taking paths given in the config string[] dest = ConfigurationManager.AppSettings["Handler"].Split(';'); //taking thumbsize from config int thumbSize = Int32.Parse(ConfigurationManager.AppSettings["ThumbnailSize"]); m_logging = log; //one controller to rule them all m_controller = new ImageController(new ImageModel( ConfigurationManager.AppSettings["OutputDir"], thumbSize)); //enlisting our newly created handlers to command recieved and our OnDirClosed(server method) to closing //event of handlers for (int i = 0; i < dest.Count(); i++) { IDirectoryHandler dH = new DirectoryHandler(m_controller, m_logging); CommandRecieved += dH.OnCommandRecieved; dH.DirectoryClose += OnDirClosed; try { dH.StartHandleDirectory(dest[i]); } catch (Exception e) { m_logging.Log("directory" + dest[i] + "couldn't be handeled", MessageTypeEnum.FAIL); } } }
public event EventHandler <CommandRecievedEventArgs> CommandRecieved; // The event that notifies about a new Command being recieved #endregion /// <summary> /// constructor /// </summary> /// <param name="log"></param> public DirectoryManager(ILoggingService log, ImageServiceConfig config, EventHandler <DirectoryCloseEventArgs> update) { m_logging = log; //one controller to rule them all m_controller = new ImageController(new ImageModel( ConfigurationManager.AppSettings["OutputDir"], config.thumbSize)); //enlisting our newly created handlers to command recieved and our OnDirClosed(server method) to closing //event of handlers for (int i = 0; i < config.handlers.Count(); i++) { // set the required event handlers IDirectoryHandler dH = new DirectoryHandler(m_controller, m_logging); CommandRecieved += dH.OnCommandRecieved; dH.DirectoryClose += update; // start handle directory try { dH.StartHandleDirectory(config.handlers[i]); } catch (Exception e) { m_logging.Log("directory" + config.handlers[i] + "couldn't be handeled" + "because" + e.Message, MessageTypeEnum.FAIL); } } }
public void AddDirectoryHandler_EmptyDisplayName_Failure() { DirectoryHandler oHandler; var res = DirectoryHandler.AddDirectoryHandler(_mockServer, "", true, null, out oHandler); Assert.IsFalse(res.Success, "Calling AddHandler with empty display name did not fail"); }
public void Constructor_ObjectId_Success() { BaseUnitTests.ClassInitialize(null); DirectoryHandler oTestHandler = new DirectoryHandler(_mockServer, "ObjectId"); Console.WriteLine(oTestHandler); }
public ModelGenerator(DirectoryHandler directoryHandler, SpringClassGenerator springClassGen, SpringConfigurationGenerator springConfigGen, SpringGeneratorUtil generatorUtil) { this.directoryHandler = directoryHandler; this.springClassGen = springClassGen; this.springConfigGen = springConfigGen; this.generatorUtil = generatorUtil; }
public AbstractSyntaxTreeNode CreateFromFile(DirectoryHandler handler, string path) { ValidatePath(path); using (var comiplerHandler = new DirectoryHandler(GetCompilationDirectory(handler))) { var process = GetEngineProcess(GetEngineProcessData(comiplerHandler.Directory, path)); var exitCode = process.Run(); if (exitCode == 0) { process.Stop(); using (var reader = new StreamReader(GetOutputFile(comiplerHandler.Directory))) { return(Extractor.Extract(reader)); } } EngineAssignmentExceptionData exception; using (var reader = process.StandardError) { exception = new EngineAssignmentExceptionData() { Report = new PreAssignmentCompileFailureReport() { Report = reader.ReadToEnd() } }; } process.Stop(); throw exception; } }
public static void CallGetAllFiles(string path) { MaskHandler maskH = new MaskHandler(""); DirectoryHandler dirHandler = new DirectoryHandler(maskH); dirHandler.TraverseAllFiles(path); }
public AbstractSyntaxTreeNode CreateFromFile(SubmissionData data, string path) { using (var handler = new DirectoryHandler(GetCompilationDirectory(data))) { var process = GetEngineProcess(GetEngineProcessData(handler.Directory, path)); var exitCode = process.Run(); if (exitCode == 0) { process.Stop(); using (var reader = new StreamReader(GetOutputFile(handler.Directory))) { return(Extractor.Extract(reader)); } } EngineReportExceptionData exception; using (var reader = process.StandardError) { exception = new EngineReportExceptionData(reader.ReadToEnd()) { Type = "Compilation", }; } process.Stop(); throw exception; } }
protected void _init(string path, string filename = "config.json") { this._data = new ConfigData(); path = DirectoryHandler.ValidateDirectoryPath(path); if (!DirectoryHandler.Exists(path)) { throw new ConfigDirectoryNotFound(path); } if (FileHandler.Exists(path + filename)) { this._path = path + filename; this.LoadFromFile(path + filename); } else { this._data.Path = path; this._path = path + filename; using (FileHandler fHandler = new FileHandler(this._path)) { fHandler.Serializer.WriteJson(this._data); } } }
public void ShouldCreateDirectory() { using (var directory = new DirectoryHandler(Directory)) { Assert.IsTrue(System.IO.Directory.Exists(Directory)); } }
static void Main(string[] args) { try { //Check Correct Arguments and Log any Warning or Throw Exception for Error ArgumentsHandler.IsValidArguments(args); } catch (ArgumentException argsEx) { Console.WriteLine(argsEx.Message); } //Set Variables for Input and Output Directories string inputDir = args[0]; string outputDir = args[1]; //Get All Gherkin Scripts Feature Wise : Dictionary{Feature:[gH1,gH2,..],...} Dictionary <string, string[]> FeatureTree = DirectoryHandler.GetAllGherkinScripts(inputDir); //Loop through the Dict and Generate FS for each Feature foreach (var dItem in FeatureTree) { var doc = DocX.Create(outputDir + dItem.Key + ".docx"); foreach (string gherkinScript in dItem.Value) { var feature = GherkinParserHandler.GetFeature(gherkinScript); DocumentHandler.GenerateFeatureSpecDocument(feature, doc); } } }
public void AddDirectoryHandler_NullConnectionServer_Failure() { DirectoryHandler oHandler; var res = DirectoryHandler.AddDirectoryHandler(null, "display name", true, null, out oHandler); Assert.IsFalse(res.Success, "Calling AddHandler with null ConnectionServerRest did not fail"); }
public IList <IList <double> > DistanceMatrix(IList <Snapshot> snapshots, MarkovModelOptions options, DirectoryHandler handler, DevAssignment assignment) { var distances = CreateSquareMatrix(snapshots.Count); for (var row = 0; row < snapshots.Count; ++row) { var left = snapshots[row]; var leftRoot = CreateOrDefualtAbstractSyntaxTreeNode(left, handler, assignment); for (var col = row + 1; col < snapshots.Count; ++col) { var distance = 0.0; var right = snapshots[col]; distance += CalculateBuildDistance(left, right, options); distance += CalculateTestDistance(left, right, options, assignment); var rightRoot = CreateOrDefualtAbstractSyntaxTreeNode(right, handler, assignment); distance += CalculateMetricDistance(leftRoot, rightRoot, assignment, options); distances[row][col] = distance; distances[col][row] = distance; } } return(distances); }
public void RefetchDirectoryHandlerData_InvalidWavFile_Failure() { DirectoryHandler oHandler = new DirectoryHandler(_mockServer, ""); var res = oHandler.RefetchDirectoryHandlerData(); Assert.IsFalse(res.Success, "Calling RefetchDirectoryHandlerData on an empty class instance should fail"); }
public void GetDirectoryHandler_BlankNameAndObjectId_Failure() { DirectoryHandler oHandler; var res = DirectoryHandler.GetDirectoryHandler(out oHandler, _mockServer); Assert.IsFalse(res.Success, "GetDirectoryHandler should fail if the ObjectId and display name are both blank"); }
public void GetDirectoryHandlers_NullConnectionServer_Failure() { List <DirectoryHandler> oHandlerList; WebCallResult res = DirectoryHandler.GetDirectoryHandlers(null, out oHandlerList, 1, 10, null); Assert.IsFalse(res.Success, "GetDirectoryHandler should fail with null ConnectionServerRest passed to it"); }
private void BackUpFile(object sender, TaskEventArgs arg) { var handlerArg = arg as TaskHandlerEventArgs; var handler = new DirectoryHandler(ConfigurationManager.AppSettings["processedFolder"]); handler.BackUp(handlerArg.filePath, handlerArg.fileName); logger.LogInfo(Task.CurrentId + " back upped file " + handlerArg.fileName); }
private async Task RunMarkovModelImpl(DevAssignment assignment, MarkovModelOptions options) { using (var handler = new DirectoryHandler(Path.Combine(Options.RootDirectory, GetUniqueFolderName(Options.RootDirectory)))) { await Runner.RunMarkovModel(assignment, options, handler); } }
/// <summary> /// create new directory handler. /// </summary> /// <param name="directory"></param> private void createHandler(string directory) { IDirectoryHandler handler = new DirectoryHandler(directory, _mController, _mLogging); // notify command CommandRecieved += handler.OnCommandRecieved; handler.DirectoryClose += closeServer; }
public void GetDirectoryHandler_NullConnectionServer_Failure() { DirectoryHandler oHandler; WebCallResult res = DirectoryHandler.GetDirectoryHandler(out oHandler, null); Assert.IsFalse(res.Success, "GetDirectoryHandler should fail if the ConnectionServerRest is null"); }
public void PropertyGetFetch_ExitAction() { DirectoryHandler oHandler = new DirectoryHandler(); const ActionTypes expectedValue = ActionTypes.Hangup; oHandler.ExitAction = expectedValue; Assert.IsTrue(oHandler.ChangeList.ValueExists("ExitAction", (int)expectedValue), "ExitAction value get fetch failed"); }
public void PropertyGetFetch_NoInputAction() { DirectoryHandler oHandler = new DirectoryHandler(); const ActionTypes expectedValue = ActionTypes.RestartGreeting; oHandler.NoInputAction = expectedValue; Assert.IsTrue(oHandler.ChangeList.ValueExists("NoInputAction", (int)expectedValue), "NoInputAction value get fetch failed"); }
private async Task RunImplementation(PreAssignment assignment) { using (var handler = new DirectoryHandler( Path.Combine(Options.RootDirectory, GetUniqueFolderName(Options.RootDirectory)))) { await Runner.RunPreAssignment(assignment, handler); } }
public void PropertyGetFetch_UseStarToExit() { DirectoryHandler oHandler = new DirectoryHandler(); const bool expectedValue = true; oHandler.UseStarToExit = expectedValue; Assert.IsTrue(oHandler.ChangeList.ValueExists("UseStarToExit", expectedValue), "UseStarToExit value get fetch failed"); }
/// <summary> /// Update the recorded WAV file for a greeting stream for a specific language. Each greeting can have multiple language versions recorded /// so the language along with the greeting itself need to be identified for updating. /// You have the option of having the WAV file converted into raw PCM prior to uploading to prevent codec compatibility issues with the /// recording. /// </summary> /// <param name="pConnectionServer"> /// The server the greeting being edited is homed on. /// </param> /// <param name="pDirectoryHandlerObjectId"> /// The directory handler that owns the greeting being edited. /// </param> /// <param name="pLanguageCode"> /// Language code to use (i.e. US English = 1033). The LanguageCodes enum deinfed in the ConnectionServer class can be helpfull here. /// </param> /// <param name="pSourceLocalFilePath"> /// The full path to a WAV file to upload as the greeting stream. /// </param> /// <param name="pConvertToPcmFirst"> /// Optional parameter to convert the WAV file into PCM first. Most codecs are handled by this conversion including G729a, MP3, GSM 610 etc... /// however if the file conversion fails then the upload itself is not attempted and failure is returned. /// If the file is already in PCM the conversion operation is just a copy and the upload proceeds as normal. /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> public static WebCallResult SetGreetingWavFile(ConnectionServerRest pConnectionServer, string pDirectoryHandlerObjectId, int pLanguageCode, string pSourceLocalFilePath, bool pConvertToPcmFirst = false) { return(DirectoryHandler.SetGreetingWavFile(pConnectionServer, pSourceLocalFilePath, pDirectoryHandlerObjectId, pLanguageCode, pConvertToPcmFirst)); }
public ComponentGenerator(SpringInterfaceGenerator springInterfaceGen, SpringClassGenerator springClassGen, SpringConfigurationGenerator springConfigGen, SpringViewGenerator springViewGen, SpringGeneratorUtil generatorUtil, BindingDiscoverer bindingDiscoverer, DirectoryHandler directoryHandler, DependencyDiscoverer dependencyDiscoverer, DataAccessFinder dataAccessFinder, JSFGenerator jSFGenerator) { this.springInterfaceGen = springInterfaceGen; this.springClassGen = springClassGen; this.springConfigGen = springConfigGen; this.springViewGen = springViewGen; this.generatorUtil = generatorUtil; this.bindingDiscoverer = bindingDiscoverer; this.directoryHandler = directoryHandler; this.dependencyDiscoverer = dependencyDiscoverer; this.dataAccessFinder = dataAccessFinder; this.jSFGenerator = jSFGenerator; }
public JSFGenerator(SpringViewGenerator springViewGen, SpringGeneratorUtil generatorUtil, DirectoryHandler directoryHandler) { this.springViewGen = springViewGen; this.generatorUtil = generatorUtil; this.directoryHandler = directoryHandler; }
private static void EachExpolor(DirectoryInfo dir,DirectoryHandler dh) { DirectoryInfo[] dirs = dir.GetDirectories(); }
public void Generate() { this.PrepareGeneration(); if (this.Diagnostics.HasErrors()) return; var namespaces = this.Model.Instances.OfType<Namespace>(); foreach (var ns in namespaces) { SpringClassGenerator springClassGen = new SpringClassGenerator(ns); SpringInterfaceGenerator springInterfaceGen = new SpringInterfaceGenerator(ns); SpringConfigurationGenerator springConfigGen = new SpringConfigurationGenerator(ns); SpringViewGenerator springViewGen = new SpringViewGenerator(ns); SpringGeneratorUtil generatorUtil = new SpringGeneratorUtil(ns); BindingDiscoverer bindingDiscoverer = new BindingDiscoverer(); DirectoryHandler directoryHandler = new DirectoryHandler(); DependencyDiscoverer dependencyDiscoverer = new DependencyDiscoverer(bindingDiscoverer); DataAccessFinder dataAccessFinder = new DataAccessFinder(bindingDiscoverer); JSFGenerator jSFGenerator = new JSFGenerator(springViewGen, generatorUtil, directoryHandler); ModelGenerator modelGenerator = new ModelGenerator(directoryHandler, springClassGen, springConfigGen, generatorUtil); ComponentGenerator componentGenerator = new ComponentGenerator(springInterfaceGen, springClassGen, springConfigGen, springViewGen, generatorUtil, bindingDiscoverer, directoryHandler, dependencyDiscoverer, dataAccessFinder, jSFGenerator); if (ns.Uri != null) { List<string> modules = new List<string>(); List<Struct> entities = new List<Struct>(); foreach (Database db in ns.Declarations.OfType<Database>()) { entities.AddRange(db.Entities); } List<Wire> wires = new List<Wire>(); foreach (Composite comppsoite in ns.Declarations.OfType<Composite>()) { foreach (Wire wire in comppsoite.Wires) { wires.Add(wire); } } Dictionary<string, string> properties = componentGenerator.GenerateComponent(ns, wires, modules); if (entities.Any() || ns.Declarations.OfType<Enum>().Any()) { modules.Add("Model"); modelGenerator.GenerateModelModule(ns, entities, properties); } // generate master pom.xml if (modules.Any()) { using (StreamWriter writer = new StreamWriter("pom.xml")) { writer.WriteLine(springConfigGen.GenerateMasterPom(ns, modules)); } } } } }