Exemplo n.º 1
0
        public VRChatApi(string username, string password)
        {
            Logger.Trace(() => $"Entering {nameof(VRChatApi)} constructor");
            Logger.Debug(() => $"Using username {username}");

            // initialize endpoint classes
            RemoteConfig   = new RemoteConfig();
            UserApi        = new UserApi(username, password);
            FriendsApi     = new FriendsApi();
            WorldApi       = new WorldApi();
            ModerationsApi = new ModerationsApi();
            AvatarApi      = new AvatarApi();

            // initialize http client
            // TODO: use the auth cookie
            if (Global.HttpClient == null)
            {
                Logger.Trace(() => $"Instantiating {nameof(HttpClient)}");
                Global.HttpClient             = new HttpClient();
                Global.HttpClient.BaseAddress = new Uri("https://api.vrchat.cloud/api/1/");
                Logger.Info(() => $"VRChat API base address set to {Global.HttpClient.BaseAddress}");
            }

            string authEncoded = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{UserApi.Username}:{UserApi.Password}"));

            var header = Global.HttpClient.DefaultRequestHeaders;

            if (header.Contains("Authorization"))
            {
                Logger.Debug(() => "Removing existing Authorization header");
                header.Remove("Authorization");
            }
            header.Add("Authorization", $"Basic {authEncoded}");
            Logger.Trace(() => $"Added new Authorization header");
        }
Exemplo n.º 2
0
        public virtual void TestPush()
        {
            // create other repository
            Repository db2 = CreateWorkRepository();
            // setup the first repository
            StoredConfig config       = ((FileBasedConfig)db.GetConfig());
            RemoteConfig remoteConfig = new RemoteConfig(config, "test");
            URIish       uri          = new URIish(db2.Directory.ToURI().ToURL());

            remoteConfig.AddURI(uri);
            remoteConfig.Update(config);
            config.Save();
            Git git1 = new Git(db);
            // create some refs via commits and tag
            RevCommit commit = git1.Commit().SetMessage("initial commit").Call();
            RevTag    tag    = git1.Tag().SetName("tag").Call();

            try
            {
                db2.Resolve(commit.Id.GetName() + "^{commit}");
                NUnit.Framework.Assert.Fail("id shouldn't exist yet");
            }
            catch (MissingObjectException)
            {
            }
            // we should get here
            RefSpec spec = new RefSpec("refs/heads/master:refs/heads/x");

            git1.Push().SetRemote("test").SetRefSpecs(spec).Call();
            NUnit.Framework.Assert.AreEqual(commit.Id, db2.Resolve(commit.Id.GetName() + "^{commit}"
                                                                   ));
            NUnit.Framework.Assert.AreEqual(tag.Id, db2.Resolve(tag.Id.GetName()));
        }
Exemplo n.º 3
0
        public async static void DownloadAndInstallVRCSDK(VRC_SDK_Type type)
        {
            RemoteConfig remoteConfig = await LoadRemoteConfig();

            string url;

            if (type == VRC_SDK_Type.SDK_2)
            {
                url = remoteConfig.sdk2;
            }
            else if (type == VRC_SDK_Type.SDK_3_Avatar)
            {
                url = remoteConfig.sdk3_avatars;
            }
            else if (type == VRC_SDK_Type.SDK_3_World)
            {
                url = remoteConfig.sdk3_worlds;
            }
            else
            {
                return;
            }
            if (File.Exists(PATH.TEMP_VRC_SDK_PACKAGE))
            {
                File.Delete(PATH.TEMP_VRC_SDK_PACKAGE);
            }
            PersistentData.Set("vrc_sdk_version", UrlToVersion(url));
            WebHelper2.DownloadFileASync(url, PATH.TEMP_VRC_SDK_PACKAGE, VRCSDKUpdateCallback);
        }
Exemplo n.º 4
0
 public IEnumerator <Remote> GetEnumerator()
 {
     foreach (RemoteConfig rc in RemoteConfig.GetAllRemoteConfigs(_repo._internal_repo.Config))
     {
         yield return(new Remote(_repo, rc));
     }
 }
Exemplo n.º 5
0
        public Remote CreateRemote(string name)
        {
            RemoteConfig rc = new RemoteConfig(_repo._internal_repo.Config, name);

            _repo.Config.Persist();
            return(new Remote(_repo, rc));
        }
