Ejemplo n.º 1
0
        private void PasteChildrenDirs_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (CurrentlyChosenDir.Description.FullName.Length < sorteritno.path_max_length )
            {
                List<IEditableDirWithChildrenAndParent> CopyOfChildren =
                SaveAndReadElementInBinaryFile.GetDefaultInstance()
                .ReadFromBinaryFile<IEditableDirWithChildren>(@"C:..\..\..\TemporaryFiles\tempFile~Copy")
                .Children;
                int dirCount = 0;
                foreach (ChildDir childdir in CopyOfChildren)
                {
                    dirCount += sorteritno.GetDirCount(childdir);
                }
                if (dirCount + sorteritno.dir_counter < sorteritno.dir_count_max)
                {
                    var validate = DirValidate.GetDefaultInstance();
                    foreach (IEditableDirWithChildrenAndParent child in CopyOfChildren)
                    {

                        if (validate.IsDirExistingAsFolderAndChild(CurrentlyChosenDir, child.Description.Name))
                        {
                            child.Description.Name = DirNameGenerator.GetDefaultInstance().GeneratetName_Default(CurrentlyChosenDir, 1, child.Description.Name);
                        }

                        child.ParentDir = CurrentlyChosenDir;
                    }
                    CurrentlyChosenDir.AddChildrenToChildrenList(CopyOfChildren);
                    DirManagement.GetDefaultInstance().AutoGenerateChildrenFullName(CurrentlyChosenDir);
                    int result = PasteFullNameControl(CurrentlyChosenDir);
                    if (result > 0)
                    {
                        EMW = new ErrorMessageWindow();
                        EMW.SetMessage(4);
                        EMW.ShowDialog();
                    }
                    AddMemento();
                    sorteritno.ResetTree(ResTree, ResetHighlight, Seed, drzewo, "MW");
                }
                else             //wyswietl info o zbyt duzej ilosci dirow
                {
                    EMW = new ErrorMessageWindow();
                    EMW.SetMessage(2);
                    EMW.ShowDialog();
                }
            }
            else
            {
                EMW = new ErrorMessageWindow();
                EMW.SetMessage(3);
                EMW.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        //warunek sprawdzajacy czy podana sciezka istnieje/ jest poprawna
        public void CreateCNTW_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            bool flag = false;

            try
            {
                flag = DirValidate.GetDefaultInstance().IsfolderExisting(SeedLocation.Text);
            }
            catch (Exception)
            {  }
            if (flag && StructureName.Text.Length > 0)
            {
                e.CanExecute = true;
            }
            else
            {
                e.CanExecute = false;
            }
        }
Ejemplo n.º 3
0
        string SetGeneratedName(object check, IEditableDirWithChildren Parent)
        {
            List <string> namesInSystem = new List <string>();

            // names to ignore
            string[] namesToIgnore = new string[AppMW.CurrentlyChosenDir.Children.Count + namesInSystem.Count];



            //selecting names to ignore
            for (int j = 0; j < AppMW.CurrentlyChosenDir.Children.Count; j++)
            {
                namesToIgnore[j] = AppMW.CurrentlyChosenDir.Children[j].Description.Name;

                if (j == AppMW.CurrentlyChosenDir.Children.Count - 1 && DirValidate.GetDefaultInstance().IsfolderExisting(AppMW.CurrentlyChosenDir.Description.FullName))
                {
                    namesInSystem.CopyTo(namesToIgnore, ++j);
                }
            }


            if (check == Default)
            {
                return(DirNameGenerator.GetDefaultInstance().GeneratetName_Default(Parent, namesToIgnore: namesToIgnore));
            }
            else if (check == Numbers)
            {
                return(DirNameGenerator.GetDefaultInstance().GenerateName_Number(Parent, 1, namesToIgnore: namesToIgnore));
            }
            else if (check == NumSiPar)
            {
                return(DirNameGenerator.GetDefaultInstance().GenerateName_Number_Text_ParentName(Parent, SignTB.Text, namesToIgnore: namesToIgnore));
            }
            else if (check == ParSiNum)
            {
                return(DirNameGenerator.GetDefaultInstance().GenerateName_ParentName_Text_Number(Parent, SignTB.Text, namesToIgnore: namesToIgnore));
            }
            return("If you see this message - report us an error");
        }
Ejemplo n.º 4
0
 public TxtFileWriter()
 {
     this.dirValidate = DirValidate.GetDefaultInstance();
     TxtFileEditor    = new TxtFileEditor(this.dirValidate, DirRead.GetDefaultInstance(), FileRead.GetDefaultInstance());
 }