Ejemplo n.º 1
0
        public void ImportFile(string importFile)
        {
            if (ColorCount == 0)
            {
                InitializeColorPalette();
            }
            Log($"Importing theme from {importFile}.");
            var foundFile = false;
            //make sure file exists
            var myFileInfo = new FileInfo(importFile);

            if (myFileInfo.Exists)
            {
                foundFile = true;
                AddNewPalette(importFile);
                Xdoc.Save(_configFile);
            }
            else
            {
                //lets see if we can find the file name in the local directory
                var localFile       = Path.Combine(_localPath, importFile);
                var myLocalFileInfo = new FileInfo(localFile);
                if (myLocalFileInfo.Exists)
                {
                    foundFile = true;
                    AddNewPalette(localFile);
                    Xdoc.Save(_configFile);
                }
            }
            if (!foundFile)
            {
                Log($"We were unable to find the file specified: {importFile}");
            }
        }
Ejemplo n.º 2
0
        public void ImportFolder(string importFolder)
        {
            if (ColorCount == 0)
            {
                InitializeColorPalette();
            }
            var path = (string.IsNullOrWhiteSpace(importFolder)) ? _localPath : importFolder;

            Log($"Looking for any themes in the folder: {path} ");
            var palettes = GetPalettes(path);

            if (palettes.Any())
            {
                Log($"Found {palettes.Count()} files to import");
                foreach (var palette in palettes)
                {
                    AddNewPalette(palette);
                }
                Xdoc.Save(_configFile);
            }
            else
            {
                Log("No valid files found.");
            }
        }
Ejemplo n.º 3
0
 public string Save()
 {
     if (IsFile)
     {
         Xdoc.Save(Xml);
     }
     else
     {
         Xml = Xdoc.ToString();
     }
     return(IsFile ? "" : Xml);
 }
Ejemplo n.º 4
0
    public void SaveXMLFIle(string pAction, Employee pEmployee, string pCompanyName)
    {
        Xdoc.Save(Path);

        Util utl = new Util();

        utl.SendMail(String.Format("{0} {1} o telefone {2}, {3}, {4}, {5}",
                                   UserLogged,
                                   pAction,
                                   HttpUtility.HtmlDecode(pEmployee.Name),
                                   pEmployee.MobilePhone,
                                   pEmployee.TelePhone,
                                   pCompanyName),
                     ConfigurationManager.AppSettings["emailDestinatarioLog"]);
    }
Ejemplo n.º 5
0
    public void SaveXMLFIle(string pAction, Employee pEmployee, string pCompanyName, string pDepartament)
    {
        Xdoc.Save(Path);

        Util utl = new Util();

        utl.SendMail(String.Format("{0} {1} o ramal {2}, {3}, {4}, {5} , {6}", UserLogged,
                                   pAction,
                                   HttpUtility.HtmlDecode(pEmployee.Name),
                                   HttpUtility.HtmlDecode(pEmployee.Initials),
                                   HttpUtility.HtmlDecode(pEmployee.Local),
                                   pEmployee.ExtentionLine,
                                   pDepartament,
                                   pCompanyName
                                   ), ConfigurationManager.AppSettings["emailDestinatarioLog"]);
    }
Ejemplo n.º 6
0
        public void Save(GffRootStruct root, string path)
        {
            Initialize();
            _rootStruct = root;
            FileStream fs;

            if (File.Exists(path))
            {
                fs = new FileStream(path, FileMode.Truncate);
            }
            else
            {
                fs = new FileStream(path, FileMode.Create);
            }
            Xdoc.AppendChild(Xdoc.CreateXmlDeclaration("1.0", LatinEncoding.Name, "yes"));
            Write(Xdoc, _rootStruct);
            Xdoc.Save(fs);
            fs.Close();
        }