Exemplo n.º 6
0
        public virtual void TestPushWithoutPushRefSpec()
        {
            Git          git          = new Git(db);
            Git          git2         = new Git(CreateBareRepository());
            StoredConfig config       = git.GetRepository().GetConfig();
            RemoteConfig remoteConfig = new RemoteConfig(config, "test");
            URIish       uri          = new URIish(git2.GetRepository().Directory.ToURI().ToURL());

            remoteConfig.AddURI(uri);
            remoteConfig.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
            remoteConfig.Update(config);
            config.Save();
            WriteTrashFile("f", "content of f");
            git.Add().AddFilepattern("f").Call();
            RevCommit commit = git.Commit().SetMessage("adding f").Call();

            git.Checkout().SetName("not-pushed").SetCreateBranch(true).Call();
            git.Checkout().SetName("branchtopush").SetCreateBranch(true).Call();
            NUnit.Framework.Assert.AreEqual(null, git2.GetRepository().Resolve("refs/heads/branchtopush"
                                                                               ));
            NUnit.Framework.Assert.AreEqual(null, git2.GetRepository().Resolve("refs/heads/not-pushed"
                                                                               ));
            NUnit.Framework.Assert.AreEqual(null, git2.GetRepository().Resolve("refs/heads/master"
                                                                               ));
            git.Push().SetRemote("test").Call();
            NUnit.Framework.Assert.AreEqual(commit.Id, git2.GetRepository().Resolve("refs/heads/branchtopush"
                                                                                    ));
            NUnit.Framework.Assert.AreEqual(null, git2.GetRepository().Resolve("refs/heads/not-pushed"
                                                                               ));
            NUnit.Framework.Assert.AreEqual(null, git2.GetRepository().Resolve("refs/heads/master"
                                                                               ));
        }
Exemplo n.º 7
0
        public virtual void TestFetch()
        {
            // create other repository
            Repository db2  = CreateWorkRepository();
            Git        git2 = new Git(db2);
            // setup the first repository to fetch from the second repository
            StoredConfig config       = ((FileBasedConfig)db.GetConfig());
            RemoteConfig remoteConfig = new RemoteConfig(config, "test");
            URIish       uri          = new URIish(db2.Directory.ToURI().ToURL());

            remoteConfig.AddURI(uri);
            remoteConfig.Update(config);
            config.Save();
            // create some refs via commits and tag
            RevCommit commit = git2.Commit().SetMessage("initial commit").Call();
            Ref       tagRef = git2.Tag().SetName("tag").Call();
            Git       git1   = new Git(db);
            RefSpec   spec   = new RefSpec("refs/heads/master:refs/heads/x");

            git1.Fetch().SetRemote("test").SetRefSpecs(spec).Call();
            NUnit.Framework.Assert.AreEqual(commit.Id, db.Resolve(commit.Id.GetName() + "^{commit}"
                                                                  ));
            NUnit.Framework.Assert.AreEqual(tagRef.GetObjectId(), db.Resolve(tagRef.GetObjectId
                                                                                 ().GetName()));
        }
Exemplo n.º 8
0
        /// <returns>
        /// the full remote-tracking branch name or <code>null</code> if it
        /// could not be determined
        /// </returns>
        public virtual string GetRemoteTrackingBranch()
        {
            string remote   = GetRemote();
            string mergeRef = GetMergeBranch();

            if (remote == null || mergeRef == null)
            {
                return(null);
            }
            RemoteConfig remoteConfig;

            try
            {
                remoteConfig = new RemoteConfig(config, remote);
            }
            catch (URISyntaxException)
            {
                return(null);
            }
            foreach (RefSpec refSpec in remoteConfig.FetchRefSpecs)
            {
                if (refSpec.MatchSource(mergeRef))
                {
                    RefSpec expanded = refSpec.ExpandFromSource(mergeRef);
                    return(expanded.GetDestination());
                }
            }
            return(null);
        }
