Пример #1
0
        public PluginResponseInfo DeleteConnection(Guid connectionID)
        {
            ConfigDataHelper.DeleteData(connectionID);
            var resp = ResponseHelper.CreateOkResponse <PluginResponseInfo>();

            return(resp);
        }
Пример #2
0
        public FieldMetadataInfoArrayPluginResponse GetConfigData()
        {
            var resp = ResponseHelper.CreateOkResponse <FieldMetadataInfoArrayPluginResponse>();

            resp.FieldMetaDataObjects = ConfigDataHelper.GetMetaData <DummyArguments>().ToDictionary(f => f.FieldKey);
            return(resp);
        }
Пример #3
0
        public PluginResponseInfo TestConnection(Guid connectionID)
        {
            var info = ConfigDataHelper.GetData <DummyArguments>(connectionID);
            var resp = ResponseHelper.CreateOkResponse <PluginResponseInfo>();

            return(resp);
        }
Пример #4
0
        public PluginResponseInfo TestConfigData(Dictionary <string, string> connectionInfo)
        {
            var config = ConfigDataHelper.GetData <DummyArguments>(connectionInfo);
            var resp   = ResponseHelper.CreateOkResponse <PluginResponseInfo>();

            return(resp);
        }
Пример #5
0
        public override IPluginResponse Execute(IPluginRequest pluginRequest)
        {
            pluginResponse = CreatePluginResponse();

            Log.Info("Retrieving configuration information for workers..");
            workerHostnameMap = ConfigDataHelper.GetWorkerHostnameMap(MongoDatabase);

            netstatCollection = MongoDatabase.GetCollection <BsonDocument>(NetstatCollectionName);

            logsetHash = pluginRequest.LogsetHash;

            List <NetstatEntry> netstatEntries = new List <NetstatEntry>();

            foreach (int workerIndex in workerHostnameMap.Keys)
            {
                Log.InfoFormat("Retrieving netstat information for worker {0}..", workerIndex);
                IEnumerable <NetstatEntry> entriesForWorker = GetNetstatEntriesForWorker(workerIndex);
                netstatEntries.AddRange(entriesForWorker);
            }

            Log.InfoFormat("Writing netstat information to database..");
            CreateTables();
            PersistNetstatEntries(netstatEntries);

            Log.Info("Finished processing netstat data!");

            // Check if we persisted any data.
            if (!PersistedData())
            {
                Log.Info("Failed to persist any netstat data!");
                pluginResponse.GeneratedNoData = true;
            }

            return(pluginResponse);
        }
Пример #6
0
        public override IPluginResponse Execute(IPluginRequest pluginRequest)
        {
            //Set member variables for execution.
            this.pluginRequest     = pluginRequest;
            this.logsetHash        = pluginRequest.LogsetHash;
            this.pluginResponse    = CreatePluginResponse();
            this.workerHostnameMap = ConfigDataHelper.GetWorkerHostnameMap(MongoDatabase);

            // Create output database.
            using (var outputDatabase = GetOutputDatabaseConnection())
            {
                CreateTables(outputDatabase);
            }

            //Process collections.
            ProcessCollections(GetMongoCollections());

            // Check if we persisted any data.
            if (!PersistedData())
            {
                Log.Info("Failed to persist any data from Vizqlserver logs!");
                pluginResponse.GeneratedNoData = true;
            }

            return(pluginResponse);
        }
Пример #7
0
        public PluginResponseInfo SaveConnection(Guid connectionID, Dictionary <string, string> connectionInfo)
        {
            ConfigDataHelper.SaveData <DummyArguments>(connectionID, connectionInfo);
            var resp = ResponseHelper.CreateOkResponse <PluginResponseInfo>();

            return(resp);
        }
Пример #8
0
        public ActorArrayPluginResponse SearchActors(Guid connectionID, string actorType, string searchText, string[] fieldKeys)
        {
            var config = ConfigDataHelper.GetData <DummyArguments>(connectionID);
            var resp   = ResponseHelper.CreateOkResponse <ActorArrayPluginResponse>();

            // ...
            return(resp);
        }
