Example #1
0
        public bdatumConfigManager()
        {
            if (String.IsNullOrEmpty(appPath))
            {
                appPath = @"c:\";
            }

            filePathConfig = appPath + @"\bdatum\pathinfo";
            fileSettings = appPath + @"\bdatum\settings";
            fileBlacklist = appPath + @"\bdatum\blacklist";

            Settings = new bOrganization();
            Node = new bNode();
            Path = new List<string>();
            PathBlacklist = new List<string>();

            if (!File.Exists(appPath + @"\bdatum"))
            {
                System.IO.Directory.CreateDirectory(appPath + @"\bdatum");
            }

            LoadSettings();
            LoadPath();
            LoadBlackList();

            Node.node_key = Settings.node_key;
            Node.partner_key = Settings.partner_key;
            Node.blacklist = PathBlacklist;
        }
Example #2
0
        public bFile(string value, bNode node)
        {
            _node = node;

            Uri convert = new Uri(value);
            string disc = "/" + (convert.AbsolutePath).Substring(0, 1);
            path = disc  + (convert.AbsolutePath).Substring(2);

            filename = Path.GetFileName(path);

            local_path = Path.GetFullPath(value);

            // Yet another race condition
            if (File.Exists(local_path) || Directory.Exists(local_path))
            {
                FileInfo fileinfo = new FileInfo(local_path);
                FileAttributes attr = File.GetAttributes(local_path);
                if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
                {
                    _IsDirectory = true;
                    if (path.Substring((this.path.Length - 1)) != "/")
                    {
                        path = path + "/";
                    }
                    if (local_path.Substring((this.local_path.Length - 1)) != "\\")
                    {
                        local_path = local_path + "\\";
                    }
                }
                else
                {
                    local_size = fileinfo.Length;
                    _IsDirectory = false;
                }

                DateTime modified = System.IO.File.GetLastWriteTime(local_path);
                DateTime created = System.IO.File.GetCreationTime(local_path);

                //if (file.last_modified.CompareTo(reference) > 0)
                if (modified.CompareTo(created) > 0)
                {
                    last_modified = modified;
                }
                else
                {
                    last_modified = created;
                }

                status = "local";
            }
            else
            {
                if (this.path.Substring((this.path.Length - 1)) == "/")
                {
                    _IsDirectory = true;
                }
                else
                {
                    _IsDirectory = false;
                }
                status = "remote";
            }
        }
Example #3
0
        //Bug
        public bNode new_node()
        {
            string json_answer = b_http.POST("/organization/" + organization_id + "/node", "api_key=" + api_key + "&name=" + this.user_name);

            bNode new_node = JsonConvert.DeserializeObject<bNode>(json_answer);

            _node = new_node;

            return new_node;
        }
Example #4
0
        public bNode node()
        {
            _node = new bNode();

            //_node.organization = this.organization_id;
            _node.partner_key = this.partner_key;
            _node.node_key = node_key;

            return _node;
        }
Example #5
0
 /* Node
 *
 * A design mistake... I need a node object going all over...
 *
 */
 public bNode node()
 {
     bNode node = new bNode();
     node.AuthKey = this.api_key;
     return node;
 }