Esempio n. 1
0
 public TestToAdoNet()
 {
     _adoMet = new SelectAdo();
     _random = new Random();
     _count  = _adoMet.GetCount();
     _file   = new WriteToFile();
 }
Esempio n. 2
0
        static void Main()
        {
            try
            {
                object runSourceRestartParameters = null;
                while (true)
                {
                    __config = new XmlConfig(__configFile);
                    TraceManager.Current.AddTrace(Trace.Current);
                    //TraceManager.Current.SetWriter(__config.Get("Log").zRootPath(zapp.GetAppDirectory()), __config.Get("Log/@option").zTextDeserialize(FileOption.None));
                    TraceManager.Current.SetWriter(WriteToFile.Create(__config.Get("Log").zRootPath(zapp.GetAppDirectory()), __config.Get("Log/@option").zTextDeserialize(FileOption.None)));
                    //__traceUpdate = __config.Get("UpdateRunSource/TraceUpdate").zTryParseAs(false);
                    zUpdateFiles.Trace = __config.Get("UpdateRunSource/TraceUpdate").zTryParseAs(false);

                    UpdateRunSourceFiles();
                    Run(runSourceRestartParameters);
                    // attention récupérer RunSourceRestartParameters avant UpdateRunSourceFiles(), UpdateRunSourceFiles() fait AppDomain.Unload()
                    runSourceRestartParameters = __domain.GetData(__domainRestartParametersName);
                    if (runSourceRestartParameters == null)
                    {
                        break;
                    }
                    //__domain.DomainUnload += domain_DomainUnload;
                    //Trace.WriteLine("__domain.IsFinalizingForUnload() : {0}", __domain.IsFinalizingForUnload());
                    //Trace.WriteLine("AppDomain.Unload(__domain)");
                    AppDomain.Unload(__domain);
                    __domain = null;
                    //Trace.WriteLine("__domain.IsFinalizingForUnload() : {0}", __domain.IsFinalizingForUnload());
                }
            }
            catch (Exception ex)
            {
                zerrf.ErrorMessageBox(ex);
            }
        }
Esempio n. 3
0
        public WriteToFilePanel(WriteToFile aWriteToFile)
        {
            mWriteToFile = aWriteToFile;
            InitializeComponent();

            BackColor = SystemColors.Control;
        }
Esempio n. 4
0
        public static void Test_FindDate_03(FindDateManager_v1 findDateManager, string file)
        {
            file = zPath.Combine(GetDirectoryDate(), file);
            int year = Date.Today.Year;

            findDateManager.DateRegexList.Add("year", new RegexValues("year", "year", string.Format(@"(?:^|[_\s])({0}|{1}|{2})(?:$|[_\s])", year - 1, year, year + 1), "IgnoreCase", "year", compileRegex: true));

            string traceFile = zpath.PathSetFileNameWithoutExtension(file, zPath.GetFileNameWithoutExtension(file) + "_out");

            Trace.WriteLine("Test_FindDate \"{0}\" (nb date regex {1})", file, findDateManager.DateRegexList.Count);
            //Trace.CurrentTrace.DisableBaseLog();
            Trace.CurrentTrace.DisableViewer = true;
            //Trace.CurrentTrace.AddTraceFile(traceFile, LogOptions.RazLogFile);
            Trace.CurrentTrace.AddOnWrite("Test_FindDate_03", WriteToFile.Create(traceFile, FileOption.RazFile).Write);

            try
            {
                DateTime dt = DateTime.Now;
                TraceRegexValuesList(findDateManager.DateRegexList);
                Trace.WriteLine();

                string bsonFile = zpath.PathSetFileNameWithoutExtension(file, zPath.GetFileNameWithoutExtension(file) + "_bson");
                zMongo.BsonRead <TestText>(file).zFindDate(findDateManager).zSave(bsonFile);
                zMongo.BsonRead <TestFindDate>(bsonFile).zTraceFindDate();
                Trace.WriteLine("test duration {0}", DateTime.Now - dt);
            }
            finally
            {
                //Trace.CurrentTrace.EnableBaseLog();
                //Trace.CurrentTrace.RemoveTraceFile(traceFile);
                Trace.CurrentTrace.RemoveOnWrite("Test_FindDate_03");
                Trace.CurrentTrace.DisableViewer = false;
            }
        }