Exemplo n.º 9
0
        public virtual void TestPushRefUpdate()
        {
            Git          git          = new Git(db);
            Git          git2         = new Git(CreateBareRepository());
            StoredConfig config       = git.GetRepository().GetConfig();
            RemoteConfig remoteConfig = new RemoteConfig(config, "test");
            URIish       uri          = new URIish(git2.GetRepository().Directory.ToURI().ToURL());

            remoteConfig.AddURI(uri);
            remoteConfig.AddPushRefSpec(new RefSpec("+refs/heads/*:refs/heads/*"));
            remoteConfig.Update(config);
            config.Save();
            WriteTrashFile("f", "content of f");
            git.Add().AddFilepattern("f").Call();
            RevCommit commit = git.Commit().SetMessage("adding f").Call();

            NUnit.Framework.Assert.AreEqual(null, git2.GetRepository().Resolve("refs/heads/master"
                                                                               ));
            git.Push().SetRemote("test").Call();
            NUnit.Framework.Assert.AreEqual(commit.Id, git2.GetRepository().Resolve("refs/heads/master"
                                                                                    ));
            git.BranchCreate().SetName("refs/heads/test").Call();
            git.Checkout().SetName("refs/heads/test").Call();
            for (int i = 0; i < 6; i++)
            {
                WriteTrashFile("f" + i, "content of f" + i);
                git.Add().AddFilepattern("f" + i).Call();
                commit = git.Commit().SetMessage("adding f" + i).Call();
                git.Push().SetRemote("test").Call();
                git2.GetRepository().GetAllRefs();
                NUnit.Framework.Assert.AreEqual(commit.Id, git2.GetRepository().Resolve("refs/heads/test"
                                                                                        ), "failed to update on attempt " + i);
            }
        }
Exemplo n.º 10
0
        public static void GoHome() // Had to remake this because VRChats code SUCKKSSSSSSSSSSS also for other mods
        {
            string homew;
            var    wi = RoomManagerBase.field_Internal_Static_ApiWorldInstance_0;

            if (!string.IsNullOrEmpty(APIUser.CurrentUser.homeLocation))
            {
                homew = APIUser.CurrentUser.homeLocation;
            }
            else
            {
                homew = RemoteConfig.GetString("homeWorldId");
            }

            if (!InLobby())
            {
                return;
            }
            if (IsHome() && (wi.InstanceType == ApiWorldInstance.AccessType.InviteOnly | wi.InstanceType == ApiWorldInstance.AccessType.InvitePlus))
            {
                return;
            }

            SetWorldM.Invoke(VRCFlowManager.field_Private_Static_VRCFlowManager_0, new object[] { null });
            VRCFlowManager.field_Private_Static_VRCFlowManager_0.prop_String_0 = homew;
            VRCFlowManager.field_Private_Static_VRCFlowManager_0.field_Protected_AccessType_0 = ApiWorldInstance.AccessType.InviteOnly;
        }
        public static void Init()
        {
            if (!RemoteConfig.IsInitialized())
            {
                RemoteConfig.Init();
            }

            if (isInitialized)
            {
                return;
            }

            if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load())
            {
                APIUser.Login(null, null);
            }

            clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath();
            if (string.IsNullOrEmpty(clientInstallPath))
            {
                clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath();
            }

            signingIn     = false;
            isInitialized = true;
        }
    IEnumerator FetchUploadedData()
    {
        if (!RemoteConfig.IsInitialized())
        {
            RemoteConfig.Init();
        }

        if (!APIUser.IsLoggedInWithCredentials)
        {
            yield break;
        }

        ApiCache.ClearResponseCache();
        VRCCachedWWW.ClearOld();

        if (fetchingAvatars == null)
        {
            fetchingAvatars = EditorCoroutine.Start(() => FetchAvatars());
        }
        if (fetchingWorlds == null)
        {
            fetchingWorlds = EditorCoroutine.Start(() => FetchWorlds());
        }
        FetchTestAvatars();
    }
Exemplo n.º 13
0
        private void InitRemoteConfig()
        {
            firebaseRemoteConfig = RemoteConfig.SharedInstance;
            RemoteConfigSettings configSettings = new RemoteConfigSettings(true);

            firebaseRemoteConfig.ConfigSettings = configSettings;
        }