Пример #9
0
        public FieldMetadataInfoArrayPluginResponse GetSupportedActorTypeFields(Guid connectionID, string actorType)
        {
            var config = ConfigDataHelper.GetData <DummyArguments>(connectionID);
            var resp   = ResponseHelper.CreateOkResponse <FieldMetadataInfoArrayPluginResponse>();

            // ...
            return(resp);
        }
Пример #10
0
        public StringArrayPluginResponse GetSupportedActorTypes(Guid connectionID)
        {
            var config = ConfigDataHelper.GetData <DummyArguments>(connectionID);
            var resp   = ResponseHelper.CreateOkResponse <StringArrayPluginResponse>();

            // ...
            return(resp);
        }
Пример #11
0
        public ListItemArrayPluginResponse GetListItems(Guid connectionID, string listName, string[] listItemKeys)
        {
            var config = ConfigDataHelper.GetData <DummyArguments>(connectionID);
            var resp   = ResponseHelper.CreateOkResponse <ListItemArrayPluginResponse>();

            // ...
            return(resp);
        }
Пример #12
0
        public ActorArrayPluginResponse SaveActors(Guid connectionID, ErpActor[] actors)
        {
            var config = ConfigDataHelper.GetData <DummyArguments>(connectionID);
            var resp   = ResponseHelper.CreateOkResponse <ActorArrayPluginResponse>();

            // ...
            return(resp);
        }
Пример #13
0
 public ConfigReader(IMongoDatabase mongoDatabase)
 {
     this.mongoDatabase        = mongoDatabase;
     configDocument            = LoadConfigDocument();
     config                    = LoadConfig();
     fileLastModifiedTimestamp = GetConfigModificationTimestamp();
     workerHostnameMap         = ConfigDataHelper.GetWorkerHostnameMap(mongoDatabase);
 }
Пример #14
0
        public ActorArrayPluginResponse GetActorsByTimestamp(Guid connectionID, string updatedOnOrAfter,
                                                             string actorType, string[] fieldKeys)
        {
            var config = ConfigDataHelper.GetData <DummyArguments>(connectionID);
            var resp   = ResponseHelper.CreateOkResponse <ActorArrayPluginResponse>();

            // ...
            return(resp);
        }
Пример #15
0
    public static void InitPatch()
    {
        IGG.FileUtil.DeleteFileDirectory(BuildSettings.patchDir);

        // version_orign
        {
            string pathDst = string.Format("{0}/version_orign", BuildSettings.patchDir);

            VersionData data = ConfigDataHelper.GetData <VersionData>(VERSION_PATH);
            if (data != null)
            {
                JSONClass json = new JSONClass();
                for (int i = 0; i < data.Items.Length; ++i)
                {
                    VersionData.VersionItem item = data.Items[i];

                    JSONClass jsonItem = new JSONClass();
                    jsonItem.Add("size", item.Size.ToString());
                    jsonItem.Add("md5", item.Md5);

                    json.Add(item.Name, jsonItem);
                }

                IGG.FileUtil.SaveTextToFile(json.ToString(""), pathDst);
            }
        }

        // audio_orign
        {
            string pathAudio = string.Format("{0}/../WwiseProject/GeneratedSoundBanks/{1}", Application.dataPath, EditorHelper.platformName);
            pathAudio = pathAudio.Replace("\\", "/");

            JSONClass jsonAudio = new JSONClass();

            List <string> files = IGG.FileUtil.GetAllChildFiles(pathAudio);
            foreach (string file in files)
            {
                string md5  = IGG.FileUtil.CalcFileMd5(file);
                string name = file.Replace("\\", "/").Replace(pathAudio, "");
                if (name.StartsWith("/"))
                {
                    name = name.Substring(1);
                }

                jsonAudio.Add(name, md5);
            }

            string path = string.Format("{0}/audio_orign", BuildSettings.patchDir);
            IGG.FileUtil.SaveTextToFile(jsonAudio.ToString(""), path);
        }

        // version
        SaveVersionFile(new JSONClass());
    }
