Exemplo n.º 1
0
Arquivo: Base.cs Projeto: zhna42/TDK
        public void button_save()
        {
            AudioFiles afMain = files[idList].main[files[idList].mainCopy[listSelectId].id];

            Object objVersion = comboBox_version.SelectedItem;
            bool   isFileIs   = true;

            foreach (AudioFiles element in files[idList].main)
            {
                if (element.artist == textBox_artist.Text &&
                    element.title == textBox_title.Text &&
                    element.album == textBox_album.Text &&
                    element.genre == textBox_genre.Text &&
                    element.albumArtist == textBox_albumArtist.Text &&
                    element.year == textBox_year.Text && element.version == objVersion.ToString())
                {
                    isFileIs = false;
                }
            }
            if (isFileIs)
            {
                save(afMain);
                list_name_main.Items.Refresh();
            }
            else
            {
                WindowWarning windowWarning = new WindowWarning();
                windowWarning.warning_text.Content = "File already exists";
                windowWarning.ShowDialog();
            }
        }
Exemplo n.º 2
0
    // [HideInInspector] public GameObject car;
    // Use this for initialization
    void Awake()
    {
        secondCanvas = GameObject.Find("SecondCanvas");
        fireBackground = GameObject.Find("FireBackground");
        fireStart = GameObject.Find("FireStart");
        garage = GameObject.FindObjectOfType<Garage>();
        taskMenu = GameObject.FindObjectOfType<TaskMenu>();
        kaController = GameObject.FindObjectOfType<KAController>();
        waitBackground = GameObject.FindObjectOfType<WaitBackground>();
        mainScreen = GameObject.FindObjectOfType<MainScreen>();
        bg = GameObject.Find("BG");
        carsInfo = GetComponent<CarsInfo>();
        filling = GameObject.FindObjectOfType<Filling>();
        carChanger = GameObject.FindObjectOfType<CarChanger>();
        dustSmall = GameObject.Find("DustSmall");
        windowWarning = GameObject.FindObjectOfType<WindowWarning>();
        windowConfirmation = GameObject.FindObjectOfType<WindowConfirmation>();

        mainBonus = GetComponent<MainBonus>();

        dailyEvents = GetComponent<DailyEvents>();
        moneyBar = GameObject.FindObjectOfType<MoneyBar>();

        boosterMenu = GameObject.FindObjectOfType<BoosterMenu>();

        dailyGiftMenu = GameObject.FindObjectOfType<DailyGiftMenu>();

        backMenuButton = GameObject.FindObjectOfType<BackMenuButton>();
        /*
        car = garage.transform.Find("Car").gameObject;
        if (car == null)
            CreateCar();    */
    }
Exemplo n.º 3
0
Arquivo: Base.cs Projeto: zhna42/TDK
        public void button_delete()
        {
            try
            {
                File.Delete(files[idList].mainCopy[listSelectId].path);

                //File.Delete(files.main[listSelectId].path);
                files[idList].main.Remove(files[idList].mainCopy[listSelectId]);
                files[idList].mainCopy.Remove(files[idList].mainCopy[listSelectId]);
                int i = 0;
                foreach (AudioFiles element in files[idList].main)
                {
                    element.id = i;
                    i++;
                }
                foreach (AudioFiles element in files[idList].mainCopy)
                {
                    element.id = files[idList].main.Find(x => x == element).id;
                }

                list_name_main.ItemsSource = files[idList].mainCopy;
                list_name_main.Items.Refresh();
            }
            catch
            {
                WindowWarning windowWarning = new WindowWarning();
                windowWarning.warning_text.Content = "Not file";
                windowWarning.ShowDialog();
            }
        }
