public static void Initialize()
        {
            if (!CloudBackedStore.DirectoryExists(CertDir))
            {
#if DEBUG
                var url = "http://127.0.0.1:10000/devstoreaccount1/components/";
#else
                var url = string.Format("http://{0}.blob.core.windows.net/components/", RoleEnvironment.GetConfigurationSettingValue("StorageName"));
#endif

                CloudBackedStore.Grab(CertDir, "\\makecert.exe", "components", url + "makecert.exe");
            }
        }
Exemple #2
0
        public static void Initialize()
        {
            //First get a reference to the local file structure.
            localStorage = RoleEnvironment.GetLocalResource("scratchpad");

            //Check to see if we have already grabbed the component files.
            if (!CloudBackedStore.DirectoryExists(ComponetDir))
            {
#if DEBUG
                var url = "http://127.0.0.1:10000/devstoreaccount1/components/";
#else
                var url = string.Format("http://{0}.blob.core.windows.net/components/", RoleEnvironment.GetConfigurationSettingValue("StorageName"));
#endif
                CloudBackedStore.Grab(ComponetDir, "\\test.jpg", "components", url + "test.jpg");

                foreach (var app in OdiAppRepo.Apps)
                {
                    if (!string.IsNullOrEmpty(app.PackageName))
                    {
                        CloudBackedStore.Grab(ComponetDir, "\\" + app.PackageName, "components", url + app.PackageName);
                    }

                    if (!string.IsNullOrEmpty(app.ConfName))
                    {
                        CloudBackedStore.Grab(ComponetDir, "\\" + app.ConfName, "components", url + app.ConfName);
                    }

                    var req = app.RequiredFiles;

                    if (req != null)
                    {
                        foreach (var file in req)
                        {
                            CloudBackedStore.Grab(ComponetDir, "\\" + file, "components", url + file);
                        }
                    }
                }
            }
        }
        public static string MakeCertificate(string dir)
        {
            try
            {
                if (!CloudBackedStore.DirectoryExists(dir + "\\" + CertDir))
                {
                    CloudBackedStore.CreateDirectory(dir + "\\" + CertDir);
                }

                ProcessStartInfo start = new ProcessStartInfo();
                start.FileName         = CloudBackedStore.RootDir + CertDir + "\\makecert.exe";
                start.Arguments        = string.Format(command, CloudBackedStore.RootDir + "\\" + dir + "\\" + CertDir);
                start.WorkingDirectory = CloudBackedStore.RootDir + CertDir;
                //start.Verb = "runas";
                start.UseShellExecute        = false;
                start.RedirectStandardOutput = true;
                start.RedirectStandardError  = true;
                // Start the process with the info we specified.
                // Call WaitForExit and then the using statement will close.
                using (Process process = Process.Start(start))
                {
                    process.WaitForExit();

                    var output = process.StandardOutput.ReadToEnd();
                    var error  = process.StandardError.ReadToEnd();
                }

                //extract private key
            }
            catch (Exception e)
            {
                var inner = e.InnerException;
            }

            return(CloudBackedStore.RootDir + "\\" + dir + "\\" + CertDir + "\\oidcertificate.cer");
        }