Esempio n. 1
0
        public static async Task CreateGzipAsync(FileSystemStorageFile Source, string NewZipPath, CompressionLevel Level, ProgressChangedEventHandler ProgressHandler = null)
        {
            if (Level == CompressionLevel.Undefine)
            {
                throw new ArgumentException("Undefine is not allowed in this function", nameof(Level));
            }

            if (await FileSystemStorageItemBase.CreateAsync(NewZipPath, StorageItemTypes.File, CreateOption.GenerateUniqueName).ConfigureAwait(false) is FileSystemStorageFile NewFile)
            {
                using (FileStream SourceFileStream = await Source.GetFileStreamFromFileAsync(AccessMode.Read))
                    using (FileStream NewFileStream = await NewFile.GetFileStreamFromFileAsync(AccessMode.Exclusive))
                        using (GZipOutputStream GZipStream = new GZipOutputStream(NewFileStream))
                        {
                            GZipStream.SetLevel((int)Level);
                            GZipStream.IsStreamOwner = false;
                            GZipStream.FileName      = Source.Name;

                            await SourceFileStream.CopyToAsync(GZipStream, ProgressHandler : ProgressHandler).ConfigureAwait(false);
                        }
            }
            else
            {
                throw new UnauthorizedAccessException();
            }
        }
Esempio n. 2
0
        public void GetUserChoice()
        {
            Console.Write("\nOption: ");
            string userChoice = Console.ReadLine();

            switch (userChoice)
            {
            case "1":     //Create new file if user chooses 1
            {
                NewFile file = new NewFile();
                file.createNewFile();
                break;
            }

            case "2":     //Open file if user chooses 2
            {
                OpenFile file = new OpenFile();
                file.displayFile();
                break;
            }

            default:     //Defaults to re-enter the value if input isn't '1' or '2'
            {
                Console.WriteLine("\n****Incorrect Input, enter either 1 for New File or 2 to Open file****");
                GetUserChoice();
                break;
            }
            }
        }
        private void MenuItemFile_Click(object sender, RoutedEventArgs e)
        {
            NewFile NewWindow = new NewFile();

            this.Close();
            NewWindow.Show();
        }
Esempio n. 4
0
        public bool Save(string filePath)
        {
            try {
                foreach (TextEntity text in Texts)
                {
                    text.ReinsertLines();
                }

                UInt32 newExportsAddress        = StartPosition + GetActionsLength() + 12;             // + EXPORT_DATA.Length
                UInt32 newCollectionLinkAddress = newExportsAddress + ExportsCount * EXPORT_SIZE + 16; // + COLLECTION_LINK.length

                StartData = ByteUtil.InsertUint32(StartData, newExportsAddress, HEADER_OFFSET);
                StartData = ByteUtil.InsertUint32(StartData, newCollectionLinkAddress, HEADER_OFFSET + 3 * 4);

                NewFile.AddRange(StartData);

                WriteActions();
                WriteExports();
                WriteCollectionLink();

                File.WriteAllBytes(filePath, NewFile.ToArray());
                return(true);
            }
            catch (Exception e) {
                Console.WriteLine(e);
                return(false);
            }
        }
Esempio n. 5
0
        public void Run()
        {
            try
            {
                fs     = new FileStream(fichName, FileMode.Open, FileAccess.Read);
                client = new UdpClient();

                bFile = Encoding.UTF8.GetBytes(fichName);

                Packet newFile = new NewFile((int)PacketBodyType.NewFile, bFile.Length, bFile);

                bSent = encoding.Encode(newFile);

                client.Send(bSent, bSent.Length, SERVER, SERVERPORT);

                ChangeState(new WaitConfirmation(this));

                while (!finish)
                {
                    _state.HandleMessage();
                }

                Console.WriteLine("Transferencia del archivo finalizada");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: {0}", e.Message);
            }
            finally
            {
                client.Close();
            }
            Console.ReadKey();
        }
