コード例 #1
0
        //sends DLL files to childTestHarness upon request from the child TestHarness.
        private void sendDllToChildTestHarness(CommMessage msgRcvdFromChildTestHarness)
        {
            Console.WriteLine("sendDllToChildTestHarness entered");
            string           fullPathToLibraryFiles = _childBuilderStoragePath + "/" + msgRcvdFromChildTestHarness.author + "/" + msgRcvdFromChildTestHarness.infoAboutContent;
            fileManager      fm = new fileManager();
            HashSet <string> allLibraryFiles = new HashSet <string>();

            allLibraryFiles = fm.getAllFilesFromAGivenPath(Path.GetFullPath(fullPathToLibraryFiles), "*.DLL");
            Console.WriteLine("size of allLibraryFiles present in the project folder: {0}  : {1}", fullPathToLibraryFiles, allLibraryFiles.Count);
            ClientEnvironment.fileStorage = fullPathToLibraryFiles;
            foreach (var eachLibrary in allLibraryFiles)
            {
                try
                {
                    Console.WriteLine("\n \n REQUIREMENT 8: fileName about to be sent: {0}", eachLibrary);
                    wcfMediator.postFile(Path.GetFileName(eachLibrary), msgRcvdFromChildTestHarness.from);
                    Console.WriteLine("\n PostFile returned after sending, {0}", eachLibrary);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("\n error occured with details:\n {0}", ex.Message);
                    _fileLoggerPath = fullPathToLibraryFiles + "logger.txt";
                    File.AppendAllText(_fileLoggerPath, ex.Message);
                }
            }
            //sending acknowledgement message that dll files have been sent to childTstHarness
            sendConfirmationMsgToChildTestHarness(msgRcvdFromChildTestHarness);
            //sending readymsg to the mother builder after the child builder finishes sending dlls to the child testharness.

            Console.WriteLine("\n childBuilder finished building files, sending test request xml to child testHarness, sending DLL files to ch.test harness");
            Console.WriteLine("\n sending ready message to the motherBuilder");
            wcfMediator.postMessage(readyMessage);
        }
        public async Task <fileManager> add(fileManager file)
        {
            dbContext.fileManagers.Add(file);
            await dbContext.SaveChangesAsync();

            return(file);
        }
コード例 #3
0
        //this gets the list of xml build requst files present in the requested author directory and sends the list of file names to client.
        private void handleXmlBuildReqListFromClient(CommMessage msgFromClient)
        {
            Console.WriteLine("REQUIREMENT 13: demonstrating that repo sends the below list of xml build request strings to client");
            string      filePath = _mockRepoFileStorage + "/" + msgFromClient.author;
            fileManager fm       = new fileManager();

            try
            {
                HashSet <string> xmlBuildReqFiles = fm.getAllFilesFromAGivenPath(Path.GetFullPath(filePath), "*.xml");
                msgFromClient.arguments.Clear();
                foreach (var eachFilePath in xmlBuildReqFiles)
                {
                    if (!msgFromClient.arguments.Contains(Path.GetFileName(eachFilePath)))
                    {
                        msgFromClient.arguments.Add(Path.GetFileName(eachFilePath));
                        Console.WriteLine("fileName added as argument to msg to client: {0}", Path.GetFileName(eachFilePath));
                    }
                }
                string clientAddress = msgFromClient.from;
                msgFromClient.from = msgFromClient.to;
                msgFromClient.to   = clientAddress;
                Console.WriteLine("posting list of xml request file names to client: {0}", msgFromClient.to);
                wcfMediator.postMessage(msgFromClient);
                Console.WriteLine("posting sucessfull");
            }
            catch (Exception ex)
            {
                Console.WriteLine("error occured while sending xml file names to client. Details: \n {0}", ex.Message);
            }
        }
コード例 #4
0
        public listOfListsClass()
        {
            ListViewItems = new ObservableCollection <string>();
            _FM           = new fileManager();
            loginViewModel loginVM = new loginViewModel();

            _profile = loginVM.getLoginUserName();
            addFilesToList(_FM.getFiles(_profile));
        }