Esempio n. 5
0
        public static void Test_FindDate_04(FindDateManager findDateManager, string file)
        {
            file = zPath.Combine(GetDirectoryDate(), file);

            string traceFile = zpath.PathSetFileNameWithoutExtension(file, zPath.GetFileNameWithoutExtension(file) + "_new_out");
            string bsonFile  = zpath.PathSetFileNameWithoutExtension(file, zPath.GetFileNameWithoutExtension(file) + "_new_bson");

            Trace.WriteLine("Test_FindDate \"{0}\" (nb date regex {1})", file, findDateManager.DateRegexList.Count);
            //Trace.CurrentTrace.DisableBaseLog();
            Trace.CurrentTrace.DisableViewer = true;
            //Trace.CurrentTrace.AddTraceFile(traceFile, LogOptions.RazLogFile);
            Trace.CurrentTrace.AddOnWrite("Test_FindDate_04", WriteToFile.Create(traceFile, FileOption.RazFile).Write);

            try
            {
                DateTime dt = DateTime.Now;
                TraceRegexValuesList(findDateManager.DateRegexList);
                Trace.WriteLine();

                zMongo.BsonRead <TestText>(file).zFindDateNew(findDateManager).zSave(bsonFile);
                zMongo.BsonRead <TestFindDate>(bsonFile).zTraceFindDate();
                Trace.WriteLine("test duration {0}", DateTime.Now - dt);
            }
            finally
            {
                //Trace.CurrentTrace.EnableBaseLog();
                //Trace.CurrentTrace.RemoveTraceFile(traceFile);
                Trace.CurrentTrace.RemoveOnWrite("Test_FindDate_04");
                Trace.CurrentTrace.DisableViewer = false;
            }
        }
Esempio n. 6
0
        public static void Test_FindDate_01(RegexValuesList dateRegexList, string file)
        {
            file = zPath.Combine(GetDirectoryDate(), file);
            string traceFile = zpath.PathSetFileNameWithoutExtension(file, zPath.GetFileNameWithoutExtension(file) + "_out");

            Trace.WriteLine("Test_FindDate \"{0}\" (nb date regex {1})", file, dateRegexList.Count);
            //Trace.CurrentTrace.DisableBaseLog();
            Trace.CurrentTrace.DisableViewer = true;
            //Trace.CurrentTrace.AddTraceFile(traceFile, LogOptions.RazLogFile);
            Trace.CurrentTrace.AddOnWrite("Test_FindDate_01", WriteToFile.Create(traceFile, FileOption.RazFile).Write);
            try
            {
                TraceRegexValuesList(dateRegexList);
                Trace.WriteLine();
                foreach (BsonDocument document in zMongo.BsonRead <BsonDocument>(file))
                {
                    FindDate(dateRegexList, document["text"].AsString);
                }
            }
            finally
            {
                //Trace.CurrentTrace.EnableBaseLog();
                //Trace.CurrentTrace.RemoveTraceFile(traceFile);
                Trace.CurrentTrace.RemoveOnWrite("Test_FindDate_01");
                Trace.CurrentTrace.DisableViewer = false;
            }
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            WriteToFile wr = new WriteToFile();

            wr.DataWrite();
            Console.ReadKey();
        }
Esempio n. 8
0
 public Application(IOutput output)
 {
     this.output      = output;
     this.readToFile  = new ReadToFile();
     this.writeToFile = new WriteToFile();
     this.toDoList    = new ToDoList();
 }