Esempio n. 6
0
 /// <summary>
 /// Set current key.
 /// </summary>
 private void SetCurrentKey()
 {
     if (NewFile.Trim().Length > 0)
     {
         if (OldFile.Trim().Length > 0)
         {
             _currentKey = "[" + NewFile + "]-[" + OldFile + "]";
         }
         else
         {
             _currentKey = "[" + NewFile + "]-[?]";
         }
     }
     else
     {
         if (OldFile.Trim().Length > 0)
         {
             _currentKey = "[?]-[" + OldFile + "]";
         }
         else
         {
             _currentKey = string.Empty;
         }
     }
 }
 /// <summary>
 ///     Método para visualizar o arquivo
 /// </summary>
 /// <param name="root"></param>
 /// <param name="userName"></param>
 public void View(string userName)
 {
     if (!this._root.SelectedNode.Text.Contains("."))
     {
         MessageBox.Show(
             "Não é possível visualizar um diretório!",
             "Error",
             MessageBoxButtons.OK,
             MessageBoxIcon.Error);
     }
     else
     {
         var file = this._generalController.ViewFile(this._root, userName);
         if (file == null)
         {
             MessageBox.Show(
                 "O arquivo foi bloqueado para visualizações pelo autor!",
                 "Error",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Error);
         }
         else
         {
             var newFile = new NewFile(
                 this._root,
                 file.Nome,
                 file.Conteudo,
                 new[] { file.Permissoes.Leitura, file.Permissoes.Escrita, file.Permissoes.Execucao },
                 true,
                 true,
                 userName);
             newFile.ShowDialog();
         }
     }
 }
