コード例 #1
0
 public Masura(Masura masura)
 {
     _nume = masura._nume;
     fN = masura.fN;
     filesN = masura.filesN.ToArray();
     filesP = masura.filesP.ToArray();
 }
コード例 #2
0
 public Customer()
 {
     _masuri = new Masura[3];
     for (int i = 0; i < 3; i++)
     {
         _masuri[i] = new Masura();
     }
     // NICA
 }
コード例 #3
0
        //Masura _masura; nu mai este necesar

        public Customer(int age,string name,string prenume,string telefon,string oras,string email,string path)
        {
            _age     = age;
            _name    = name;
            _prenume = prenume;
            _telefon = telefon;
            _oras  = oras;
            _email = email;
            pathDir = Globals.customer_path + "cData\\" + (_name + " " + _prenume);

            _masuri = new Masura[3];
            for (int i = 0; i < 3; i++)
            {
                _masuri[i] = new Masura();
            }
        }
コード例 #4
0
        } // creating basic data folders

        public static void initTemp()
        {
            _templates = new Masura[100];
            _templatesM = new string[100][];
            for (int i = 0; i < 100; i++)
            {
                _templatesM[i] = new string[2];
                _templatesM[i][0] = "";
                _templates[i] = new Masura();
            }
            foreach (string directory in Directory.GetDirectories(template_path))
            {
                foreach (string file in Directory.GetFiles(directory))
                {
                    _templatesM[_tempNumber][0] = Path.GetFileNameWithoutExtension(file);
                    _templatesM[_tempNumber][1] = file;

                    string[] files = new string[100];
                    FileStream fs = new FileStream(_templatesM[_tempNumber][1],FileMode.Open,FileAccess.ReadWrite);
                    StreamReader sr = new StreamReader(fs);
                    int fN = Convert.ToInt32(sr.ReadLine());
                    for (int i = 0; i < fN; i++)
                    {
                        files[i] = sr.ReadLine();
                    }
                    _templates[_tempNumber] = new Masura(_templatesM[_tempNumber][0], files, fN);
                    sr.Close();
                    //pentru a evita parsuirea fisierelor de fiecare data cand am nevoie de anumite date
                    //nu chiar e necesar avand in vedere complexitatea tipului de fisier in cauza
                    //dar csf
                    //n-ai csf
                   
                }
                _tempNumber += 1;
            }
            save_undoStep(); //UNDO base step
        } // basic template folders parsing FILE NAME (W/O EXTENSION) = FOLDER NAME
コード例 #5
0
        } // basic template folders parsing FILE NAME (W/O EXTENSION) = FOLDER NAME

        public static void initCustomers()
        {
            _cSteps = new cUndo[20];
            _customers = new Customer[100];
            if(File.Exists(customer_path + @"cList\customers.xml"))
            {
                XDocument xDoc = XDocument.Load(customer_path + @"cList\customers.xml");


                foreach (XElement xEl in xDoc.Root.Elements("customer"))
                {
                    string name = xEl.Element("Nume").Value;
                    string prenume = xEl.Element("Prenume").Value;
                    string telefon = xEl.Element("Telefon").Value;
                    string email = xEl.Element("Email").Value;
                    string oras = xEl.Element("Oras").Value;
                    string path = xEl.Element("Path").Value;
                    Customer newCustomer = new Customer(1, name, prenume, telefon, email, oras,path);
                    _customers[_cN++] = newCustomer;
                }
            }
            else
            {
                XmlTextWriter xml = new XmlTextWriter(customer_path + @"cList\customers.xml", Encoding.UTF8);
               xml.Formatting = Formatting.Indented;
               xml.WriteStartDocument();
               xml.WriteStartElement("Customers");
               xml.WriteEndElement();
               xml.WriteEndDocument();
               // xml creation + root
               xml.Close();
            }

            for (int i = 0; i < _cN; i++)
            {
                for (int dirIndex = 1; dirIndex < 4; dirIndex++)
                {
                    string path = _customers[i].pathDir + @"\Masura " + dirIndex;

                    foreach (string dir in Directory.GetDirectories(path))
                    {
                        string dirName = Path.GetFileName(dir);
                        if (!dirName.Contains("Gol"))
                        {
                            int _fn = 0;
                            string[] fileN = new string[100];
                            string[] fileP = new string[100];
                            foreach (string file in Directory.GetFiles(dir))
                            {
                                fileN[_fn] = Path.GetFileName(file);
                                fileP[_fn] = file;
                                _fn++;
                            }
                            Masura newMasura = new Masura(dirName, fileN, fileP, _fn);
                            _customers[i].AddMasura(newMasura, dirIndex - 1);
                        }
                        else
                        {
                            Directory.CreateDirectory(path + @"\Gol");
                        }
                    }
                }
            }
        } // basic customer.xml parsing
コード例 #6
0
        private void create_project(object sender, EventArgs e)
        {
            //cleanup 
            if (Directory.Exists(Globals.hidden_path + @"\masura_dummy"))
            {
                Directory.Delete(Globals.hidden_path + @"\masura_dummy", true);
            }
            //

            Masura newMasura = new Masura(alegeMasura.Text, fileN, fileP,fnumber);  //where N stands for Name and P for Path
            Globals._dummy.AddMasura(newMasura,currentMasura);
           
            if (Globals.previous_dummy != null)
            {
                Globals.previous_dummy._masuri = Globals._dummy._masuri.ToArray();
            } 

            redraw_masuri();
            overlay_start();
            tablessControl1.SelectedIndex = 0;
        }
コード例 #7
0
 public void AddMasura(Masura masura,int index)
 {
     _masuri[index] = new Masura(masura);
 }