Esempio n. 9
0
 /// <summary>
 /// Print base band signal
 /// </summary>
 /// <param name="fHandler"></param>
 /// <param name="baseBandSignal"></param>
 static void SignalOutput(WriteToFile fHandler, List <Complex> ordinate)
 {
     for (int i = 0; i < ordinate.Count; i++)
     {
         fHandler.Data(i, ordinate.ElementAt(i).Magnitude);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// method Main
        /// entery point
        /// </summary>
        /// <param name="args">args[0] - sender address
        ///                    args[1] - destination address
        ///                    args[2] - type of initial file</param>
        static void Main(string[] args)
        {
            try
            {
                if (args[2] == "xml")
                {
                    var           xmlParser    = new XMLParser(args[0]);
                    List <string> parsedResult = xmlParser.ToParseXML();

                    WriteToFile writer = new WriteToFile(args[1]);
                    writer.WriteToJSON(parsedResult);
                }
                else
                {
                    JSONParser    jsonParser   = new JSONParser(args[0]);
                    List <string> parsedResult = jsonParser.ToParseJSON();

                    WriteToFile writer = new WriteToFile(args[1]);
                    writer.WriteToXML(parsedResult);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 11
0
        public static void Control_RegexValues_02()
        {
            string file    = @"control\print_filenames_01.txt";
            string logFile = @"control\print_filenames_01_regex.txt";

            logFile = zPath.Combine(XmlConfig.CurrentConfig.GetExplicit("DataDir"), logFile);
            Trace.WriteLine("write to file \"{0}\"", logFile);
            //Trace.CurrentTrace.AddTraceFile(logFile, LogOptions.RazLogFile);
            Trace.CurrentTrace.AddOnWrite("Print_Exe", WriteToFile.Create(logFile, FileOption.RazFile).Write);
            Trace.WriteLine("Control RegexValues :");
            Trace.WriteLine("  file : \"{0}\"", file);
            Trace.WriteLine("  log  : \"{0}\"", logFile);
            Trace.WriteLine();
            IEnumerable <XElement> els = XmlConfig.CurrentConfig.GetElements("Print/Filenames/Filename");

            string[] lines = zfile.ReadAllLines(zPath.Combine(XmlConfig.CurrentConfig.GetExplicit("DataDir"), file));
            foreach (string line in lines)
            {
                if (line != "")
                {
                    Test_Exe.Test_RegexValues(els, line);
                }
                //else
                //    Trace.WriteLine();
            }
            //Trace.CurrentTrace.RemoveTraceFile(logFile);
            Trace.CurrentTrace.RemoveOnWrite("Print_Exe");
        }
Esempio n. 12
0
        public void export()
        {
            Randomizer  randomizer  = new Randomizer();
            WriteToFile writeToFile = new WriteToFile();

            writeToFile.write("employee.csv", randomizer.getData("Employee"), "employee");
        }
Esempio n. 13
0
 public TestToEntityFramework()
 {
     _ef     = new SelectDataEF();
     _random = new Random();
     _count  = _ef.GetProducts().Count();
     _file   = new WriteToFile();
 }
Esempio n. 14
0
 public TestToDapper()
 {
     _dapper = new SelectDapper();
     _random = new Random();
     _count  = _dapper.GetCount();
     _file   = new WriteToFile();
 }
Esempio n. 15
0
        public static void Test_CalculatePrintDate_01(Print print, string directory, int printNumber, int nb)
        {
            string traceFile = zPath.Combine(directory, @"Print\CalculatePrintDateNumber", string.Format("Print_{0}_Date.txt", print.Name));

            Trace.WriteLine("print {0} frequency {1} calculate date from number {2} nb {3} trace file \"{4}\"", print.Name, print.Frequency, printNumber, nb, zPath.GetFileName(traceFile));
            //Trace.CurrentTrace.DisableBaseLog();
            Trace.CurrentTrace.DisableViewer = true;
            //Trace.CurrentTrace.AddTraceFile(traceFile, LogOptions.RazLogFile);
            Trace.CurrentTrace.AddOnWrite("Test_CalculatePrintDate_01", WriteToFile.Create(traceFile, FileOption.RazFile).Write);
            try
            {
                Trace.WriteLine("print {0} frequency {1} calculate date from number {2} nb {3}", print.Name, print.Frequency, printNumber, nb);
                Trace.WriteLine();
                for (int i = 0; i < nb; i++)
                {
                    PrintIssue issue = print.NewPrintIssue(printNumber);
                    Trace.WriteLine("{0:yyyy-MM-dd ddd} {1}", issue.Date, printNumber);
                    printNumber++;
                }
            }
            finally
            {
                //Trace.CurrentTrace.EnableBaseLog();
                //Trace.CurrentTrace.RemoveTraceFile(traceFile);
                Trace.CurrentTrace.RemoveOnWrite("Test_CalculatePrintDate_01");
                Trace.CurrentTrace.DisableViewer = false;
            }
        }
        static async Task Main(string[] args)
        {
            //Reading from file
            ReadFromFile CsvFile     = new ReadFromFile();
            var          entities    = CsvFile.FileReading();
            var          dataService = new AnswerDataService();

            try
            {
                await dataService.InsertData(entities, ConstantHelper.accountName, ConstantHelper.accountKey, ConstantHelper.firstTableName);
            }
            catch (Exception ex)
            {
                var v = ex;
            }

            //Reading from Table
            DataFromTableService tableData = new DataFromTableService();
            var DataTable = new List <AnswerEntities>();

            try
            {
                DataTable = await tableData.OutputData <AnswerEntities>(ConstantHelper.accountName, ConstantHelper.accountKey, ConstantHelper.firstTableName);
            }
            catch (Exception ex)
            {
                var v = ex;
            }

            var templInsert   = new InsertAnalizedDatas();
            var processedData = templInsert.InserTAfterAnalized(DataTable);

            try
            {
                await dataService.InsertData(processedData, ConstantHelper.accountName, ConstantHelper.accountKey, ConstantHelper.secondTableName);
            }
            catch (Exception ex)
            {
                var v = ex;
            }

            //write to csv file data from table FinnalyData

            var DataToCSV = new List <AnalyzedDatasEntities>();

            try
            {
                DataToCSV = await tableData.OutputData <AnalyzedDatasEntities>(ConstantHelper.accountName, ConstantHelper.accountKey, ConstantHelper.secondTableName);
            }
            catch (Exception ex)
            {
                var v = ex;
            }

            var FileWriter = new WriteToFile();

            FileWriter.WriteToCSV(DataToCSV);
            Console.WriteLine("Press any key");
            Console.ReadKey();
        }
Esempio n. 17
0
        private void button2_Click(object sender, EventArgs e)
        {
            string path = GetFileName(this.dateTime.Year.ToString());

            if (path != null)
            {
                string text = GetCalendar();
                if (radioButton1.Checked)
                {
                    writeInFile = WriteToPDFDocument;
                }
                else if (radioButton2.Checked)
                {
                    writeInFile = WriteToWordDocument;
                }
                else
                {
                    writeInFile = WriteToTextFile;
                }
                if (writeInFile.Invoke(text, path))
                {
                    Process.Start(path);
                }
            }
        }
Esempio n. 18
0
File: pt.cs Progetto: 24/source_04
        //private static XmlConfig _config = new XmlConfig("pt_config.xml");

        public static void Main(string[] args)
        {
            try
            {
                //Trace.CurrentTrace.SetLogFile(null, LogOptions.LogToConsole);
                Trace.CurrentTrace.SetViewer(Console.Out.Write);
                //string log = _config.Get("Log").zRootPath(zapp.GetEntryAssemblyDirectory());
                //if (log != null)
                //{
                //    //Trace.WriteLine("log to \"{0}\"", log);
                //    //Trace.AddTraceFile(log, LogOptions.IndexedFile);
                //    Trace.CurrentTrace.AddTraceFile(log);
                //}
                Trace.CurrentTrace.SetWriter(WriteToFile.Create(_config.Get("Log").zRootPath(zapp.GetEntryAssemblyDirectory()), _config.Get("Log/@option").zTextDeserialize(FileOption.None)));
                string path = _config.Get("PrintConfig");
                if (path != null)
                {
                    //Trace.WriteLine("load print config \"{0}\"", path);
                    _printConfig = new XmlConfig(path);
                }
                pt(args);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
                Trace.WriteLine(ex.StackTrace);
            }
        }
Esempio n. 19
0
        public void UnitTestEvaluateTwoChecksMethod()
        {
            string currentDirectory = (Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + @"\Comparer\bin\Debug");
            List <FromFileToStruct.Product> currentCheck = new List <FromFileToStruct.Product>();

            List <FromFileToStruct.Product> fullDatabase = new List <FromFileToStruct.Product>();

            fullDatabase = FromFileToStruct.MakeProductList2(currentDirectory + "\\FullDatabase.txt");

            var maxima = from a in fullDatabase where a.shop == "maxima" select a;
            var rimi   = from a in fullDatabase where a.shop == "rimi" select a;

            currentCheck = FromFileToStruct.MakeProductList(currentDirectory + "\\TempResult.txt");

            WriteToFile write    = new WriteToFile();
            string      infoFile = write.Write(currentDirectory, 1);

            float expectedMin = -1000;
            float expectedMax = 1000;

            Comparer.CompareShops x = new Comparer.CompareShops();
            float actual            = x.EvaluateTwoChecks(currentCheck, maxima, write, infoFile);

            Assert.IsTrue(actual >= expectedMin && actual <= expectedMax);
        }
Esempio n. 20
0
        public void WriteStringToFileTest_CallsWriteToFileWithNullName_ShouldNotWriteToFile()
        {
            var    fileTxt = new WriteToFile();
            string test    = "Error";

            fileTxt.WriteStringToFile(null, test);
            Assert.AreEqual(false, File.Exists(null));
        }
Esempio n. 21
0
 public Decode(Data_Frame_Header_Info _frameHeaderInfo, byte[] _frameData, Stream _input, string _filename, WriteToFile write)
 {
     frameHeaderInfo = _frameHeaderInfo;
     frame_data      = _frameData;
     input           = _input;
     filename        = _filename;
     _write          = write;
 }
Esempio n. 22
0
        public LoadImageFormPresenter(LoadImageForm form)
        {
            calculateParams = new CalculateImageParams();
            writer          = new WriteToFile();

            formWindow    = form;
            erroreMessage = "";
        }
Esempio n. 23
0
File: Run.cs Progetto: 24/source_04
 public static void InitAlways()
 {
     XmlConfig.CurrentConfig = new XmlConfig(RunSourceCommand.GetFilePath("anki.config.xml"));
     //XmlConfig config = XmlConfig.CurrentConfig;
     //TraceManager.Current.SetWriter(WriteToFile.Create(@"log\log.txt", FileOption.None));
     RunSourceCommand.TraceManager.SetWriter(WriteToFile.Create(RunSourceCommand.GetFilePath(@"log\log.txt"), FileOption.None));
     Trace.WriteLine($"set log file to \"{RunSourceCommand.TraceManager.GetWriter().File}\"");
 }
Esempio n. 24
0
        public void WriteStringToFileTest_CallsWriteToFileWithNullText_ShouldNotWriteToFile()
        {
            var    fileTxt = new WriteToFile();
            string test    = null;

            fileTxt.WriteStringToFile(fileTxt.PathAndFileName, test);
            Assert.AreEqual(false, File.Exists(fileTxt.PathAndFileName));
        }
Esempio n. 25
0
        public void Send(WriteToFile message)
        {
            string name         = Context.QueryString["UserName"];
            string connectionId = Context.ConnectionId;
            var    connId       = _connections.GetConnections(name).SingleOrDefault(x => x.Equals(connectionId));

            Clients.AllExcept(connId).sendNotification(message);
        }
Esempio n. 26
0
        public void export()
        {
            Randomizer randomizer = new Randomizer();

            WriteToFile writeToFile = new WriteToFile();

            writeToFile.write("customer.csv", randomizer.getData("Customer"), "customer");
        }
Esempio n. 27
0
 public Decoder(Stream _input, string filename, MainWindow win, PcmDatas pcmDatas)
 {
     input     = _input;
     _filename = filename;
     _win      = win;
     _pcmDatas = pcmDatas;
     //初始化文件写入类
     write = new WriteToFile(_filename, pcmDatas);
 }
Esempio n. 28
0
        static void Main()
        {
            try
            {
                // load runsource.runsource.config.xml (config of runsource.runsource.exe)
                XmlConfig config = new XmlConfig();
                FormatInfo.SetInvariantCulture();
                Application.CurrentCulture = FormatInfo.CurrentFormat.CurrentCulture;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                RemoteRunSource remoteRunSource = new RemoteRunSource();
                remoteRunSource.RunsourceDllFilename  = config.GetExplicit("RunsourceDllFilename");
                remoteRunSource.RunsourceClassName    = config.GetExplicit("RunsourceClassName");
                remoteRunSource.TraceManagerClassName = config.GetExplicit("TraceManagerClassName");
                remoteRunSource.TraceClassName        = config.GetExplicit("TraceClassName");
                // ATTENTION si CreateRunSourceDomain = true runsource.launch.exe ne peut pas mettre à jour runsource.runsource.exe
                remoteRunSource.CreateRunSourceDomain = config.Get("CreateRunSourceDomain").zTryParseAs <bool>(false);
                IRunSource runSource = remoteRunSource.GetRunSource();
                //remoteRunSource.LoadRunsourceCommand();
                //runSource.AllowMultipleExecution = config.Get("AllowMultipleExecution").zTryParseAs(false);
                ///////////////////////// donc il faut utiliser RemoteRunSource.GetTrace()
                //ITrace trace = remoteRunSource.GetTrace();
                //trace.SetWriter(config.Get("Log"), config.Get("Log/@option").zTextDeserialize(FileOption.None));

                // ATTENTION Trace exists in both 'runsource.runsource.exe' and 'runsource.dll'
                // both Trace are connected to TraceManager and can be used
                string     logFile       = config.Get("Log");
                FileOption logFileOption = config.Get("Log/@option").zTextDeserialize(FileOption.None);
                TraceManager.Current.AddTrace(Trace.Current);
                //TraceManager.Current.SetWriter(logFile, logFileOption);
                TraceManager.Current.SetWriter(WriteToFile.Create(logFile, logFileOption));

                ITraceManager remoteTraceManager = remoteRunSource.GetTraceManager();
                remoteTraceManager.AddTrace(remoteRunSource.GetTrace());
                //remoteTraceManager.SetWriter(logFile, logFileOption);
                remoteTraceManager.SetWriter(WriteToFile.Create(logFile, logFileOption));

                // ATTENTION appeler DeleteGeneratedAssemblies() après SetRunSourceConfig()
                //RunSourceForm form = new RunSourceForm(runSource, trace, config, GetRunSourceRestartParameters());
                //RunSourceForm_v3 form = new RunSourceForm_v3(runSource, trace, config, GetRunSourceRestartParameters());
                //RunSourceFormExe form = new RunSourceFormExe(runSource, trace, config, GetRunSourceRestartParameters());
                RunSourceFormExe form = new RunSourceFormExe(runSource, config, remoteRunSource, GetRunSourceRestartParameters());
                RunSourceFormExe.Current = form;

                form.SetRestartRunsource += FormSetRestartRunsource;
                Application.Run(form);

                TraceManager.Current.RemoveTrace(Trace.Current);
                TraceManager.Current.RemoveTrace(remoteRunSource.GetTrace());
                SetRunSourceRestartParameters();
            }
            catch (Exception ex)
            {
                zerrf.ErrorMessageBox(ex);
            }
        }
Esempio n. 29
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Write textbox text to DNote file
            WriteToFile cls = new WriteToFile();

            cls.AppendLineToDNoteFile(tbxDNoteText.Text);

            //Call the method to reload the updated file path from settings
            GetDNoteFilePathFromSettings();
        }
Esempio n. 30
0
        public void WriteStringToFileTest_CallsWriteTofileWithString_ShouldWriteToFile()
        {
            var          fileTxt = new WriteToFile();
            const string test    = "Hello";

            fileTxt.WriteStringToFile("error", test);

            var expected = File.ReadAllLines(fileTxt.PathAndFileName);

            Assert.AreEqual(expected[0], test);
        }
Esempio n. 31
0
        public static IWriteTo GetObject(WriteTo writeTo)
        {
            IWriteTo ObjSelector = null;

            switch (writeTo)
            {
                case WriteTo.WriteToDataBase:
                    { ObjSelector = new WriteToDatabse(); }
                    break;
                case WriteTo.WriteToFile:
                    { ObjSelector = new WriteToFile(); }
                    break;
            }

            return ObjSelector;
        }