Пример #16
0
        protected virtual bool ProcessCollections(IList <IMongoCollection <BsonDocument> > collections)
        {
            var workerHostnameMap  = ConfigDataHelper.GetWorkerHostnameMap(MongoDatabase);
            var totalVizqlSessions = Queries.GetUniqueSessionIdCount(collections);

            using (var persister = new ServerSessionPersister(ExtractFactory))
                using (GetPersisterStatusWriter(persister, totalVizqlSessions))
                {
                    foreach (var collection in collections)
                    {
                        ProcessCollection(collection, persister, workerHostnameMap);
                    }

                    return(persister.ItemsPersisted > 0);
                }
        }
Пример #17
0
        public async Task <bool> InitializeDb(InstallParam param)
        {
            _param = param;
            try
            {
                var connectString = $"Server={param.DbUrl};Database={param.DbName};uid={param.DbUserName};pwd={param.DbUserPwd}";
                ConfigDataHelper.UpdateConnectionString(ConfigKey.BlogsConnectionString, connectString);
                await _blogsContext.Database.EnsureCreatedAsync();

                Seed();
                ConfigDataHelper.UpdateDbInstallStatus(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            return(true);
        }
Пример #18
0
    public static void CopyAssets(bool clear = false)
    {
        if (clear)
        {
            DeleteAssets();
        }

        List <VersionData.VersionItem> list = new List <VersionData.VersionItem>();
        List <string> files = IGG.FileUtil.GetAllChildFiles(BuildSettings.assetBundleOutputPath, "ab");

        if (!ConstantData.enableCache && ConstantData.enableCustomCompress)
        {
            // 自定义压缩
            string inPath  = string.Format("{0}{1}", BuildSettings.assetBundleOutputPath, ConstantData.mainVersion);
            string outPath = "";
            if (ConstantData.enableMd5Name)
            {
                string md5 = IGG.FileUtil.CalcFileMd5(inPath);
                outPath = string.Format("{0}/{1}{2}", ConstantData.streamingAssetsPath, md5, ConstantData.assetBundleExt);
            }
            else
            {
                outPath = string.Format("{0}/data", ConstantData.streamingAssetsPath);
            }

            ThreadParam param = new ThreadParam();
            param.pathSrc = BuildSettings.assetBundleOutputPath;
            param.pathDst = ConstantData.streamingAssetsPath;
            param.list    = list;
            param.files   = files;
            param.index   = 0;
            param.lockd   = new object();

            PackFile(inPath, outPath, "data", param);

            int threadCount = SystemInfo.processorCount;

            List <Thread> threads = new List <Thread>();
            for (int i = 0; i < threadCount; ++i)
            {
                Thread thread = new Thread(new ParameterizedThreadStart(OnThreadCompress));
                thread.Start(param);

                threads.Add(thread);
            }

            while (true)
            {
                EditorUtility.DisplayProgressBar("压缩中...", string.Format("{0}/{1}", param.index, param.files.Count), Mathf.InverseLerp(0, param.files.Count, param.index));

                bool hasAlive = false;
                foreach (Thread thread in threads)
                {
                    if (thread.IsAlive)
                    {
                        hasAlive = true;
                        break;
                    }
                }

                if (!hasAlive)
                {
                    break;
                }

                Thread.Sleep(10);
            }
        }
        else
        {
            // 直接拷贝
            if (ConstantData.enableMd5Name)
            {
                string pathSrc = BuildSettings.assetBundleOutputPath;
                string pathDst = ConstantData.streamingAssetsPath;

                {
                    string file = string.Format("{0}/{1}", pathSrc, ConstantData.mainVersion);
                    CopyAsset(file, pathDst, list, "data");
                }

                int index = 0;
                foreach (string file in files)
                {
                    string name = file.Replace("\\", "/").Replace(pathSrc, "");
                    CopyAsset(file, pathDst, list, name);

                    ++index;
                    EditorUtility.DisplayProgressBar("拷贝中...", string.Format("{0}/{1}", index, files.Count), Mathf.InverseLerp(0, files.Count, index));
                }
            }
            else
            {
                // 把所有的ab文件拷贝进StreamAssets的ab目录下
                IGG.FileUtil.CopyDirectory(BuildSettings.assetBundleOutputPath, Application.streamingAssetsPath + "/ab/", ConstantData.assetBundleExt);

                // 拷贝manifest进StreamAssets,并命名为data
                string pathSrc = string.Format("{0}/{1}", BuildSettings.assetBundleOutputPath, ConstantData.mainVersion);
                string pathDst = string.Format("{0}/ab/data", Application.streamingAssetsPath);
                IGG.FileUtil.CopyFile(pathSrc, pathDst);
            }
        }

        if (ConstantData.enableMd5Name)
        {
            ConfigDataHelper.SaveData <VersionDataProxy>(VERSION_PATH, (data) =>
            {
                data.Items = list.ToArray();
            });
        }

        ClearObsolete(list);

        EditorUtility.ClearProgressBar();
        AssetDatabase.Refresh();
    }
Пример #19
0
    public static void CopyPatch()
    {
        JSONClass jsonList = new JSONClass();

        // ab
        {
            string pathOrign = string.Format("{0}/version_orign", BuildSettings.patchDir);
            if (!File.Exists(pathOrign))
            {
                return;
            }

            JSONClass   jsonOrign = JSONNode.Parse(IGG.FileUtil.ReadTextFromFile(pathOrign)) as JSONClass;
            VersionData data      = ConfigDataHelper.GetData <VersionData>(VERSION_PATH);
            if (data != null)
            {
                for (int i = 0; i < data.Items.Length; ++i)
                {
                    VersionData.VersionItem item = data.Items[i];
                    if (jsonOrign[item.Name] != null && string.Equals(item.Md5, jsonOrign[item.Name]["md5"].Value))
                    {
                        continue;
                    }

                    string pathSrc = string.Format("{0}/{1}{2}", ConstantData.streamingAssetsPath, item.Md5, ConstantData.assetBundleExt);
                    string pathDst = string.Format("{0}/ab/{1}{2}", BuildSettings.patchDir, item.Md5, ConstantData.assetBundleExt);
                    IGG.FileUtil.CopyFile(pathSrc, pathDst);

                    JSONClass itemJson = new JSONClass();
                    itemJson.Add("md5", item.Md5);
                    itemJson.Add("size", item.Size.ToString());
                    itemJson.Add("type", new JSONData((int)PatchFileType.AssetBundle));

                    jsonList.Add(item.Name, itemJson);
                }
            }
        }

        // audio
        {
            string    pathOrign = string.Format("{0}/audio_orign", BuildSettings.patchDir);
            JSONClass jsonOrign = JSONNode.Parse(IGG.FileUtil.ReadTextFromFile(pathOrign)) as JSONClass;

            string pathAudio = string.Format("{0}/../WwiseProject/GeneratedSoundBanks/{1}", Application.dataPath, EditorHelper.platformName);
            pathAudio = pathAudio.Replace("\\", "/");

            List <string> files = IGG.FileUtil.GetAllChildFiles(pathAudio);
            foreach (string file in files)
            {
                string md5  = IGG.FileUtil.CalcFileMd5(file);
                long   size = new FileInfo(file).Length;

                string filename = Path.GetFileName(file);
                if (jsonOrign[filename] == null || !string.Equals(md5, jsonOrign[filename].Value))
                {
                    string pathDst = string.Format("{0}/wwise/{1}", BuildSettings.patchDir, filename);
                    IGG.FileUtil.CopyFile(file, pathDst);

                    JSONClass item = new JSONClass();
                    item.Add("md5", md5);
                    item.Add("size", size.ToString());
                    item.Add("type", new JSONData((int)PatchFileType.Wwise));

                    jsonList.Add(filename, item);
                }
            }
        }

        SaveVersionFile(jsonList);
    }