Exemplo n.º 14
0
        public void testBackup()
        {
            readConfig("[remote \"backup\"]\n"
                        + "url = http://www.spearce.org/egit.git\n"
                        + "url = [email protected]:/srv/git/egit.git\n"
                        + "push = +refs/heads/*:refs/heads/*\n"
                        + "push = refs/tags/*:refs/tags/*\n");

            RemoteConfig rc = new RemoteConfig(config, "backup");
            System.Collections.Generic.List<URIish> allURIs = rc.URIs;

            Assert.AreEqual("backup", rc.Name);
            Assert.IsNotNull(allURIs);
            Assert.IsNotNull(rc.Fetch);
            Assert.IsNotNull(rc.Push);

            Assert.AreEqual(2, allURIs.Count);
            Assert.AreEqual("http://www.spearce.org/egit.git", allURIs[0].ToString());
            Assert.AreEqual("[email protected]:/srv/git/egit.git", allURIs[1].ToString());

            Assert.AreEqual(0, rc.Fetch.Count);

            Assert.AreEqual(2, rc.Push.Count);
            RefSpec spec = rc.Push[0];
            Assert.IsTrue(spec.Force);
            Assert.IsTrue(spec.Wildcard);
            Assert.AreEqual("refs/heads/*", spec.Source);
            Assert.AreEqual("refs/heads/*", spec.Destination);

            spec = rc.Push[1];
            Assert.IsFalse(spec.Force);
            Assert.IsTrue(spec.Wildcard);
            Assert.AreEqual("refs/tags/*", spec.Source);
            Assert.AreEqual("refs/tags/*", spec.Destination);
        }
Exemplo n.º 15
0
 public virtual void TestCheckoutRemoteTrackingWithoutLocalBranch()
 {
     try
     {
         // create second repository
         Repository db2  = CreateWorkRepository();
         Git        git2 = new Git(db2);
         // setup the second repository to fetch from the first repository
         StoredConfig config       = db2.GetConfig();
         RemoteConfig remoteConfig = new RemoteConfig(config, "origin");
         URIish       uri          = new URIish(db.Directory.ToURI().ToURL());
         remoteConfig.AddURI(uri);
         remoteConfig.Update(config);
         config.Save();
         // fetch from first repository
         RefSpec spec = new RefSpec("+refs/heads/*:refs/remotes/origin/*");
         git2.Fetch().SetRemote("origin").SetRefSpecs(spec).Call();
         // checkout remote tracking branch in second repository
         // (no local branches exist yet in second repository)
         git2.Checkout().SetName("remotes/origin/test").Call();
         NUnit.Framework.Assert.AreEqual("[Test.txt, mode:100644, content:Some change]", IndexState
                                             (db2, CONTENT));
     }
     catch (Exception e)
     {
         NUnit.Framework.Assert.Fail(e.Message);
     }
 }
Exemplo n.º 16
0
        public async Task <ActionResult <RemoteConfig> > PostAppConfig(RemoteConfig appConfig)
        {
            _context.RemoteConfig.Add(appConfig);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAppConfig", new { id = appConfig.Id }, appConfig));
        }
Exemplo n.º 17
0
        /// <exception cref="Sharpen.URISyntaxException"></exception>
        /// <exception cref="NGit.Api.Errors.JGitInternalException"></exception>
        /// <exception cref="NGit.Api.Errors.InvalidRemoteException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        private FetchResult Fetch(Repository repo, URIish u)
        {
            // create the remote config and save it
            RemoteConfig config = new RemoteConfig(repo.GetConfig(), remote);

            config.AddURI(u);
            string  dst     = bare ? Constants.R_HEADS : Constants.R_REMOTES + config.Name;
            RefSpec refSpec = new RefSpec();

            refSpec = refSpec.SetForceUpdate(true);
            refSpec = refSpec.SetSourceDestination(Constants.R_HEADS + "*", dst + "/*");
            //$NON-NLS-1$ //$NON-NLS-2$
            config.AddFetchRefSpec(refSpec);
            config.Update(repo.GetConfig());
            repo.GetConfig().Save();
            // run the fetch command
            FetchCommand command = new FetchCommand(repo);

            command.SetRemote(remote);
            command.SetProgressMonitor(monitor);
            command.SetTagOpt(TagOpt.FETCH_TAGS);
            command.SetTimeout(timeout);
            if (credentialsProvider != null)
            {
                command.SetCredentialsProvider(credentialsProvider);
            }
            IList <RefSpec> specs = CalculateRefSpecs(dst);

            command.SetRefSpecs(specs);
            return(command.Call());
        }
