Пример #1
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))
            {
                var url = string.Format("http://{0}.blob.core.windows.net/components/", RoleEnvironment.GetConfigurationSettingValue("StorageName"));

                foreach (var app in OdpiAppRepo.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);
                        }
                    }
                }
            }
        }
Пример #2
0
 public static void Initialize()
 {
     if (!CloudBackedStore.DirectoryExists(CertDir))
     {
         var url = string.Format("http://{0}.blob.core.windows.net/components/", RoleEnvironment.GetConfigurationSettingValue("StorageName"));
         CloudBackedStore.Grab(CertDir, "\\makecert.exe", "components", url + "makecert.exe");
     }
 }
Пример #3
0
        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");
        }