当前位置: 首页>>代码示例>>C#>>正文


C# API.WriteZip方法代码示例

本文整理汇总了C#中API.WriteZip方法的典型用法代码示例。如果您正苦于以下问题:C# API.WriteZip方法的具体用法?C# API.WriteZip怎么用?C# API.WriteZip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API的用法示例。


在下文中一共展示了API.WriteZip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        /******************************************************** 
        * CLASS METHODS
        *********************************************************/
        public static void Initialize()
        {
            // Start thread
            Thread thread = new Thread(new ThreadStart(Async.Consumer));
            thread.Start();  

            // Set email and password
            string[] credentials = LoadCredentials();
            Email = credentials[0];
            Password = credentials[1];

            //Create API Object
            API = new API(Email, Password);

            //Attempt Login:
            QuantConnectPlugin.Logged = API.Authenticate(Email, Password);

            //Check if QCAlgorithm is saved to its last version
            try
            {
                Async.Add(new APIJob(APICommand.CheckQCAlgoVersion, (latestversion, errors) =>
                {
                    if (!(bool)latestversion)
                    {
                        API.DownloadQCAlgorithm(Directory);
                    }
                }, Directory));
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }

            //Check if QCTemplate exists
            try
            {
                Async.Add(new APIJob(APICommand.UpdateTemplate, (a, b) =>
                {
                    var finished = false;
                    var baseDirectory = Directory + "QCTemplate";
                    var destination = baseDirectory + @"\template.zip";

                    // Check if QCTemplate exists
                    if (!System.IO.Directory.Exists(baseDirectory))
                    {
                        System.IO.Directory.CreateDirectory(baseDirectory);
                        using (System.Net.WebClient client = new System.Net.WebClient())
                        {
                            try
                            {
                                client.DownloadFile(new Uri("https://www.quantconnect.com/api/v1/QCTemplate.zip"), destination);
                                finished = true;
                            } catch 
                            {
                                MessageBox.Show("Sorry there was an error downloading the QCTemplate Project. Please make sure your computer has access to the internet.");
                            }
                        }

                        if (finished)
                        {
                            API.WriteZip(baseDirectory, destination);
                        }
                    }
                }, Directory));
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }

        }
开发者ID:QuantConnect,项目名称:QCStudioPlugin,代码行数:74,代码来源:QuantConnectPlugin.cs


注:本文中的API.WriteZip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。