예제 #1
0
        /*
         * Initializes the request.
         */
        private void InitializeRequest()
        {
            // Create the communications.
            this.communication = new Communications();

            // Create the authentication.
            this.authentication          = new authentication();
            this.authentication.user     = this.config.GetValue("username");
            this.authentication.password = this.config.GetValue("password");

            // Determine the directories.
            requestDirectory  = Path.Combine(this.config.GetValue("requestDirectory"), "Requests") + Path.DirectorySeparatorChar;
            responseDirectory = Path.Combine(this.config.GetValue("responseDirectory"), "Responses") + Path.DirectorySeparatorChar;

            // Create the time and file.
            this.cnpTime = new CNPTime();
            this.cnpFile = new CNPFile();
        }
예제 #2
0
        /*
         * Creates a random file.
         */
        public virtual string CreateRandomFile(string fileDirectory, string fileName, string fileExtension, CNPTime cnpTime)
        {
            string filePath = null;

            if (string.IsNullOrEmpty(fileName))
            {
                if (!Directory.Exists(fileDirectory))
                {
                    Directory.CreateDirectory(fileDirectory);
                }

                fileName = cnpTime.GetCurrentTime("MM-dd-yyyy_HH-mm-ss-ffff_") + RandomGen.NextString(8);
                filePath = fileDirectory + fileName + fileExtension;

                using (var fs = new FileStream(filePath, FileMode.Create))
                {
                }
            }
            else
            {
                filePath = fileDirectory + fileName;
            }

            return(filePath);
        }
예제 #3
0
 public void SetCnpTime(CNPTime cnpTime)
 {
     this.cnpTime = cnpTime;
 }