private void dcdBtn_Click(object sender, EventArgs e) { String folderPath = inputFileTxt.Text; // Read images images = fsr.readFiles(folderPath); DCDHandler dcdHandler = (DCDHandler)descFactory.getDescriptorHandler(DescHandlerFactory.Descriptor.DCD); if (outDirTxt.Text == null || outDirTxt.Text.Length == 0) { DialogResult outDirNotSetWarning = MessageBox.Show("Output Directory is not set. Results will be written to input directory. Continue?", "Warning", MessageBoxButtons.YesNo); if (outDirNotSetWarning == DialogResult.Yes) { FileSystemWriter fsw = new FileSystemWriter(inputFileTxt.Text + "\\ExistanceResult.txt"); FileSystemWriter fsw2 = new FileSystemWriter(inputFileTxt.Text + "\\PropotionResult.txt"); writeDCDInfo(dcdHandler, fsw, fsw2); } else { return; } } else { FileSystemWriter fsw = new FileSystemWriter(outDirTxt.Text + "\\ExistanceResult.txt"); FileSystemWriter fsw2 = new FileSystemWriter(outDirTxt.Text + "\\PropotionResult.txt"); writeDCDInfo(dcdHandler, fsw, fsw2); } }
protected override void OnStop() { base.OnStop(); //TODO: clean up any variables and stop any threads FileSystemWriter.WriteSomething("stopped"); }
static void Main(string[] args) { var input = System.Console.ReadLine(); IFileSystemWriter writer = new FileSystemWriter(); writer.WriteToFile(input); GlobalWriter.WriteFile(input); System.Console.Read(); }
private void writeDCDInfo(CLDHandler cldHandler, FileSystemWriter fsw) { foreach (KeyValuePair <string, Bitmap> image in images) { cldHandler.calcDescriptorInfo(image.Value); // write to file string[] pathParts = image.Key.Split('\\'); string imageNameAndExt = pathParts[pathParts.Length - 1]; string imageName = imageNameAndExt.Split('.').ElementAt(0); List <int[]> rgbList = cldHandler.RGBValues; Quantizer q = null; if (Reduce16PositionsCheck.Checked) { rgbList = cldHandler.getReduce64To16Cells(rgbList); } if (hsl_15_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_cld(Quantizer.BINS.BINS_15, rgbList); } else if (hsl_27_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_cld(Quantizer.BINS.BINS_27, rgbList); } else if (hsl_48_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_cld(Quantizer.BINS.BINS_48, rgbList); } else if (rgb_27_rb.Checked) { q = getQuantizer("COLOUR_27_QUANTIZER"); q.process_cld(Quantizer.BINS.BINS_27, rgbList); } else if (rgb_64_rb.Checked) { q = getQuantizer("COLOUR_27_QUANTIZER"); q.process_cld(Quantizer.BINS.BINS_64, rgbList); } else if (lab_x_rb.Checked) { q = getQuantizer("RGB_HISTOGRAM_QUANTIZER"); } fsw.writeFile(imageName, q.getList(Quantizer.FEATURE_VECTOR.POSITION)); } // close the connection fsw.closeFile(); MessageBox.Show("CLD DONE!"); }
public static void Main(string[] args) { //This is where we'll create an instance of our service and tell it to run. ServiceBase.Run(new Program()); if (args.Length != 0) { if (args[0] == "steveZOMBO") { //Console.WriteLine("BEGIN - Windows Service Timer Demo:"); FileSystemWriter.WriteSomething("BEGIN - Windows Service Timer Demo:"); //--Fun with Timers and Windows Services // Wait for user //Console.WriteLine("Writing something to file system:"); // Create a timer with a ten second interval. var aTimer = new System.Timers.Timer(2000); // Hook up the Elapsed event for the timer. aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Enabled = true; // Console.WriteLine("END - Windows Service Timer Demo:"); FileSystemWriter.WriteSomething("END - Windows Service Timer Demo:"); } else { FileSystemWriter.WriteSomething(string.Format("\n this will print one time and then not any more, and myArgs was {0}", args[0])); } } else { //---------------------------------------------------------------------------------------- ScreenHelper.Welcome(); ScreenHelper.ListOptions(); while (true) { //ScreenHelper.WritePrompt(); var userResponse = Console.ReadLine(); CommandManager.ParseCommand(userResponse); } //---------------------------------------------------------------------------------------- //Variable Initialization crap: //http://stackoverflow.com/questions/952503/c-sharp-variable-initialization-question //int //int i = 0; //Console.WriteLine("{0}", i); //---------------------------------------------------------------------------------------- } }
protected override void OnStart(string[] args) { System.Threading.Thread.Sleep(10000); //Windows svc start code: System.Diagnostics.Debugger.Launch(); string[] myArgs = { "steveZOMBO" }; //Main(args); base.OnStart(myArgs); //TODO: place your start code here FileSystemWriter.WriteSomething("started"); Main(myArgs); }
public async Task GetAllValues() { var client = new HttpClient(); client.BaseAddress = new Uri(@"http://localhost:33319/"); var response = (await client.GetAsync("api/values/0")).Content; var content = (await response.ReadAsStringAsync()); GlobalWriter.WriteFile(content); var writer = new FileSystemWriter(); writer.WriteToFile(content); Assert.AreEqual("ramya", content); }
private static void OnTimedEvent(Object source, ElapsedEventArgs e) { //Console.WriteLine("The Elapsed event was raised at {0}", e.SignalTime); FileSystemWriter.WriteSomething(string.Format("hello from program.cs - Main[] at {0}", e.SignalTime)); }
private void writeDCDInfo(DCDHandler dcdHandler, FileSystemWriter fsw, FileSystemWriter fsw2) { foreach (KeyValuePair <string, Bitmap> image in images) { dcdHandler.calcDescriptorInfo(image.Value); // write to file string[] pathParts = image.Key.Split('\\'); string imageNameAndExt = pathParts[pathParts.Length - 1]; string imageName = ""; string[] imageNameParts = imageNameAndExt.Split('.'); // To handle file names with '.' for (int i = 0; i < imageNameParts.Length - 1; i++) { imageName += imageNameParts[i]; if (i < imageNameParts.Length - 2) { imageName += "."; } } List <int[]> rgbpList = dcdHandler.DominantRGB; Quantizer q = null; if (hsl_15_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_15, rgbpList); } else if (hsl_27_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_27, rgbpList); } else if (hsl_48_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_48, rgbpList); } else if (rgb_27_rb.Checked) { q = getQuantizer("COLOUR_27_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_27, rgbpList); } else if (rgb_64_rb.Checked) { q = getQuantizer("COLOUR_27_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_64, rgbpList); } else if (lab_x_rb.Checked) { q = getQuantizer("RGB_HISTOGRAM_QUANTIZER"); } fsw.writeFile(imageName, q.getList(Quantizer.FEATURE_VECTOR.EXISTENCE)); // write propotion fsw2.writeFile(imageName, q.getList(Quantizer.FEATURE_VECTOR.PROPORTION)); } // close the connection fsw.closeFile(); fsw2.closeFile(); MessageBox.Show("DCD DONE!"); }