Exemplo n.º 4
0
    // [HideInInspector] public GameObject car;

    // Use this for initialization
    void Awake()
    {
        secondCanvas       = GameObject.Find("SecondCanvas");
        fireBackground     = GameObject.Find("FireBackground");
        fireStart          = GameObject.Find("FireStart");
        garage             = GameObject.FindObjectOfType <Garage>();
        taskMenu           = GameObject.FindObjectOfType <TaskMenu>();
        kaController       = GameObject.FindObjectOfType <KAController>();
        waitBackground     = GameObject.FindObjectOfType <WaitBackground>();
        mainScreen         = GameObject.FindObjectOfType <MainScreen>();
        bg                 = GameObject.Find("BG");
        carsInfo           = GetComponent <CarsInfo>();
        filling            = GameObject.FindObjectOfType <Filling>();
        carChanger         = GameObject.FindObjectOfType <CarChanger>();
        dustSmall          = GameObject.Find("DustSmall");
        windowWarning      = GameObject.FindObjectOfType <WindowWarning>();
        windowConfirmation = GameObject.FindObjectOfType <WindowConfirmation>();

        mainBonus = GetComponent <MainBonus>();

        dailyEvents = GetComponent <DailyEvents>();
        moneyBar    = GameObject.FindObjectOfType <MoneyBar>();

        boosterMenu = GameObject.FindObjectOfType <BoosterMenu>();

        dailyGiftMenu = GameObject.FindObjectOfType <DailyGiftMenu>();

        backMenuButton = GameObject.FindObjectOfType <BackMenuButton>();

        /*
         * car = garage.transform.Find("Car").gameObject;
         * if (car == null)
         *  CreateCar();    */
    }
Exemplo n.º 5
0
        public override XElement BuildXElement(List <string[]> source)
        {
            if (XElemBuilder.targetHeaders.Count >= 10 && IsAllKeyIndexesFound(XElemBuilder.targetHeaders))
            {
                XElement cust = new XElement(Config.XmlFileRoot,
                                             from fields in source
                                             where !fields[1].Equals(string.Empty) & !fields[2].Equals(string.Empty)
                                             select new XElement(Config.TransactionField, new XAttribute(Config.AuftragsKontoField, fields[(int)targetHeaders.GetByIndex(0)]),                                              // Auftragskonto
                                                                 new XElement(Config.BuchungstagField, Config.ExchYearDay(fields[(int)targetHeaders.GetByIndex(1)]), new XAttribute("type", "date")),                       // Buchungstag
                                                                 new XElement(Config.WertDatumField, Config.ExchYearDay(fields[(int)targetHeaders.GetByIndex(2)]), new XAttribute("type", "date")),                         // Valutadatum
                                                                 new XElement(Config.BuchungsTextField, fields[(int)targetHeaders.GetByIndex(3)]),                                                                          // Buchungstext
                                                                 new XElement(Config.VerwendZweckField, fields[(int)targetHeaders.GetByIndex(4)]),                                                                          // Verwendungszweck
                                                                 new XElement(Config.BeguenstigterField, fields[(int)targetHeaders.GetByIndex(5)].Equals(string.Empty) ? "---" : fields[(int)targetHeaders.GetByIndex(5)]), // Begünstigter
                                                                 new XElement(Config.KontonummerField, fields[(int)targetHeaders.GetByIndex(6)]),                                                                           // Kontonummer
                                                                 new XElement(Config.BLZField, fields[(int)targetHeaders.GetByIndex(7)]),                                                                                   // BLZ
                                                                 new XElement(Config.BetragField,                                                                                                                           // Betrag
                                                                              GetAdoptedDouble(fields[(int)targetHeaders.GetByIndex(8)]),
                                                                              new XAttribute(Config.WaehrungField, fields[(int)targetHeaders.GetByIndex(9)]), new XAttribute("type", "double"))                             // Währung
                                                                 )
                                             );
                return(cust);
            }
            WindowWarning dialog = new WindowWarning();

            dialog.labelMessage.Content = " Not all acting fields are found!\r\n Only basic functionality is availible.\r\n Press: \r\n Ok - To proceed; \r\n Stop - To cancel databank update. ";
            dialog.buttonOk.Click      += delegate { dialog.Close(); };
            dialog.buttonStop.Click    += delegate { dialog.Close(); Successor = null; };
            dialog.ShowDialog();

            if (Successor != null)
            {
                return(Successor.BuildXElement(source));
            }
            return(null);
        }
Exemplo n.º 6
0
 public void button_addNewSettings()
 {
     //Добавить окно с предупри что рабочие листы будут очищены
     if (editSettings.addNew(textBox_newSettingsName.Text))
     {
         comboBox_name_name.DataContext   = editSettings.cbe();//вернет эелементы для comboBox
         comboBox_name_name.SelectedValue = settings.json.name;
     }
     else
     {
         WindowWarning windowWarning = new WindowWarning();
         windowWarning.warning_text.Content = "Name settings must be unique";
         windowWarning.ShowDialog();
     }
 }