Exemplo n.º 18
0
        public async Task <IActionResult> PutAppConfig(Guid id, RemoteConfig appConfig)
        {
            if (id != appConfig.Id)
            {
                return(BadRequest());
            }

            _context.Entry(appConfig).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AppConfigExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public override void SetUp()
        {
            base.SetUp();
            dbTarget = CreateWorkRepository();
            source   = new Git(db);
            target   = new Git(dbTarget);
            // put some file in the source repo
            sourceFile = new FilePath(db.WorkTree, "SomeFile.txt");
            WriteToFile(sourceFile, "Hello world");
            // and commit it
            source.Add().AddFilepattern("SomeFile.txt").Call();
            source.Commit().SetMessage("Initial commit for source").Call();
            // configure the target repo to connect to the source via "origin"
            StoredConfig targetConfig = ((FileBasedConfig)dbTarget.GetConfig());

            targetConfig.SetString("branch", "master", "remote", "origin");
            targetConfig.SetString("branch", "master", "merge", "refs/heads/master");
            RemoteConfig config = new RemoteConfig(targetConfig, "origin");

            config.AddURI(new URIish(source.GetRepository().WorkTree.GetPath()));
            config.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
            config.Update(targetConfig);
            targetConfig.Save();
            targetFile = new FilePath(dbTarget.WorkTree, "SomeFile.txt");
            // make sure we have the same content
            target.Pull().Call();
            AssertFileContentsEqual(targetFile, "Hello world");
        }
Exemplo n.º 20
0
        public static LocalGitRepository Init(string targetLocalPath, string url)
        {
            InitCommand ci = new InitCommand();

            ci.SetDirectory(targetLocalPath);
            ci.Call();
            LocalGitRepository repo = new LocalGitRepository(Path.Combine(targetLocalPath, Constants.DOT_GIT));

            string branch = Constants.R_HEADS + "master";

            RefUpdate head = repo.UpdateRef(Constants.HEAD);

            head.DisableRefLog();
            head.Link(branch);

            if (url != null)
            {
                RemoteConfig remoteConfig = new RemoteConfig(repo.GetConfig(), "origin");
                remoteConfig.AddURI(new URIish(url));

                string  dst  = Constants.R_REMOTES + remoteConfig.Name;
                RefSpec wcrs = new RefSpec();
                wcrs = wcrs.SetForceUpdate(true);
                wcrs = wcrs.SetSourceDestination(Constants.R_HEADS + "*", dst + "/*");

                remoteConfig.AddFetchRefSpec(wcrs);
                remoteConfig.Update(repo.GetConfig());
            }

            // we're setting up for a clone with a checkout
            repo.GetConfig().SetBoolean("core", null, "bare", false);

            repo.GetConfig().Save();
            return(repo);
        }
Exemplo n.º 21
0
        public static void Init()
        {
            if (!RemoteConfig.IsInitialized())
            {
                RemoteConfig.Init();
            }

            if (isInitialized)
            {
                return;
            }

            if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load())
            {
                APIUser.Login((user) => AnalyticsSDK.LoggedInUserChanged(user), null);
            }

            clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath();
            if (string.IsNullOrEmpty(clientInstallPath))
            {
                clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath();
            }

            signingIn     = false;
            isInitialized = true;

            VRCContentManagerWindow.ClearContent();
        }
Exemplo n.º 22
0
 public static void ConfigureConnection(string hostname, int port, RemoteConfig config, TimeSpan connectionTimeout)
 {
     _port              = port;
     _hostname          = hostname;
     _config            = config;
     _connectionTimeout = connectionTimeout;
 }
Exemplo n.º 23
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Key,Value")] RemoteConfig appConfig)
        {
            if (id != appConfig.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appConfig);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppConfigExists(appConfig.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(appConfig));
        }
Exemplo n.º 24
0
        /// <exception cref="Sharpen.URISyntaxException"></exception>
        /// <exception cref="NGit.Api.Errors.JGitInternalException"></exception>
        /// <exception cref="NGit.Api.Errors.InvalidRemoteException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        private FetchResult Fetch(Repository repo, URIish u)
        {
            // create the remote config and save it
            RemoteConfig config = new RemoteConfig(repo.GetConfig(), remote);

            config.AddURI(u);
            string  dst     = Constants.R_REMOTES + config.Name;
            RefSpec refSpec = new RefSpec();

            refSpec = refSpec.SetForceUpdate(true);
            refSpec = refSpec.SetSourceDestination(Constants.R_HEADS + "*", dst + "/*");
            //$NON-NLS-1$ //$NON-NLS-2$
            config.AddFetchRefSpec(refSpec);
            config.Update(repo.GetConfig());
            repo.GetConfig().SetString(ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants
                                       .CONFIG_KEY_REMOTE, remote);
            repo.GetConfig().SetString(ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants
                                       .CONFIG_KEY_MERGE, branch);
            repo.GetConfig().Save();
            // run the fetch command
            FetchCommand command = new FetchCommand(repo);

            command.SetRemote(remote);
            command.SetProgressMonitor(monitor);
            command.SetTagOpt(TagOpt.FETCH_TAGS);
            if (credentialsProvider != null)
            {
                command.SetCredentialsProvider(credentialsProvider);
            }
            return(command.Call());
        }
