Ejemplo n.º 1
0
        private ENUMContextFileType FileIdentifier()
        {
            ENUMContextFileType eContextFileType = ENUMContextFileType.None;
            string extension = string.Empty;

            try
            {
                extension = System.IO.Path.GetExtension(PathContext);
                switch (extension)
                {
                case ".xml":
                    eContextFileType = ENUMContextFileType.XML;
                    break;

                case ".json":
                    eContextFileType = ENUMContextFileType.Json;
                    break;

                default:
                    break;
                }
                return(eContextFileType);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
            }
        }
Ejemplo n.º 2
0
        public ContextSetup(string path = DEFAULT_PATH_CONTEXT)
        {
            try
            {
                this.PathContext     = path;
                this.ContextFileType = this.FileIdentifier();

                switch (this.ContextFileType)
                {
                case ENUMContextFileType.XML:
                    this.ReadContextXML();
                    break;

                case ENUMContextFileType.Json:
                    this.ReadContextJson();
                    break;

                default:
                    throw new Exception(string.Format("Context File [{0}] is not configurated or is not allowed.", this.PathContext));
                }

                this.ReplaceContext();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
            }
        }