Exemplo n.º 7
0
 public void load(string pathLoad)
 {
     string[] files = Directory.GetFiles(pathLoad, "*");
     if (files.Length >= 0)
     {
         main = new List <AudioFiles>();
         int id = 0;
         isErrFile = false;
         foreach (string path in files)
         {
             string fileName = Path.GetFileNameWithoutExtension(path);
             string ext      = Path.GetExtension(path);
             if (ext == ".mp3" || ext == ".wav")
             {
                 try
                 {
                     var        tegs      = TagLib.File.Create(path);
                     AudioFiles tegsAudio = new AudioFiles
                     {
                         id       = id,
                         fileName = fileName,
                         ext      = ext,
                         path     = path,
                         tegs     = tegs
                     };
                     main.Add(tegsAudio);
                     id++;
                 }
                 catch
                 {
                     //если ошибка загрузки
                     isErrFile = true;
                     isErrFileName.Add(fileName);
                 }
             }
         }
         //Загрузка успешна
     }
     else
     {
         WindowWarning windowWarning = new WindowWarning();
         windowWarning.warning_text.Content = "Catalog is empty";
         windowWarning.ShowDialog();
         //католог пуст
     }
 }
Exemplo n.º 8
0
        public void button_addNewElement()
        {
            DataSettings ds = new DataSettings
            {
                name        = textBox_name.Text,
                prefix      = textBox_prefix.Text,
                path        = label_openPath.Content.ToString(),
                startNumber = textBox_startNumber.Text
            };

            if (editSettings.addNewElement(ds))
            {
                name_list.Items.Refresh();
            }
            else
            {
                WindowWarning windowWarning = new WindowWarning();
                windowWarning.warning_text.Content = "Name, name, prefix must be unique";
                windowWarning.ShowDialog();
            }
        }
Exemplo n.º 9
0
        public void button_edit()
        {
            //Добавить окно с предупри что рабочие листы будут очищены
            int          id = listViewSelectedItems(name_list);
            DataSettings ds = new DataSettings
            {
                name        = textBox_name.Text,
                prefix      = textBox_prefix.Text,
                path        = label_openPath.Content.ToString(),
                startNumber = textBox_startNumber.Text
            };

            if (editSettings.editElement(ds, id))
            {
                name_list.Items.Refresh();
            }
            else
            {
                WindowWarning windowWarning = new WindowWarning();
                windowWarning.warning_text.Content = "Name, name, prefix must be unique";
                windowWarning.ShowDialog();
            }
        }
Exemplo n.º 10
0
        public List <AudioFiles> exportAll()
        {
            ParserName parser = new ParserName();

            //filesExport //Что экспортить
            filesNumber();//получаем пропущеные элементы
            bool isExportAllFiles  = false;
            bool isExportAllFiles2 = false;

            //удалени
            List <AudioFiles> deleteFiles = new List <AudioFiles>();

            //exportFile текущий файл для экспорта

            foreach (AudioFiles exportFile in filesExport)
            {
                DataSettings dataSet    = ds.Find(x => x.name == exportFile.category);      //путь и категория для экспорта
                int          idCategory = ds.FindIndex(x => x.name == exportFile.category); //id экспорта
                if (idCategory != -1)
                {
                    bool isFile = fileIsFile(files[idCategory], exportFile);
                    if (isFile)
                    {
                        int fileNameInt;
                        if (listNumberName[idCategory].Count > 0)
                        {
                            fileNameInt = listNumberName[idCategory][0];
                        }
                        else
                        {
                            fileNameInt = listNumberMaxName[idCategory];
                        }
                        if (exportFile.version != null)
                        {
                            //
                            bool   isFileis = true;
                            string name2    = "";
                            foreach (AudioFiles element in files[idCategory].main)
                            {
                                if (element.artist == exportFile.artist && element.title.Split('(')[0] == exportFile.title.Split('(')[0] && element.album == exportFile.album && element.genre == exportFile.genre && element.albumArtist == exportFile.albumArtist && element.year == exportFile.year)
                                {
                                    isFileis = false;//файл совпадает
                                    name2    = element.fileName;
                                }
                            }

                            if (isFileis)
                            {
                                if (listNumberName[idCategory].Count > 0)
                                {
                                    listNumberName[idCategory].Remove(fileNameInt);
                                }
                                else
                                {
                                    listNumberMaxName[idCategory]++;
                                }
                                string nameFile = dataSet.prefix + parser.IntToName(fileNameInt) + "-" + exportFile.version + exportFile.ext;
                                File.Copy(exportFile.path, dataSet.path + "\\" + nameFile);
                                deleteFiles.Add(exportFile);
                                LoadFiles();
                            }
                            else
                            {
                                char[] cF = name2.ToString().ToCharArray();
                                name2 = cF[0].ToString() + cF[1].ToString() + cF[2].ToString() + cF[3].ToString() + cF[4].ToString();
                                //////////////////////////////
                                string nameFile = name2 + "-" + exportFile.version + exportFile.ext;
                                File.Copy(exportFile.path, dataSet.path + "\\" + nameFile);
                                deleteFiles.Add(exportFile);
                                LoadFiles();
                            }
                        }
                        else
                        {
                            isExportAllFiles2 = true; //версия не задана
                        }
                    }
                    else
                    {
                        isExportAllFiles = true;
                        //такой файл уже есть
                    }
                }
                else
                {
                    //категория не задана
                }
            }
            if (isExportAllFiles)
            {
                WindowWarning windowWarning = new WindowWarning();
                windowWarning.warning_text.Content = "Some files match";
                windowWarning.ShowDialog();
            }
            if (isExportAllFiles2)
            {
                WindowWarning windowWarning = new WindowWarning();
                windowWarning.warning_text.Content = "Not all files have a version.";
                windowWarning.ShowDialog();
            }

            //удаление
            return(deleteFiles);
        }