コード例 #5
0
ファイル: loginViewModel.cs プロジェクト: hinaka27/flashcards
 private bool tryToLogin(string login, fileManager FC)
 {
     if (FC.doesProfileExists(login, FC.getProfiles()))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #6
0
        public editSelectedListViewModel(string fileName, string profile)
        {
            fileManager FM = new fileManager();

            _fileName = fileName;
            _profile  = profile;
            List <pairWords> pairListFromFile = FM.getWordPairsFromFile(_fileName, _profile);

            lm.SetList(pairListFromFile);
            observableList = new ObservableCollection <pairWords>(pairListFromFile);
        }
コード例 #7
0
        public async Task <ActionResult> add([FromBody] fileManager _file)
        {
            fileManager file = await repo.add(_file);

            return(Ok(new
            {
                status = 1,
                message = "operation success",
                data = file
            }));
        }
コード例 #8
0
        public void saveList(ListView Wordlist)
        {
            List <pairWords> changedList = new List <pairWords>();
            fileManager      FM          = new fileManager();

            foreach (pairWords item in Wordlist.Items)
            {
                changedList.Add(item);
            }
            lm.SetList(changedList);
            FM.saveWordPairsFromList(_fileName, _profile, lm);
        }
コード例 #9
0
        private void startPractice_Click(object sender, RoutedEventArgs e)
        {
            practiceViewModel PVM = (practiceViewModel)DataContext;
            fileManager       FM  = new fileManager();
            string            fileName;

            if (listView.SelectedItem != null)
            {
                fileName = listView.SelectedItem.ToString();
                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(MainWindow))
                    {
                        (window as MainWindow).DataContext = new startPracticeViewModel(FM.getWordPairsFromFile(fileName, PVM.getActiveProfile()));
                    }
                }
            }
        }
コード例 #10
0
        //this helper function copies required files from the mockrepoStorage to the newly created folder as per client's XML structure.
        private void copyFilesFromMockRepoStorageToAuthorTestNameFolder(string testNameDirectory)
        {
            int numberOfTestsCount = clientsBuildContent.Count();

            if (numberOfTestsCount > 1)
            {
                fileManager fm = new fileManager();
                for (int i = 1; i < numberOfTestsCount; i++)
                {
                    int numberOfCsharpFiles = clientsBuildContent[i].Count();
                    for (int j = 1; j < numberOfCsharpFiles; j++)
                    {
                        var fileName     = clientsBuildContent[i][j];
                        var fullFileName = Path.Combine(_mockRepoFileStorage, fileName);
                        fm.sendFileFromSourceToDestination(fullFileName, testNameDirectory);
                    }
                }
            }
        }
コード例 #11
0
ファイル: loginViewModel.cs プロジェクト: hinaka27/flashcards
        public void setLoggedStatus(string login)
        {
            fileManager FC = new fileManager();

            _loggedIn = tryToLogin(login.ToString(), FC);

            if (_loggedIn)
            {
                loginUserName = login;
                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(MainWindow))
                    {
                        (window as MainWindow).changeToLoggedInMenu(login);
                    }
                }
            }
            else
            {
                if (Regex.IsMatch(login, "^[a-zA-Z0-9_]+$"))
                {
                    FC.createNewProfile(login);
                    loginUserName = login;
                    foreach (Window window in Application.Current.Windows)
                    {
                        if (window.GetType() == typeof(MainWindow))
                        {
                            (window as MainWindow).changeToLoggedInMenu(login);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Invalid profile name, profile name should contain only alphanymerical characters and underscore.");
                }
            }
        }
コード例 #12
0
ファイル: fileManager.cs プロジェクト: AMiller90/Homework
 //Destroy the instance
 public void destroyInstance()
 {
     //Set instance to null
     instance = null;
 }
コード例 #13
0
ファイル: fileManager.cs プロジェクト: AMiller90/Homework
 //Destroy the instance
 public void destroyInstance()
 {//Set instance to null
     instance = null;
 }
コード例 #14
0
 //fileManager Instance'ını yok etmeye yarar
 public void destroyInstance()
 {
     print("Instance yok edildi");
     instance = null;
 }