示例#1
0
        public string Url()
        {
            string url = new Port(port).Url();

            if (LangExt.isblank(url, ""))
            {
                return(port == album ? "album.tier" : "");
            }
            return(url);
        }
示例#2
0
 private void onSetDevice(object sender, RoutedEventArgs e)
 {
     if (LangExt.isblank(device.Text.Trim()))
     {
         MessageBox.Show("Device name can not be empty!", "Information",
                         MessageBoxButton.OK, MessageBoxImage.Exclamation);
         return;
     }
     else
     {
         savePrefs();
         turnOnDevice(true);
     }
 }
示例#3
0
        private void toLogin(object sender, RoutedEventArgs e)
        {
            if (LangExt.isblank(jserv.Text.Trim()))
            {
                jserv.Text = "127.0.0.1";
            }
            if (LangExt.isblank(port.Text.Trim()))
            {
                port.Text = "8080";
            }

            AnClient.Init(string.Format("http://{0}:{1}/{2}", jserv.Text, port.Text, jservPath));

            // AlbumContext login(String uid, String pswd, TierCallback onOk, JProtocol.OnError onErr)
            singleton.login();
        }
示例#4
0
        public DocsReq blockStart(IFileDescriptor file, SessionInf usr)
        {
            this.device = usr.device;
            if (LangExt.isblank(this.device, new string[] { ".", "/" }))
            {
                throw new SemanticException("File to be uploaded must come with user's device id - for distinguish files. {0}", file.fullpath());
            }

            this.clientpath = file.fullpath();
            this.docName    = file.clientname();
            this.createDate = file.Cdate();
            this.blockSeq   = 0;

            this.a = A.blockStart;
            return(this);
        }
示例#5
0
        //public DocsReq blockUp(long sequence, DocsResp resp, StringBuilder b64, SessionInf usr) throws SemanticException {
        //	string uri64 = b64.toString();
        //	return blockUp(sequence, resp, uri64, usr);
        //}

        public DocsReq blockUp(long sequence, DocsResp resp, string s64, SessionInf usr)
        {
            this.device = usr.device;
            if (LangExt.isblank(this.device, new string[] { ".", "/" }))
            {
                throw new SemanticException("File to be uploaded must come with user's device id - for distinguish files");
            }

            this.blockSeq = sequence;

            this.docId      = resp.RecId();
            this.clientpath = resp.Fullpath();
            this.uri64      = s64;

            this.a = A.blockUp;
            return(this);
        }
示例#6
0
        AlbumContext login(string uid, string pswd)
        {
            if (LangExt.isblank(photoUser.device, new string[] { "\\.", "/", "\\?", ":" }))
            {
                throw new Exception("Device Id is null.");
            }

            AnClient.Init(jserv + "/" + jdocbase, verbose);

            LoginHandler callback = new LoginHandler();

            AnClient.Login(uid, pswd, photoUser.device, callback, callback);

            /*
             *  (SessionClient client) =>
             *  {
             *      client.closeLink();
             *
             *      tier = new AlbumClientier(clientUri, client, errCtx);
             *
             *      client.openLink(clientUri, onHeartbeat, onLinkBroken, 19900); // 4 times failed in 3 min
             *              state = ConnState.Online;
             *              if (onOk != null)
             *                  onOk.ok(tier);
             *  },
             *  // Design Note: since error context don't have unified error message box,
             *  // error context pattern of React is not applicable.
             *  // errCtx.onError(c, r, (Object)v);
             *  (MsgCode c, string r, object v) => {
             *      state = ConnState.LoginFailed;
             *      if (onErr != null)
             *          onErr.err(c, r, v);
             *  }, photoUser.device);
             */
            return(this);
        }
示例#7
0
 public bool needSetup()
 {
     return(LangExt.isblank(jserv, new string[] { "/", ".", "http://", "https://" }) ||
            LangExt.isblank(photoUser.device, "/", ".") ||
            LangExt.isblank(photoUser.uid));
 }