Exemplo n.º 11
0
        public void exportOne(int idFileExport)
        {
            Console.WriteLine(idFileExport);
            ParserName   parser     = new ParserName();
            AudioFiles   fileExport = filesExport[idFileExport];                        //Что экспортить
            DataSettings dataSet    = ds.Find(x => x.name == fileExport.category);      //куда экспортить
            int          idCategory = ds.FindIndex(x => x.name == fileExport.category); //id для экспорта и проверок
            bool         isFile     = false;

            if (idCategory != -1)
            {
                LoadFiles testElements = files[idCategory]; //элементы для проверки

                //Узнаем несовпвдвет ли файл
                isFile = fileIsFile(testElements, fileExport);
                //получаем доступные значения для нумерации
                filesNumber();
                //listNumberName[idCategory] лист с доступными намерами
                //listNumberMaxName[idCategory] масимальное значение
                int fileNameInt;
                if (isFile)
                {
                    if (listNumberName[idCategory].Count > 0)
                    {
                        fileNameInt = listNumberName[idCategory][0];
                    }
                    else
                    {
                        fileNameInt = listNumberMaxName[idCategory];
                    }
                    if (fileExport.version != null)
                    {
                        bool   isFileis = true;
                        string name2    = "";
                        foreach (AudioFiles element in files[idCategory].main)
                        {
                            if (element.artist == fileExport.artist && element.title.Split('(')[0] == fileExport.title.Split('(')[0] && element.album == fileExport.album && element.genre == fileExport.genre && element.albumArtist == fileExport.albumArtist && element.year == fileExport.year)
                            {
                                isFileis = false;//файл совпадает
                                name2    = element.fileName;
                            }
                        }

                        if (isFileis)
                        {
                            if (listNumberName[idCategory].Count > 0)
                            {
                                listNumberName[idCategory].Remove(fileNameInt);
                            }
                            else
                            {
                                listNumberMaxName[idCategory]++;
                            }
                            string nameFile = dataSet.prefix + parser.IntToName(fileNameInt) + "-" + fileExport.version + fileExport.ext;
                            File.Copy(fileExport.path, dataSet.path + "\\" + nameFile);
                        }
                        else
                        {
                            char[] cF = name2.ToString().ToCharArray();
                            name2 = cF[0].ToString() + cF[1].ToString() + cF[2].ToString() + cF[3].ToString() + cF[4].ToString();
                            string nameFile = name2 + "-" + fileExport.version + fileExport.ext;
                            File.Copy(fileExport.path, dataSet.path + "\\" + nameFile);
                        }
                    }
                    else
                    {
                        WindowWarning windowWarning = new WindowWarning();
                        windowWarning.warning_text.Content = "No version selected";
                        windowWarning.ShowDialog();
                    }
                }
                else
                {
                    WindowWarning windowWarning = new WindowWarning();
                    windowWarning.warning_text.Content = "This file already exists";
                    windowWarning.ShowDialog();
                }
            }
            else
            {
                WindowWarning windowWarning = new WindowWarning();
                windowWarning.warning_text.Content = "Category not selected";
                windowWarning.ShowDialog();
            }
        }