Exemplo n.º 1
0
        private static Dictionary <string, byte[]> GetCompressedSignalDataFiles(string signalDataPath)
        {
            if (!Directory.Exists(signalDataPath))
            {
                return(new Dictionary <string, byte[]>(0));
            }

            var path   = signalDataPath;
            var result = new Dictionary <string, byte[]>();

            for (int i = 4; i > 1; i--)  //scan signal, strategy and portfolio directory levels
            {
                foreach (var file in Directory.GetFiles(path))
                {
                    //do not upload backtest results back to server
                    if (Path.GetFileName(file) == "Backtest Results.xml")
                    {
                        continue;
                    }

                    var levels = file.Split(Path.DirectorySeparatorChar);
                    levels = levels.Skip(levels.Length - i).ToArray();  //path relative to portfolio
                    result.Add(String.Join("\\", levels), Extentions.Compress(File.ReadAllBytes(file)));
                }
                path = Directory.GetParent(path).FullName;
            }
            return(result);
        }
Exemplo n.º 2
0
        private static Dictionary <string, byte[]> GetCompressedScriptingDlls(string solutionPath)
        {
            var bins = Path.Combine(solutionPath, "SimulatedServer", "bin", "x64", "Release");  //x64 first

            if (!Directory.Exists(bins))
            {
                bins = Path.Combine(solutionPath, "SimulatedServer", "bin", "Release");  //fallback to x86
            }
            if (!Directory.Exists(bins))
            {
                return(new Dictionary <string, byte[]>(0));
            }

            var sharedDlls = new List <string>
            {
                "CommonObjects",
                "DebugService",
                "Backtest",
                "Scripting",
                "Xceed.Wpf.Toolkit"
            };

            var result = new Dictionary <string, byte[]>();

            foreach (var dll in Directory.GetFiles(bins, "*.dll", SearchOption.TopDirectoryOnly))
            {
                if (!sharedDlls.Contains(Path.GetFileNameWithoutExtension(dll)))
                {
                    result.Add(Path.GetFileName(dll), Extentions.Compress(File.ReadAllBytes(dll)));
                }
            }
            return(result);
        }