Exemplo n.º 25
0
        public object ModifyDtuRemoteConfigRequest([FromUri] int dtuId, [FromBody] DtuConfig dtuConfig)
        {
            // ET通信
            ILog log = LogManager.GetLogger("DtuRemoteConfig");

            log.DebugFormat("Instant DTU remote config: DTU={0}, dtuConfig={1}", dtuId, dtuConfig);
            // 设置消息头
            Guid            guid   = Guid.NewGuid();
            FsMessageHeader header = new FsMessageHeader
            {
                S = "WebClient",
                A = "GET",
                R = "/et/dtu/instant/at", // request url.
                U = guid,
                T = Guid.NewGuid()
            };
            // 设置部分消息体
            RemoteConfig rc = new RemoteConfig
            {
                Count        = 2,
                Ip1          = dtuConfig.Ip,
                Port1        = dtuConfig.Port,
                Ip2          = dtuConfig.Ip2,
                Port2        = dtuConfig.Port2,
                Mode         = dtuConfig.DtuMode.ToUpper(),
                ByteInterval = dtuConfig.PacketInterval,
                Retry        = dtuConfig.ReconnectionCount
            };
            List <CommandConfig> listCmd = RemoteConfigService.GetCommand(rc);

            FsMessage msg = new FsMessage
            {
                Header = header,
                Body   = new { dtuId, cmds = listCmd }
            };

            // return msg.Body;
            WebClientService.SendToET(msg); // 向ET Push DTU远程配置消息

            using (var entity = new SecureCloud_Entities())
            {
                var strGuid = guid.ToString();
                var query   = from ti in entity.T_TASK_INSTANT
                              where ti.MSG_ID == strGuid
                              select new
                {
                    msgid = ti.MSG_ID
                };
                var result = true;
                var list   = query.ToList();
                if (list.Count == 0)
                {
                    result = false;
                }
                var json = new JObject(
                    new JProperty("msgid", guid),
                    new JProperty("result", result));
                return(json);
            }
        }
Exemplo n.º 26
0
        public async Task Clone()
        {
            if (Repository != null)
            {
                throw new InvalidOperationException();
            }
            var url = "https://github.com/" + Settings.Owner + "/" + Settings.Repository + ".git";
            var git = Git.Init().SetDirectory(Location).Call();

            Repository = git.GetRepository();

            var config       = Repository.GetConfig();
            var remoteConfig = new RemoteConfig(config, "origin");

            remoteConfig.AddURI(new URIish(url));
            remoteConfig.AddFetchRefSpec(new RefSpec(
                                             "+refs/heads/" + Settings.Branch +
                                             ":refs/remotes/origin/" + Settings.Branch));
            remoteConfig.Update(config);
            config.Save();

            await Fetch();

            await Task.Run(() => {
                git.BranchCreate().SetName(Settings.Branch).SetStartPoint("origin/" + Settings.Branch)
                .SetUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).Call();
                git.Checkout().SetName(Settings.Branch).Call();
            });
        }
Exemplo n.º 27
0
        public VRChatApi(string username, string password)
        {
            // initialize endpoint classes
            RemoteConfig = new RemoteConfig();
            UserApi      = new UserApi(username, password);
            FriendsApi   = new FriendsApi();
            WorldApi     = new WorldApi();

            // initialize http client
            // TODO: use the auth cookie
            if (Global.HttpClient == null)
            {
                Global.HttpClient             = new HttpClient();
                Global.HttpClient.BaseAddress = new Uri("https://api.vrchat.cloud/api/1/");
            }

            string authEncoded = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{UserApi.Username}:{UserApi.Password}"));

            var header = Global.HttpClient.DefaultRequestHeaders;

            if (header.Contains("Authorization"))
            {
                header.Remove("Authorization");
            }
            header.Add("Authorization", $"Basic {authEncoded}");
        }