Esempio n. 8
0
        public void Test_Same_Let()
        {
            //arrange
            string     word1_test = "JOHRTAD";
            string     word2_test = "RFGO";
            List <int> test_1     = new List <int>()
            {
                1, 3
            };
            List <int> test_2 = new List <int>()
            {
                3, 0
            };
            List <List <int> > expect_result = new List <List <int> >();

            expect_result.Add(test_1);
            expect_result.Add(test_2);
            //act
            NewFile            nf         = new NewFile();
            List <List <int> > act_result = nf.same_letter(word1_test, word2_test);

            //assert
            for (int i = 0; i < act_result.Count; i++)
            {
                Assert.AreEqual(expect_result[i][0], act_result[i][0], "Same letter index for word 1 is wrong");
                Assert.AreEqual(expect_result[i][1], act_result[i][1], "Same letter index for word 2 is wrong");
            }
        }
            public async Task CanEdit()
            {
                var pipedrive = Helper.GetAuthenticatedClient();
                var fixture   = pipedrive.File;

                var newFile = new NewFile(new RawFile(
                                              "image.jpg",
                                              ReadFile(GetFileFromPath(@"./Fixtures/image.jpg")),
                                              "image/jpg"))
                {
                    DealId = 1
                };

                var file = await fixture.Create(newFile);

                var editFile = file.ToUpdate();

                editFile.Name        = "updated-name";
                editFile.Description = "updated-description";

                var updatedFile = await fixture.Edit(file.Id, editFile);

                Assert.Equal("updated-name", updatedFile.Name);
                Assert.Equal("updated-description", updatedFile.Description);
            }
        /// <summary>
        ///     Método para criar um arquivo
        /// </summary>
        /// <param name="root"></param>
        /// <param name="lblLogin"></param>
        public void File(string userName)
        {
            var permitions = new GeneralController().PermitionsUser(userName);

            if (permitions[0])
            {
                if (this._root.SelectedNode.Text.Contains(".txt"))
                {
                    MessageBox.Show(
                        "Não é possível criar um arquivo dentro de outro arquivo!",
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
                else
                {
                    var newFile = new NewFile(this._root, null, null, null, false, false, userName);
                    newFile.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show(
                    "Você não tem permissão para criar um arquivo!",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }
            public async Task CanDelete()
            {
                var pipedrive = Helper.GetAuthenticatedClient();
                var fixture   = pipedrive.File;

                var newFile = new NewFile(new RawFile(
                                              "image.jpg",
                                              ReadFile(GetFileFromPath(@"./Fixtures/image.jpg")),
                                              "image/jpg"))
                {
                    DealId = 1
                };

                var file = await fixture.Create(newFile);

                var createdFile = await fixture.Get(file.Id);

                Assert.NotNull(createdFile);

                await fixture.Delete(createdFile.Id);

                var deletedFile = await fixture.Get(createdFile.Id);

                Assert.False(deletedFile.ActiveFlag);
            }
Esempio n. 12
0
        private void ProcessFileEntry(FileEntry fileEntry)
        {
            //Get rid of any streams that will be empty
            if (fileEntry.Filesize == 0)
            {
                fileEntry.Stream?.Dispose();
                fileEntry.Stream = null;
            }

            //Add to the correct
            if (fileEntry.IsDeltaFile())
            {
                DeltaFile.Add(fileEntry);
                return;
            }

            if (fileEntry.IsNewFile())
            {
                NewFile.Add(fileEntry);
                return;
            }

            if (fileEntry.DeltaExtension.EndsWith("load"))
            {
                LoaderFile = fileEntry;
                return;
            }

            SameFile.Add(fileEntry);
        }
Esempio n. 13
0
    /// <summary>
    /// Reloads part of the menu providing file related actions.
    /// </summary>
    public void UpdateActionsMenu()
    {
        // Initialize actions menu
        SetupControls();

        // Apply updated information
        NewFile.ReloadData();
    }
Esempio n. 14
0
        public void TestMethod2()
        {
            string[] param  = { "1", "2", "3", "4" };
            var      myVar  = new NewFile();
            var      result = myVar.checkParam(param, "rectangle");

            Assert.IsTrue(result);
        }
Esempio n. 15
0
        public void TestMethod1()
        {
            string[] param  = { "1", "2", "3", "4" };
            var      myVar  = new NewFile();
            var      result = myVar.checkParamValue(param);

            Assert.IsFalse(result);
        }
Esempio n. 16
0
        public StartScreen(NewFile newFileHandler, OpenFile openFileHandler) :
            base(Gtk.WindowType.Toplevel)
        {
            this.newFileHandler  = newFileHandler;
            this.openFileHandler = openFileHandler;

            this.Build();
        }
Esempio n. 17
0
        /// <summary>
        /// Method to apply a .diff file to a new Roslyn source file. A small amount of "fuzziness" is
        /// accepted to take into account that the new file may have been updated in a new revision.
        /// But the lines noted as unchanged and removed must not have been changed by the revision.
        /// </summary>
        private static void DoFuzzyPatch(string diffFileFilename, string newFileFilename)
        {
            // Read the two files into storage as lines of text
            string[] diffLines = File.ReadAllLines(diffFileFilename);
            NewFile  newFile   = new NewFile(File.ReadAllLines(newFileFilename));

            // Check the "new" file has not already been updated once. (This assumes .cs files will
            //  have C# comments and/or identifier names that include "Yacks", and .csproj files will
            //  reference the YacksCore assembly.)
            if (newFile.NewFileLines.Exists((string x) => x.Contains("Yacks")))
            {
                Console.WriteLine("File has already been updated once: " + newFileFilename);
                return;
            }

            // Check first two lines in .diff file look like they should, "---" and "+++"
            if (diffLines.Length < 3 || diffLines[0].Substring(0, 3) != "---" ||
                diffLines[1].Substring(0, 3) != "+++")
            {
                DisplayErrorOrInfo("Corrupt .diff file, invalid prefix lines: " + diffFileFilename);
                return;
            }
            int diffIndex = 2;              // Current zero-based location in the .diff file

            // Loop to process the "hunks" in the .diff file
            while (true)
            {
                // Find and check the next "hunk" in the .diff file
                DiffHunk diffHunk = GetNextDiffHunk(diffFileFilename, diffLines, ref diffIndex);
                if (diffHunk == null)
                {
                    return;                      // Error encountered
                }
                if (diffHunk.DiffLines == null)
                {
                    break;                      // No more hunks in .diff file
                }
                // Try to find the location in the new file that matches this hunk
                int newFileIndex = newFile.FindHunkLocation(diffHunk);
                if (newFileIndex == -1)
                {
                    DisplayErrorOrInfo("Unable to find location to apply .diff file 'hunk' at line " +
                                       diffHunk.DiffLineIndex + " for file " + diffFileFilename);
                    return;
                }

                // Apply the .diff file "hunk"
                newFile.ApplyHunk(diffHunk, newFileIndex);
            }

            // Processing was successful if we get to here. Write the result to the disk and display
            //  some info on the console.
            WriteToDisk(newFileFilename, newFile.NewFileLines);
            Console.WriteLine("File in new revision updated: " + newFileFilename);
            Console.WriteLine(string.Format(CultureInfo.InvariantCulture,
                                            "  Lines removed = {0}, lines added = {1}, displacement = {2}.",
                                            newFile.LinesRemoved, newFile.LinesAdded, newFile.DisplacementFactor));
        }
Esempio n. 18
0
        private void WriteActions()
        {
            SetAddresses();

            foreach (Action action in Actions)
            {
                NewFile.AddRange(action.Write());
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Создание файла для нового словаря
        /// </summary>
        public void CreateNewDictionary()
        {
            Console.WriteLine("Введите название нового файла");
            string       name = Console.ReadLine();
            StreamWriter sw   = new StreamWriter($@"{newFolder.FullName}\{name}.txt", true);

            sw.Close();
            NewFile?.Invoke();
        }
        public Parser Create(
            EnvironmentInit environmentInit = null,
            NewFile newFile                     = null,
            PluginInstall pluginInstall         = null,
            PluginUninstall pluginUninstall     = null,
            PluginList pluginList               = null,
            SetUsername setEnvironmentSetting   = null,
            TemplateInstall templateInstall     = null,
            TemplateUninstall templateUninstall = null)
        {
            // if environmentInit hasn't been provided (for testing) then assign the Command Handler
            environmentInit ??= EnvironmentInitHandler.ExecuteAsync;
            newFile ??= NewFileHandler.ExecuteAsync;
            pluginInstall ??= PluginInstallHandler.ExecuteAsync;
            pluginUninstall ??= PluginUninstallHandler.ExecuteAsync;
            pluginList ??= PluginListHandler.ExecuteAsync;
            setEnvironmentSetting ??= SetEnvironmentSettingHandler.ExecuteAsync;
            templateInstall ??= TemplatePackageInstallerHandler.ExecuteAsync;
            templateUninstall ??= TemplatePackageUninstallerHandler.ExecuteAsync;

            // Set up intrinsic commands that will always be available.
            RootCommand rootCommand = Root();

            rootCommand.AddCommand(Environment());
            rootCommand.AddCommand(NewFile());
            rootCommand.AddCommand(Plugins());
            rootCommand.AddCommand(Templates());

            var commandBuilder = new CommandLineBuilder(rootCommand);

            try
            {
                foreach (Command command in this.commandPluginHost.Discover(this.appEnvironment.PluginPaths))
                {
                    commandBuilder.AddCommand(command);
                }
            }
            catch (DirectoryNotFoundException)
            {
                // If this is the first run, initialize the environment and default plugins
                Console.WriteLine("Error Detected: vellum environment uninitialized.");
                Parser parser = commandBuilder.UseDefaults().Build();

                int result = parser.Invoke("environment init");

                if (result == ReturnCodes.Ok)
                {
                    // Now the environment has been re-initialized, try to discover the plugins again.
                    foreach (Command command in this.commandPluginHost.Discover(this.appEnvironment.PluginPaths))
                    {
                        commandBuilder.AddCommand(command);
                    }
                }
            }

            return(commandBuilder.UseDefaults().Build());
Esempio n. 21
0
        private void WriteExports()
        {
            NewFile.AddRange(EncodingUtil.encoding.GetBytes("EXPORT_DATA"));
            NewFile.Add(new byte());

            foreach (Export export in Exports)
            {
                NewFile.AddRange(export.Write());
            }
        }
Esempio n. 22
0
        private void WriteCollectionLink()
        {
            NewFile.AddRange(EncodingUtil.encoding.GetBytes("COLLECTION_LINK"));
            NewFile.Add(new byte());
            NewFile.AddRange(BitConverter.GetBytes(0));

            UInt32 newCollectionLinkAddress = (UInt32)NewFile.Count + 4 + COLLECTION_LINK_PADDING;

            NewFile.AddRange(BitConverter.GetBytes(newCollectionLinkAddress));
            NewFile.AddRange(new byte[COLLECTION_LINK_PADDING]);
        }
Esempio n. 23
0
        public void CheckOut()
        {
            int userId = GetUserId();

            NewFile currentFile = GetLastFile();

            currentFile.Locked = userId;
            this.files.Update(currentFile);
            this.files.SaveChanges();
            MessageBox.Show("Check_Out Completed!");
        }
Esempio n. 24
0
        internal static async Task <FileInfo> CreateFile(IWimdioApiClient client, Device device)
        {
            var file = new NewFile
            {
                Url    = new Uri("http://veryshorthistory.com/wp-content/uploads/2015/04/knights-templar.jpg"),
                Action = FileAction.POST,
                Type   = FileType.FIRMWARE_UPGRADE
            };

            return(await client.SendFileToDevice(device.Id, file));
        }
Esempio n. 25
0
        private NewFile GetLastFile()
        {
            int lastId = this.files.All()
                         .OrderByDescending(i => i.Id)
                         .Select(i => i.Id)
                         .FirstOrDefault();

            NewFile currentFile = this.files.GetById(lastId);

            return(currentFile);
        }
Esempio n. 26
0
        public async IActionResult Download(NewFile newFile)
        {
            var file = newFile.File;

            file.Path = $"Files/{file.BaseName}";

            using (var fileStream = new FileStream(Directory.GetCurrentDirectory() + "/Files", FileMode.Create))
            {
                await newFile.FileData.First().CopyToAsync(fileStream);
            }

            return(View());
        }
Esempio n. 27
0
        internal void DisplayMenu(string path)
        {
            //Options for various tasks a user can perform
            Console.WriteLine("\nExit: x\tInsert Line: i\tUpdate Line: u\tNew File: n\tOpen: o");
            Console.Write("\nOption: ");
            string choice = Console.ReadLine();

            switch (choice)
            {
            case "x":     //User pressed x
            {
                Environment.Exit(0);
                break;
            }

            case "i":     //User pressed i
            {
                InsertFileLine file = new InsertFileLine(path);
                file.InsertLine();
                break;
            }

            case "u":     //User pressed u
            {
                UpdateFile file = new UpdateFile(path);
                file.UpdateLine();
                break;
            }

            case "n":     //User pressed n
            {
                NewFile file = new NewFile();
                file.createNewFile();
                break;
            }

            case "o":     //User pressed o
            {
                OpenFile file = new OpenFile();
                file.displayFile();
                break;
            }

            default:
            {
                Console.WriteLine("\nInvalid Input");
                DisplayMenu(path);
                break;
            }
            }
        }
Esempio n. 28
0
        /// <summary>
        /// 执行ZIP文件创建功能
        /// </summary>
        /// <param name="Source">待压缩文件</param>
        /// <param name="NewZipPath">生成的Zip文件名</param>
        /// <param name="ZipLevel">压缩等级</param>
        /// <param name="ProgressHandler">进度通知</param>
        public static async Task CreateZipAsync(FileSystemStorageItemBase Source, string NewZipPath, int ZipLevel, ProgressChangedEventHandler ProgressHandler = null)
        {
            if (await FileSystemStorageItemBase.CreateAsync(NewZipPath, StorageItemTypes.File, CreateOption.GenerateUniqueName).ConfigureAwait(false) is FileSystemStorageFile NewFile)
            {
                ZipStrings.CodePage = EncodingSetting.CodePage;

                using (FileStream NewFileStream = await NewFile.GetFileStreamFromFileAsync(AccessMode.Exclusive).ConfigureAwait(false))
                    using (ZipOutputStream OutputStream = new ZipOutputStream(NewFileStream))
                    {
                        OutputStream.SetLevel(ZipLevel);
                        OutputStream.UseZip64      = UseZip64.Dynamic;
                        OutputStream.IsStreamOwner = false;

                        switch (Source)
                        {
                        case FileSystemStorageFile File:
                        {
                            using (FileStream FileStream = await File.GetFileStreamFromFileAsync(AccessMode.Read).ConfigureAwait(false))
                            {
                                ZipEntry NewEntry = new ZipEntry(File.Name)
                                {
                                    DateTime          = DateTime.Now,
                                    CompressionMethod = CompressionMethod.Deflated,
                                    Size = FileStream.Length
                                };

                                OutputStream.PutNextEntry(NewEntry);

                                await FileStream.CopyToAsync(OutputStream, ProgressHandler).ConfigureAwait(false);
                            }

                            break;
                        }

                        case FileSystemStorageFolder Folder:
                        {
                            await ZipFolderCore(Folder, OutputStream, Folder.Name, ProgressHandler).ConfigureAwait(false);

                            break;
                        }
                        }

                        await OutputStream.FlushAsync().ConfigureAwait(false);
                    }
            }
            else
            {
                throw new UnauthorizedAccessException();
            }
        }
Esempio n. 29
0
        virtual public void AddModule(String path, String prefix, String extension, bool same_name = false, bool event_use = true)
        {
            NewFile new_file = new NewFile();

            new_file.SetEnvironment(path, prefix, extension, same_name, event_use);
            new_file.InitializeFiles();
            file_new_checker_.Add(new_file);

            FileSize file_size = new FileSize(event_use);

            file_size.FileSizeCheckCompleted += new EventHandler(SizeCheckCompleted);
            file_size_checker_.Add(file_size);
            file_size.Start();
        }
            public async Task PostsToTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new FilesClient(connection);

                var newFile = new NewFile(new RawFile("abc.pdf", new byte[] { }, "application/pdf"));
                await client.Create(newFile);

                await connection.Received().Post <File>(Arg.Is <Uri>(u => u.ToString() == "files"),
                                                        Arg.Is <MultipartFormDataContent>(
                                                            nc => nc is MultipartFormDataContent),
                                                        Arg.Is <string>(a => a == "application/json"),
                                                        Arg.Is <string>(c => c == "multipart/form-data"));
            }
Esempio n. 31
0
 static void WriteToCSV(StreamWriter sw, FileInfo file1, FileInfo file2, NewFile FileStatus)
 {
     try
     {
         if (FileStatus == NewFile.NotFound)
         {
             sw.WriteLine(String.Format("{0},,{1},N", file1.FullName, file1.LastWriteTime));
         }
         else if (FileStatus == NewFile.Matches)
         {
             sw.WriteLine(String.Format("{0},{1},{2},{3},Y", file1.FullName, file2.FullName, file1.LastWriteTime, file2.LastWriteTime));
         }
         else if (FileStatus == NewFile.IsOlder)
         {
             sw.WriteLine(String.Format("{0},{1},{2},{3},N", file1.FullName, file2.FullName, file1.LastWriteTime, file2.LastWriteTime));
         }
     }
     catch
     {
         // File too long exceptions, I haven't implemented a fix yet. 
     }
 }
Esempio n. 32
0
        /// <summary>
        /// Create an NewLogger. 
        /// </summary>
        /// <param name="dir">base folder</param>
        /// <param name="fileName">name of the log</param>
        /// <param name="suffix">something to append to the fileName to make it unique</param>
        /// <param name="newFileCriterion">defines when to close current file and create a new file</param>
        /// <param name="maxLevel">maximum error level that gets logged, higher values get ignored</param>
        /// <param name="eventLevel">messages with an log level less than or equal to this number will also be sent to the OS Event Log</param>
        /// <param name="tallyLevel">for levels between 1 and tallyLevel, only show text first time, after that show a checksum and a count</param>
        private ErrorLogger(string dir, string fileName, string suffix, NewFile newFileCriterion, int maxLevel, int eventLevel, int tallyLevel)
        {
            try
            {
                _EventLevel = eventLevel;
                _TallyLevel = tallyLevel;
                _MaxLevel = maxLevel;
                _NewFile = newFileCriterion;
                _Tally = new Tally();
                _Name = fileName + suffix;
                _FileBaseName = Path.Combine(dir, _Name);

                if (_LogToDatabase == 1)
                {
                    byte[] bytes = new byte[0];
                  //  bool response = SaveLogToDatabase(bytes, 0);

                  //  if (!response) CreateFiles(dir, fileName, suffix);
                }
                else
                {
                    CreateFiles(dir, fileName, suffix);
                }
            }
            catch
            {
            }
        }
Esempio n. 33
0
        /// <summary>
        /// Create an NewLogger. 
        /// </summary>
        /// <param name="udpLogServer">Server to send log info via udp to</param>
        /// <param name="port">Port to send log info via udp to</param>
        /// <param name="dir">base folder</param>
        /// <param name="fileName">name of the log</param>
        /// <param name="suffix">something to append to the fileName to make it unique</param>
        /// <param name="newFileCriterion">defines when to close current file and create a new file</param>
        /// <param name="maxLevel">maximum error level that gets logged, higher values get ignored</param>
        /// <param name="eventLevel">messages with an log level less than or equal to this number will also be sent to the OS Event Log</param>
        /// <param name="tallyLevel">for levels between 1 and tallyLevel, only show text first time, after that show a checksum and a count</param>
        private ErrorLogger(string udpLogServer, int port, string dir, string fileName, string suffix, NewFile newFileCriterion, int maxLevel, int eventLevel, int tallyLevel)
        {
            try
            {
                _UdpLogServer = (string.IsNullOrEmpty(udpLogServer)) ? "127.0.0.1" : udpLogServer;
                _UdpPort = port;
                _EventLevel = eventLevel;
                _TallyLevel = tallyLevel;
                _MaxLevel = maxLevel;
                _NewFile = newFileCriterion;
                _Tally = new Tally();
                _Name = fileName + suffix;
                _FileBaseName = Path.Combine(dir, _Name);

                if (_LogToDatabase == 1)
                {
                    //byte[] bytes = new byte[0];
                    //bool response = SaveLogToDatabase(bytes, 0);

                    //if (!response) CreateFiles(dir, fileName, suffix);
                }
                else
                {
                    CreateFiles(dir, fileName, suffix);
                }
            }
            catch
            {
            }
        }