Exemplo n.º 28
0
        public void testSimple()
        {
            readConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" +
                        "fetch = +refs/heads/*:refs/remotes/spearce/*\n");

            RemoteConfig rc = new RemoteConfig(config, "spearce");
            System.Collections.Generic.List<URIish> allURIs = rc.URIs;

            Assert.AreEqual("spearce", rc.Name);
            Assert.IsNotNull(allURIs);
            Assert.IsNotNull(rc.Fetch);
            Assert.IsNotNull(rc.Push);
            Assert.IsNotNull(rc.TagOpt);
            Assert.AreEqual(0, rc.Timeout);
            Assert.AreSame(TagOpt.AUTO_FOLLOW, rc.TagOpt);

            Assert.AreEqual(1, allURIs.Count);
            Assert.AreEqual("http://www.spearce.org/egit.git", allURIs[0].ToString());

            Assert.AreEqual(1, rc.Fetch.Count);
            RefSpec spec = rc.Fetch[0];
            Assert.IsTrue(spec.Force);
            Assert.IsTrue(spec.Wildcard);
            Assert.AreEqual("refs/heads/*", spec.Source);
            Assert.AreEqual("refs/remotes/spearce/*", spec.Destination);

            Assert.AreEqual(0, rc.Push.Count);
        }
Exemplo n.º 29
0
        public void testUploadPack()
        {
            readConfig("[remote \"example\"]\n"
                        + "url = [email protected]:egit.git\n"
                        + "fetch = +refs/heads/*:refs/remotes/example/*\n"
                        + "uploadpack = /path/to/git/git-upload-pack\n"
                        + "receivepack = /path/to/git/git-receive-pack\n");

            RemoteConfig rc = new RemoteConfig(config, "example");
            System.Collections.Generic.List<URIish> allURIs = rc.URIs;

            Assert.AreEqual("example", rc.Name);
            Assert.IsNotNull(allURIs);
            Assert.IsNotNull(rc.Fetch);
            Assert.IsNotNull(rc.Push);

            Assert.AreEqual(1, allURIs.Count);
            Assert.AreEqual("[email protected]:egit.git", allURIs[0].ToString());

            Assert.AreEqual(1, rc.Fetch.Count);
            RefSpec spec = rc.Fetch[0];
            Assert.IsTrue(spec.Force);
            Assert.IsTrue(spec.Wildcard);
            Assert.AreEqual("refs/heads/*", spec.Source);
            Assert.AreEqual("refs/remotes/example/*", spec.Destination);

            Assert.AreEqual(0, rc.Push.Count);

            Assert.AreEqual("/path/to/git/git-upload-pack", rc.UploadPack);
            Assert.AreEqual("/path/to/git/git-receive-pack", rc.ReceivePack);
        }
Exemplo n.º 30
0
    // Token: 0x060058D2 RID: 22738 RVA: 0x001EC2CC File Offset: 0x001EA6CC
    public static bool IsAllowedUrl(string url)
    {
        if (string.IsNullOrEmpty(url))
        {
            Debug.LogError("Plugin URL is empty");
            return(false);
        }
        if (url.ToLower().StartsWith("file:///"))
        {
            return(true);
        }
        List <string> list = RemoteConfig.GetList("whiteListedAssetUrls");

        if (list == null || list.Count == 0)
        {
            Debug.LogError("No plugins are allowed");
            return(false);
        }
        if (list.Any((string allowed) => url.ToLower().StartsWith(allowed.ToLower())))
        {
            return(true);
        }
        Debug.LogError("Will not load plugin at " + url);
        return(false);
    }
Exemplo n.º 31
0
 public FetchConfigResponse(Guid requestId, IRemoteConfig config, List<Group> groups)
     : base(requestId)
 {
     Config = new RemoteConfig(config);
       Groups = groups;
 }
Exemplo n.º 32
0
 public static void set_remote_config(RemoteConfig config)
 {
     PSMoveapiCsharpPinvoke.set_remote_config((int) config);
 }
Exemplo n.º 33
0
 public static void set_remote_config(RemoteConfig config)
 {
     psmoveapi_csharpPINVOKE.set_remote_config((int)config);
 }