conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
using MrCMS.Web.Apps.Ecommerce.Areas.Admin.Services;
using MrCMS.Web.Apps.Ecommerce.Entities.Orders;
=======
using MrCMS.Settings;
using MrCMS.Web.Apps.Ecommerce.ACL;
using MrCMS.Web.Apps.Ecommerce.Helpers;
>>>>>>>
using MrCMS.Web.Apps.Ecommerce.Areas.Admin.Services;
using MrCMS.Web.Apps.Ecommerce.Entities.Orders;
using MrCMS.Web.Apps.Ecommerce.ACL;
<<<<<<<
public ViewResult Index(OrderSearchModel model)
{
ViewData["shipping-status-options"] = _orderAdminService.GetShippingStatusOptions();
ViewData["payment-status-options"] = _orderAdminService.GetPaymentStatusOptions();
ViewData["results"] = _orderAdminService.Search(model);
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.List)]
public ViewResult Index(OrderSearchModel model, int page = 1)
{
ViewData["ShippingStatuses"] = GeneralHelper.GetEnumOptionsWithEmpty<ShippingStatus>();
ViewData["PaymentStatuses"] = GeneralHelper.GetEnumOptionsWithEmpty<PaymentStatus>();
model.Results = new PagedList<Order>(null, 1, _ecommerceSettings.DefaultPageSize);
try
{
model.Results = _orderSearchService.SearchOrders(model, page, _ecommerceSettings.DefaultPageSize);
}
catch (Exception)
{
model.Results = _orderService.GetPaged(page);
}
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.List)]
public ViewResult Index(OrderSearchModel model)
{
ViewData["shipping-status-options"] = _orderAdminService.GetShippingStatusOptions();
ViewData["payment-status-options"] = _orderAdminService.GetPaymentStatusOptions();
ViewData["results"] = _orderAdminService.Search(model);
<<<<<<<
? (ActionResult) View(order)
: RedirectToAction("Index");
=======
? (ActionResult)View(order)
: RedirectToAction("Index");
}
[ActionName("Edit")]
[HttpPost]
[ForceImmediateLuceneUpdate]
[MrCMSACLRule(typeof(OrderACL), OrderACL.Edit)]
public RedirectToRouteResult Edit_POST(Order order, int shippingMethodId = 0)
{
order.User = CurrentRequestData.CurrentUser;
_orderService.Save(order);
return RedirectToAction("Index");
>>>>>>>
? (ActionResult) View(order)
: RedirectToAction("Index");
<<<<<<<
public PartialViewResult MarkAsShipped(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsShipped)]
public PartialViewResult MarkAsShipped(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsShipped)]
public PartialViewResult MarkAsShipped(Order order)
<<<<<<<
public RedirectToRouteResult MarkAsShipped_POST(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsShipped)]
public RedirectToRouteResult MarkAsShipped_POST(Order order,bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsShipped)]
public RedirectToRouteResult MarkAsShipped_POST(Order order)
<<<<<<<
public PartialViewResult MarkAsPaid(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsPaid)]
public PartialViewResult MarkAsPaid(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsPaid)]
public PartialViewResult MarkAsPaid(Order order)
<<<<<<<
public RedirectToRouteResult MarkAsPaid_POST(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsPaid)]
public RedirectToRouteResult MarkAsPaid_POST(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsPaid)]
public RedirectToRouteResult MarkAsPaid_POST(Order order)
<<<<<<<
public PartialViewResult MarkAsVoided(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsVoided)]
public PartialViewResult MarkAsVoided(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsVoided)]
public PartialViewResult MarkAsVoided(Order order)
<<<<<<<
public RedirectToRouteResult MarkAsVoided_POST(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsVoided)]
public RedirectToRouteResult MarkAsVoided_POST(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsVoided)]
public RedirectToRouteResult MarkAsVoided_POST(Order order) |
<<<<<<<
using MrCMS.Web.Apps.Ecommerce.Areas.Admin.Services;
using MrCMS.Web.Apps.Ecommerce.Entities.Orders;
=======
using MrCMS.Settings;
using MrCMS.Web.Apps.Ecommerce.ACL;
using MrCMS.Web.Apps.Ecommerce.Helpers;
>>>>>>>
using MrCMS.Web.Apps.Ecommerce.Areas.Admin.Services;
using MrCMS.Web.Apps.Ecommerce.Entities.Orders;
using MrCMS.Web.Apps.Ecommerce.ACL;
<<<<<<<
public ViewResult Index(OrderSearchModel model)
{
ViewData["shipping-status-options"] = _orderAdminService.GetShippingStatusOptions();
ViewData["payment-status-options"] = _orderAdminService.GetPaymentStatusOptions();
ViewData["results"] = _orderAdminService.Search(model);
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.List)]
public ViewResult Index(OrderSearchModel model, int page = 1)
{
ViewData["ShippingStatuses"] = GeneralHelper.GetEnumOptionsWithEmpty<ShippingStatus>();
ViewData["PaymentStatuses"] = GeneralHelper.GetEnumOptionsWithEmpty<PaymentStatus>();
model.Results = new PagedList<Order>(null, 1, _ecommerceSettings.DefaultPageSize);
try
{
model.Results = _orderSearchService.SearchOrders(model, page, _ecommerceSettings.DefaultPageSize);
}
catch (Exception)
{
model.Results = _orderService.GetPaged(page);
}
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.List)]
public ViewResult Index(OrderSearchModel model)
{
ViewData["shipping-status-options"] = _orderAdminService.GetShippingStatusOptions();
ViewData["payment-status-options"] = _orderAdminService.GetPaymentStatusOptions();
ViewData["results"] = _orderAdminService.Search(model);
<<<<<<<
? (ActionResult) View(order)
: RedirectToAction("Index");
=======
? (ActionResult)View(order)
: RedirectToAction("Index");
}
[ActionName("Edit")]
[HttpPost]
[ForceImmediateLuceneUpdate]
[MrCMSACLRule(typeof(OrderACL), OrderACL.Edit)]
public RedirectToRouteResult Edit_POST(Order order, int shippingMethodId = 0)
{
order.User = CurrentRequestData.CurrentUser;
_orderService.Save(order);
return RedirectToAction("Index");
>>>>>>>
? (ActionResult) View(order)
: RedirectToAction("Index");
<<<<<<<
public PartialViewResult MarkAsShipped(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsShipped)]
public PartialViewResult MarkAsShipped(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsShipped)]
public PartialViewResult MarkAsShipped(Order order)
<<<<<<<
public RedirectToRouteResult MarkAsShipped_POST(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsShipped)]
public RedirectToRouteResult MarkAsShipped_POST(Order order,bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsShipped)]
public RedirectToRouteResult MarkAsShipped_POST(Order order)
<<<<<<<
public PartialViewResult MarkAsPaid(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsPaid)]
public PartialViewResult MarkAsPaid(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsPaid)]
public PartialViewResult MarkAsPaid(Order order)
<<<<<<<
public RedirectToRouteResult MarkAsPaid_POST(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsPaid)]
public RedirectToRouteResult MarkAsPaid_POST(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsPaid)]
public RedirectToRouteResult MarkAsPaid_POST(Order order)
<<<<<<<
public PartialViewResult MarkAsVoided(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsVoided)]
public PartialViewResult MarkAsVoided(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsVoided)]
public PartialViewResult MarkAsVoided(Order order)
<<<<<<<
public RedirectToRouteResult MarkAsVoided_POST(Order order)
=======
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsVoided)]
public RedirectToRouteResult MarkAsVoided_POST(Order order, bool index = false)
>>>>>>>
[MrCMSACLRule(typeof(OrderACL), OrderACL.MarkAsVoided)]
public RedirectToRouteResult MarkAsVoided_POST(Order order) |
<<<<<<<
AmazonApiSection.Feeds, null, null, amazonListing, null);
retryCount++;
if (retryCount == 3) break;
=======
AmazonApiSection.Feeds, null,null, amazonListing,null);
>>>>>>>
AmazonApiSection.Feeds, null,null, amazonListing,null);
<<<<<<<
=======
public string SubmitOrderFulfillmentFeed(AmazonSyncModel model, FileStream feedContent)
{
if (feedContent == null) return null;
AmazonProgressBarHelper.Update(model.Task, "Push", "Pushing Order Fulfillment Data", 100, 85);
var feedResponse = _amazonFeedsApiService.SubmitFeed(AmazonFeedType._POST_ORDER_FULFILLMENT_DATA_, feedContent);
AmazonProgressBarHelper.Update(model.Task, "Push", "Order Fulfillment Data Pushed", 100, 100);
return feedResponse.FeedSubmissionId;
}
public void CheckIfOrderFulfillmentFeedWasProcessed(AmazonSyncModel model, AmazonOrder amazonOrder, string submissionId)
{
var uploadSuccess = false;
var retryCount = 0;
while (!uploadSuccess)
{
retryCount++;
if (retryCount == 3)
{
AmazonProgressBarHelper.Update(model.Task, "Error",
"Request timed out. Please check logs for potential errors and try again later.", 100,
100);
break;
}
try
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Checking if request was processed...", 100, 75);
if (_amazonFeedsApiService.GetFeedSubmissionList(submissionId).FeedProcessingStatus == "_DONE_")
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Request was processed", 100, 75);
AmazonProgressBarHelper.Update(model.Task, "Push", "Updating local status of Amazon Order #" + amazonOrder.AmazonOrderId, 100, 75);
_amazonOrderService.MarkAsShipped(amazonOrder);
AmazonProgressBarHelper.Update(model.Task, "Push", "Local Amazon Order data successfully updated", 100, 85);
if (amazonOrder.Order.ShippingStatus == ShippingStatus.Unshipped)
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Updating status of MrCMS Order #" + amazonOrder.Order.Id, 100, 85);
amazonOrder.Order.PaymentMethod=AmazonPaymentMethod.Other.GetDescription();
amazonOrder.Order.PaymentStatus=PaymentStatus.Paid;
_orderService.MarkAsShipped(amazonOrder.Order);
AmazonProgressBarHelper.Update(model.Task, "Push", "Status of MrCMS Order #" + amazonOrder.Order.Id + " successfully updated", 100, 100);
}
uploadSuccess = true;
}
else
{
AmazonProgressBarHelper.Update(model.Task, "Push",
"Nothing yet, we will wait 2 min. more and try again...", 100, 75);
Thread.Sleep(120000);
}
}
catch (Exception ex)
{
CurrentRequestData.ErrorSignal.Raise(ex);
AmazonProgressBarHelper.Update(model.Task, "Push",
"Amazon Api is busy, we will wait additional 2 min. and try again...", 100,
75);
Thread.Sleep(120000);
}
}
}
public void CheckIfOrderFulfillmentFeedWasProcessed(AmazonSyncModel model, List<AmazonOrder> amazonOrders, string submissionId)
{
var uploadSuccess = false;
var retryCount = 0;
while (!uploadSuccess)
{
retryCount++;
if (retryCount == 3)
{
AmazonProgressBarHelper.Update(model.Task, "Error",
"Request timed out. Please check logs for potential errors and try again later.", 100,
100);
break;
}
try
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Checking if request was processed...", 100, 75);
if (_amazonFeedsApiService.GetFeedSubmissionList(submissionId).FeedProcessingStatus == "_DONE_")
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Request was processed", 100, 75);
foreach (var amazonOrder in amazonOrders)
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Updating local status of Amazon Order #" + amazonOrder.AmazonOrderId, 100, 75);
_amazonOrderService.MarkAsShipped(amazonOrder);
}
AmazonProgressBarHelper.Update(model.Task, "Push", "Local Amazon Order data successfully updated", 100, 85);
foreach (var amazonOrder in amazonOrders)
{
if (amazonOrder.Order.ShippingStatus != ShippingStatus.Unshipped) continue;
AmazonProgressBarHelper.Update(model.Task, "Push", "Updating status of MrCMS Order #" + amazonOrder.Order.Id, 100, 85);
amazonOrder.Order.PaymentMethod = AmazonPaymentMethod.Other.GetDescription();
amazonOrder.Order.PaymentStatus = PaymentStatus.Paid;
_orderService.MarkAsShipped(amazonOrder.Order);
AmazonProgressBarHelper.Update(model.Task, "Push", "Status of MrCMS Order #" + amazonOrder.Order.Id + " successfully updated", 100, 100);
}
uploadSuccess = true;
}
else
{
AmazonProgressBarHelper.Update(model.Task, "Push",
"Nothing yet, we will wait 2 min. more and try again...", 100, 75);
Thread.Sleep(120000);
}
}
catch (Exception ex)
{
CurrentRequestData.ErrorSignal.Raise(ex);
AmazonProgressBarHelper.Update(model.Task, "Push",
"Amazon Api is busy, we will wait additional 2 min. and try again...", 100,
75);
Thread.Sleep(120000);
}
}
}
>>>>>>> |
<<<<<<<
_amazonOrderRequestService.SubmitOrderFulfillmentFeed(feed);
=======
var submissionId = _amazonOrderRequestService.SubmitOrderFulfillmentFeed(feed);
foreach (var amazonOrder in shippedOrders)
_amazonOrderService.MarkAsShipped(amazonOrder);
//_amazonOrderRequestService.CheckIfOrderFulfillmentFeedWasProcessed(shippedOrders, submissionId); //ToDO: is this needed?
>>>>>>>
_amazonOrderRequestService.SubmitOrderFulfillmentFeed(feed);
foreach (var amazonOrder in shippedOrders)
_amazonOrderService.MarkAsShipped(amazonOrder);
//_amazonOrderRequestService.CheckIfOrderFulfillmentFeedWasProcessed(shippedOrders, submissionId); //ToDO: is this needed? |
<<<<<<<
using System.Collections.Generic;
using System.Linq;
using MrCMS.Web.Apps.Ecommerce.Entities;
using MrCMS.Web.Apps.Ecommerce.Entities.Cart;
using MrCMS.Web.Apps.Ecommerce.Entities.Shipping;
using MrCMS.Web.Apps.Ecommerce.Entities.Users;
using MrCMS.Web.Apps.Ecommerce.Models;
using MrCMS.Website;
=======
using System.Collections.Generic;
using System.Linq;
using MrCMS.Web.Apps.Ecommerce.Entities;
using MrCMS.Web.Apps.Ecommerce.Entities.Cart;
using MrCMS.Web.Apps.Ecommerce.Entities.Discounts;
using MrCMS.Web.Apps.Ecommerce.Entities.Shipping;
using MrCMS.Web.Apps.Ecommerce.Entities.Users;
using MrCMS.Web.Apps.Ecommerce.Models;
using MrCMS.Website;
>>>>>>>
using System.Collections.Generic;
using System.Linq;
using MrCMS.Web.Apps.Ecommerce.Entities.Cart;
using MrCMS.Web.Apps.Ecommerce.Entities.Discounts;
using MrCMS.Web.Apps.Ecommerce.Entities.Shipping;
using MrCMS.Web.Apps.Ecommerce.Entities.Users;
using MrCMS.Web.Apps.Ecommerce.Models;
using MrCMS.Website;
<<<<<<<
using MrCMS.Entities.Multisite;
namespace MrCMS.Web.Apps.Ecommerce.Services.Cart
{
public class GetCartImpl : IGetCart
{
=======
using MrCMS.Entities.Multisite;
using System;
using NHibernate.Criterion;
namespace MrCMS.Web.Apps.Ecommerce.Services.Cart
{
public class GetCartImpl : IGetCart
{
>>>>>>>
using System;
using NHibernate.Criterion;
namespace MrCMS.Web.Apps.Ecommerce.Services.Cart
{
public class GetCartImpl : IGetCart
{
<<<<<<<
private readonly CurrentSite _currentSite;
public GetCartImpl(ISession session, CurrentSite currentSite)
{
_session = session;
_currentSite = currentSite;
}
public CartModel GetCart()
{
return new CartModel
{
User = CurrentRequestData.CurrentUser,
UserGuid = CurrentRequestData.UserGuid,
Items = GetItems(),
=======
public GetCartImpl(ISession session)
{
_session = session;
}
public CartModel GetCart()
{
var cart=new CartModel
{
User = CurrentRequestData.CurrentUser,
UserGuid = CurrentRequestData.UserGuid,
Items = GetItems(),
>>>>>>>
public GetCartImpl(ISession session)
{
_session = session;
}
public CartModel GetCart()
{
var cart=new CartModel
{
User = CurrentRequestData.CurrentUser,
UserGuid = CurrentRequestData.UserGuid,
Items = GetItems(),
<<<<<<<
BillingAddress = GetBillingAddress(),
ShippingMethod = GetShippingMethod()
};
}
private List<CartItem> GetItems()
{
return
_session.QueryOver<CartItem>()
.Where(item => item.UserGuid == CurrentRequestData.UserGuid)
.Cacheable()
.List().ToList();
}
private Address GetShippingAddress()
{
return CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.shipping-address"] as Address
: null;
=======
BillingAddress = GetBillingAddress(),
ShippingMethod = GetShippingMethod(),
OrderEmail = GetOrderEmail(),
DiscountCode = GetDiscountCode(),
Discount = GetDiscount()
};
return cart;
}
private decimal? GetShippingTotal()
{
if (GetItems().Any())
return 0;
return GetItems().Sum(x => x.Price);
}
private List<CartItem> GetItems()
{
return
_session.QueryOver<CartItem>()
.Where(item => item.UserGuid == CurrentRequestData.UserGuid)
.Cacheable()
.List().ToList();
}
private Discount GetDiscount()
{
if (!String.IsNullOrWhiteSpace(GetDiscountCode()))
return
_session.QueryOver<Discount>()
.Where(item => item.Code.IsInsensitiveLike(GetDiscountCode(), MatchMode.Exact))
.Cacheable()
.SingleOrDefault();
else
return null;
}
public Address GetShippingAddress()
{
return CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.shipping-address"] as Address
: null;
>>>>>>>
BillingAddress = GetBillingAddress(),
ShippingMethod = GetShippingMethod(),
OrderEmail = GetOrderEmail(),
DiscountCode = GetDiscountCode(),
Discount = GetDiscount()
};
return cart;
}
private decimal? GetShippingTotal()
{
if (GetItems().Any())
return 0;
return GetItems().Sum(x => x.Price);
}
private List<CartItem> GetItems()
{
return
_session.QueryOver<CartItem>()
.Where(item => item.UserGuid == CurrentRequestData.UserGuid)
.Cacheable()
.List().ToList();
}
private Discount GetDiscount()
{
if (!String.IsNullOrWhiteSpace(GetDiscountCode()))
return
_session.QueryOver<Discount>()
.Where(item => item.Code.IsInsensitiveLike(GetDiscountCode(), MatchMode.Exact))
.Cacheable()
.SingleOrDefault();
else
return null;
}
public Address GetShippingAddress()
{
return CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.shipping-address"] as Address
: null;
<<<<<<<
}
private ShippingMethod GetShippingMethod()
{
var shippingMethodId = CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.shipping-method-id"] as int?
: null;
return shippingMethodId.HasValue
? _session.Get<ShippingMethod>(shippingMethodId.Value)
: null;
=======
>>>>>>>
<<<<<<<
return null;
}
}
=======
CurrentRequestData.CurrentContext.Session.Add("current.billing-address", address);
}
public ShippingMethod GetShippingMethod()
{
var shippingMethodId = CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.shipping-method-id"] as int?
: null;
return shippingMethodId.HasValue
? _session.Get<ShippingMethod>(shippingMethodId.Value)
: null;
}
public void SetShippingMethod(int shippingMethodId)
{
if (CurrentRequestData.CurrentContext.Session != null && CurrentRequestData.CurrentContext.Session["current.shipping-method-id"] != null)
CurrentRequestData.CurrentContext.Session["current.shipping-method-id"] = shippingMethodId;
else
CurrentRequestData.CurrentContext.Session.Add("current.shipping-method-id", shippingMethodId);
}
public void SetOrderEmail(string value)
{
if (CurrentRequestData.CurrentContext.Session != null && CurrentRequestData.CurrentContext.Session["current.order-email"] != null)
CurrentRequestData.CurrentContext.Session["current.order-email"] = value;
else
CurrentRequestData.CurrentContext.Session.Add("current.order-email", value);
}
public string GetOrderEmail()
{
return CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.order-email"] as string
: String.Empty;
}
public void SetDiscountCode(string value)
{
if (CurrentRequestData.CurrentContext.Session != null && CurrentRequestData.CurrentContext.Session["current.discount-code"] != null)
CurrentRequestData.CurrentContext.Session["current.discount-code"] = value;
else
CurrentRequestData.CurrentContext.Session.Add("current.discount-code", value);
}
public string GetDiscountCode()
{
return CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.discount-code"] as string
: String.Empty;
}
public void SetPaymentMethod(string value)
{
if (CurrentRequestData.CurrentContext.Session != null && CurrentRequestData.CurrentContext.Session["current.payment-method"] != null)
CurrentRequestData.CurrentContext.Session["current.payment-method"] = value;
else
CurrentRequestData.CurrentContext.Session.Add("current.payment-method", value);
}
public string GetPaymentMethod()
{
return CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.payment-method"] as string
: String.Empty;
}
}
>>>>>>>
CurrentRequestData.CurrentContext.Session.Add("current.billing-address", address);
}
public ShippingMethod GetShippingMethod()
{
var shippingMethodId = CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.shipping-method-id"] as int?
: null;
return shippingMethodId.HasValue
? _session.Get<ShippingMethod>(shippingMethodId.Value)
: null;
}
public void SetShippingMethod(int shippingMethodId)
{
if (CurrentRequestData.CurrentContext.Session != null && CurrentRequestData.CurrentContext.Session["current.shipping-method-id"] != null)
CurrentRequestData.CurrentContext.Session["current.shipping-method-id"] = shippingMethodId;
else
CurrentRequestData.CurrentContext.Session.Add("current.shipping-method-id", shippingMethodId);
}
public void SetOrderEmail(string value)
{
if (CurrentRequestData.CurrentContext.Session != null && CurrentRequestData.CurrentContext.Session["current.order-email"] != null)
CurrentRequestData.CurrentContext.Session["current.order-email"] = value;
else
CurrentRequestData.CurrentContext.Session.Add("current.order-email", value);
}
public string GetOrderEmail()
{
return CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.order-email"] as string
: String.Empty;
}
public void SetDiscountCode(string value)
{
if (CurrentRequestData.CurrentContext.Session != null && CurrentRequestData.CurrentContext.Session["current.discount-code"] != null)
CurrentRequestData.CurrentContext.Session["current.discount-code"] = value;
else
CurrentRequestData.CurrentContext.Session.Add("current.discount-code", value);
}
public string GetDiscountCode()
{
return CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.discount-code"] as string
: String.Empty;
}
public void SetPaymentMethod(string value)
{
if (CurrentRequestData.CurrentContext.Session != null && CurrentRequestData.CurrentContext.Session["current.payment-method"] != null)
CurrentRequestData.CurrentContext.Session["current.payment-method"] = value;
else
CurrentRequestData.CurrentContext.Session.Add("current.payment-method", value);
}
public string GetPaymentMethod()
{
return CurrentRequestData.CurrentContext.Session != null
? CurrentRequestData.CurrentContext.Session["current.payment-method"] as string
: String.Empty;
}
} |
<<<<<<<
using MrCMS.Web.Apps.Ecommerce.Entities.Users;
using MrCMS.Web.Apps.Ecommerce.Helpers;
using MrCMS.Web.Apps.Ecommerce.Models;
using MrCMS.Website;
using NHibernate;
=======
>>>>>>>
using MrCMS.Web.Apps.Ecommerce.Entities.Users;
using MrCMS.Website;
<<<<<<<
public interface IOrderShippingService
{
List<SelectListItem> GetShippingOptions(CartModel cart);
List<SelectListItem> GetCheapestShippingOptions(CartModel cart);
ShippingMethod GetDefaultShippingMethod(CartModel cart);
IEnumerable<ShippingCalculation> GetCheapestShippingCalculationsForEveryCountry(CartModel cart);
List<SelectListItem> ExistingAddressOptions(CartModel cartModel, Address address);
}
public class OrderShippingService : IOrderShippingService
{
private readonly ISession _session;
private readonly IUserService _userService;
public OrderShippingService(ISession session, IUserService userService)
{
_session = session;
_userService = userService;
}
public List<SelectListItem> GetShippingOptions(CartModel cart)
{
var shippingCalculations = GetShippingCalculations(cart);
return shippingCalculations.BuildSelectItemList(
calculation =>
string.Format("{0} - {1}, {2}", calculation.Country.Name, calculation.ShippingMethod.Name,
calculation.GetPrice(cart).Value.ToCurrencyFormat()),
calculation => calculation.Id.ToString(),
calculation =>
cart.ShippingMethod != null && calculation.Country == cart.Country &&
calculation.ShippingMethod == cart.ShippingMethod,
emptyItemText: null);
}
private IEnumerable<ShippingCalculation> GetShippingCalculations(CartModel cart)
{
var shippingCalculations =
_session.QueryOver<ShippingCalculation>()
.Fetch(calculation => calculation.ShippingMethod)
.Eager.Cacheable()
.List().Where(x => x.CanBeUsed(cart))
.OrderBy(x => x.Country.DisplayOrder)
.ThenBy(x => x.ShippingMethod.DisplayOrder)
.Where(calculation => calculation.GetPrice(cart).HasValue);
return shippingCalculations;
}
private IEnumerable<ShippingCalculation> GetCheapestShippingCalculationsForEveryCountryAndMethod(CartModel cart)
{
var calculations =
GetShippingCalculations(cart)
.GroupBy(x => x.Country)
.SelectMany(s=>s.GroupBy(sc=>sc.ShippingMethod).Select(sc2=>sc2.OrderBy(sc3=>sc3.GetPrice(cart)).First()))
.ToList();
return calculations;
}
public IEnumerable<ShippingCalculation> GetCheapestShippingCalculationsForEveryCountry(CartModel cart)
{
return GetShippingCalculations(cart).GroupBy(x => x.Country).Select(s => s.OrderBy(calculation => calculation.GetPrice(cart)).First()).ToList();
}
public List<SelectListItem> ExistingAddressOptions(CartModel cartModel, Address address)
{
var addresses = new List<Address>();
addresses.Add(cartModel.ShippingAddress);
addresses.Add(cartModel.BillingAddress);
var currentUser = CurrentRequestData.CurrentUser;
if (currentUser != null)
addresses.AddRange(_userService.GetAll<Address>(currentUser));
addresses = addresses.Distinct().Where(a => !AddressComparison.Comparer.Equals(a, address)).ToList();
return addresses.Any()
? addresses.BuildSelectItemList(a => a.GetDescription(), a => a.ToJSON(),
emptyItemText: "Select an address...")
: new List<SelectListItem>();
}
public List<SelectListItem> GetCheapestShippingOptions(CartModel cart)
{
var shippingCalculations = GetCheapestShippingCalculationsForEveryCountryAndMethod(cart);
return shippingCalculations.BuildSelectItemList(
calculation =>
string.Format("{0} - {1}, {2}", calculation.Country.Name, calculation.ShippingMethod.Name,
calculation.GetPrice(cart).Value.ToCurrencyFormat()),
calculation => calculation.Id.ToString(),
calculation =>
cart.ShippingMethod != null && calculation.Country == cart.Country &&
calculation.ShippingMethod == cart.ShippingMethod,
emptyItemText: null);
}
public ShippingMethod GetDefaultShippingMethod(CartModel cart)
{
var firstOrDefault = GetShippingCalculations(cart).FirstOrDefault();
return firstOrDefault != null ? firstOrDefault.ShippingMethod : null;
}
}
=======
>>>>>>> |
<<<<<<<
AmazonApiSection.Feeds, null, null, amazonListing, null);
retryCount++;
if (retryCount == 3) break;
=======
AmazonApiSection.Feeds, null,null, amazonListing,null);
>>>>>>>
AmazonApiSection.Feeds, null,null, amazonListing,null);
<<<<<<<
=======
public string SubmitOrderFulfillmentFeed(AmazonSyncModel model, FileStream feedContent)
{
if (feedContent == null) return null;
AmazonProgressBarHelper.Update(model.Task, "Push", "Pushing Order Fulfillment Data", 100, 85);
var feedResponse = _amazonFeedsApiService.SubmitFeed(AmazonFeedType._POST_ORDER_FULFILLMENT_DATA_, feedContent);
AmazonProgressBarHelper.Update(model.Task, "Push", "Order Fulfillment Data Pushed", 100, 100);
return feedResponse.FeedSubmissionId;
}
public void CheckIfOrderFulfillmentFeedWasProcessed(AmazonSyncModel model, AmazonOrder amazonOrder, string submissionId)
{
var uploadSuccess = false;
var retryCount = 0;
while (!uploadSuccess)
{
retryCount++;
if (retryCount == 3)
{
AmazonProgressBarHelper.Update(model.Task, "Error",
"Request timed out. Please check logs for potential errors and try again later.", 100,
100);
break;
}
try
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Checking if request was processed...", 100, 75);
if (_amazonFeedsApiService.GetFeedSubmissionList(submissionId).FeedProcessingStatus == "_DONE_")
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Request was processed", 100, 75);
AmazonProgressBarHelper.Update(model.Task, "Push", "Updating local status of Amazon Order #" + amazonOrder.AmazonOrderId, 100, 75);
_amazonOrderService.MarkAsShipped(amazonOrder);
AmazonProgressBarHelper.Update(model.Task, "Push", "Local Amazon Order data successfully updated", 100, 85);
if (amazonOrder.Order.ShippingStatus == ShippingStatus.Unshipped)
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Updating status of MrCMS Order #" + amazonOrder.Order.Id, 100, 85);
amazonOrder.Order.PaymentMethod=AmazonPaymentMethod.Other.GetDescription();
amazonOrder.Order.PaymentStatus=PaymentStatus.Paid;
_orderService.MarkAsShipped(amazonOrder.Order);
AmazonProgressBarHelper.Update(model.Task, "Push", "Status of MrCMS Order #" + amazonOrder.Order.Id + " successfully updated", 100, 100);
}
uploadSuccess = true;
}
else
{
AmazonProgressBarHelper.Update(model.Task, "Push",
"Nothing yet, we will wait 2 min. more and try again...", 100, 75);
Thread.Sleep(120000);
}
}
catch (Exception ex)
{
CurrentRequestData.ErrorSignal.Raise(ex);
AmazonProgressBarHelper.Update(model.Task, "Push",
"Amazon Api is busy, we will wait additional 2 min. and try again...", 100,
75);
Thread.Sleep(120000);
}
}
}
public void CheckIfOrderFulfillmentFeedWasProcessed(AmazonSyncModel model, List<AmazonOrder> amazonOrders, string submissionId)
{
var uploadSuccess = false;
var retryCount = 0;
while (!uploadSuccess)
{
retryCount++;
if (retryCount == 3)
{
AmazonProgressBarHelper.Update(model.Task, "Error",
"Request timed out. Please check logs for potential errors and try again later.", 100,
100);
break;
}
try
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Checking if request was processed...", 100, 75);
if (_amazonFeedsApiService.GetFeedSubmissionList(submissionId).FeedProcessingStatus == "_DONE_")
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Request was processed", 100, 75);
foreach (var amazonOrder in amazonOrders)
{
AmazonProgressBarHelper.Update(model.Task, "Push", "Updating local status of Amazon Order #" + amazonOrder.AmazonOrderId, 100, 75);
_amazonOrderService.MarkAsShipped(amazonOrder);
}
AmazonProgressBarHelper.Update(model.Task, "Push", "Local Amazon Order data successfully updated", 100, 85);
foreach (var amazonOrder in amazonOrders)
{
if (amazonOrder.Order.ShippingStatus != ShippingStatus.Unshipped) continue;
AmazonProgressBarHelper.Update(model.Task, "Push", "Updating status of MrCMS Order #" + amazonOrder.Order.Id, 100, 85);
amazonOrder.Order.PaymentMethod = AmazonPaymentMethod.Other.GetDescription();
amazonOrder.Order.PaymentStatus = PaymentStatus.Paid;
_orderService.MarkAsShipped(amazonOrder.Order);
AmazonProgressBarHelper.Update(model.Task, "Push", "Status of MrCMS Order #" + amazonOrder.Order.Id + " successfully updated", 100, 100);
}
uploadSuccess = true;
}
else
{
AmazonProgressBarHelper.Update(model.Task, "Push",
"Nothing yet, we will wait 2 min. more and try again...", 100, 75);
Thread.Sleep(120000);
}
}
catch (Exception ex)
{
CurrentRequestData.ErrorSignal.Raise(ex);
AmazonProgressBarHelper.Update(model.Task, "Push",
"Amazon Api is busy, we will wait additional 2 min. and try again...", 100,
75);
Thread.Sleep(120000);
}
}
}
>>>>>>> |
<<<<<<<
=======
protected int mapstep;
protected bool mapsaved;
protected double[] mapline;
protected CelestialBody body;
public Texture2D map;
protected float[,,] big_heightmap;
public void setBody ( CelestialBody b ) {
if (body == b)
return;
body = b;
resetMap ();
}
public void setSize ( int w , int h ) {
if (w == 0)
w = 360 * (Screen.width / 360);
if (w > 360 * 4)
w = 360 * 4;
mapwidth = w;
mapscale = mapwidth / 360f;
if (h <= 0)
h = (int)(180 * mapscale);
mapheight = h;
if (map != null) {
if (mapwidth != map.width || mapheight != map.height)
map = null;
}
}
public void setWidth ( int w ) {
if (w == 0) {
w = 360 * (int)(Screen.width / 360);
if (w > 360 * 4)
w = 360 * 4;
}
if (w < 360)
w = 360;
if (mapwidth == w)
return;
mapwidth = w;
mapscale = mapwidth / 360f;
mapheight = (int)(w / 2);
big_heightmap = new float [mapwidth, mapheight, 3];
map = null;
resetMap ();
}
public void heightMapArray (float height, int line, int i)
{
big_heightmap[i, line, SCANcontroller.controller.projection] = height;
}
public void centerAround ( double lon , double lat ) {
lon_offset = 180 + lon - (mapwidth / mapscale) / 2;
lat_offset = 90 + lat - (mapheight / mapscale) / 2;
}
>>>>>>>
protected int mapstep;
protected bool mapsaved;
protected double[] mapline;
protected CelestialBody body;
public Texture2D map;
protected float[,,] big_heightmap;
public void setBody ( CelestialBody b ) {
if (body == b)
return;
body = b;
resetMap ();
}
public void setSize ( int w , int h ) {
if (w == 0)
w = 360 * (Screen.width / 360);
if (w > 360 * 4)
w = 360 * 4;
mapwidth = w;
mapscale = mapwidth / 360f;
if (h <= 0)
h = (int)(180 * mapscale);
mapheight = h;
if (map != null) {
if (mapwidth != map.width || mapheight != map.height)
map = null;
}
}
public void setWidth ( int w ) {
if (w == 0) {
w = 360 * (int)(Screen.width / 360);
if (w > 360 * 4)
w = 360 * 4;
}
if (w < 360)
w = 360;
if (mapwidth == w)
return;
mapwidth = w;
mapscale = mapwidth / 360f;
mapheight = (int)(w / 2);
big_heightmap = new float [mapwidth, mapheight, 3];
map = null;
resetMap ();
}
public void heightMapArray (float height, int line, int i)
{
big_heightmap[i, line, SCANcontroller.controller.projection] = height;
} |
<<<<<<<
var customConsumerGroupName = "cgroup1";
// Generate a new lease container name that will be used through out the test.
string leaseContainerName = Guid.NewGuid().ToString();
var consumerGroupNames = new string[] { PartitionReceiver.DefaultConsumerGroupName, customConsumerGroupName };
=======
var consumerGroupNames = new[] { PartitionReceiver.DefaultConsumerGroupName, "cgroup1"};
>>>>>>>
var customConsumerGroupName = "cgroup1";
// Generate a new lease container name that will be used through out the test.
string leaseContainerName = Guid.NewGuid().ToString();
var consumerGroupNames = new[] { PartitionReceiver.DefaultConsumerGroupName, customConsumerGroupName }; |
<<<<<<<
public Server Server { get; set; }
public string CodeVersion { get; set; }
=======
public Server Server { get; set; }
public string ProxyAddress { get; set; }
>>>>>>>
public Server Server { get; set; }
public string CodeVersion { get; set; }
public string ProxyAddress { get; set; } |
<<<<<<<
using System.Diagnostics;
=======
using System.Collections.Generic;
>>>>>>>
using System.Diagnostics;
using System.Collections.Generic; |
<<<<<<<
=======
public static SyntaxNode GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
{
return token.GetAncestor<SyntaxNode>(predicate);
}
public static T GetAncestor<T>(this SyntaxToken token, Func<T, bool> predicate = null)
where T : SyntaxNode
{
return token.Parent != null
? token.Parent.FirstAncestorOrSelf(predicate)
: default(T);
}
#pragma warning disable CC0026 //todo: related to bug #262, remove pragma when fixed
>>>>>>>
public static SyntaxNode GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
{
return token.GetAncestor<SyntaxNode>(predicate);
}
public static T GetAncestor<T>(this SyntaxToken token, Func<T, bool> predicate = null)
where T : SyntaxNode
{
return token.Parent != null
? token.Parent.FirstAncestorOrSelf(predicate)
: default(T);
} |
<<<<<<<
=======
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Xml;
using numl.Model;
using numl.Utils;
using numl.Features;
using numl.Preprocessing;
>>>>>>>
using numl.Model;
using numl.Utils;
using numl.Features;
using numl.Preprocessing;
<<<<<<<
=======
/// <summary>Converts an object into its XML representation.</summary>
/// <param name="writer">The <see cref="T:System.Xml.XmlWriter" /> stream to which the object is
/// serialized.</param>
public override void WriteXml(XmlWriter writer)
{
writer.WriteAttributeString(nameof(Kernel), Kernel.GetType().Name);
writer.WriteAttributeString(nameof(NormalizeFeatures), this.NormalizeFeatures.ToString());
writer.WriteAttributeString(nameof(FeatureNormalizer), FeatureNormalizer.GetType().Name);
Xml.Write<Descriptor>(writer, Descriptor);
Xml.Write<FeatureProperties>(writer, base.FeatureProperties);
Xml.Write<Vector>(writer, Y, nameof(Y));
Xml.Write<Vector>(writer, A, nameof(A));
Xml.Write<Matrix>(writer, X, nameof(X));
}
/// <summary>Generates an object from its XML representation.</summary>
/// <param name="reader">The <see cref="T:System.Xml.XmlReader" /> stream from which the object is
/// deserialized.</param>
public override void ReadXml(XmlReader reader)
{
reader.MoveToContent();
var type = Ject.FindType(reader.GetAttribute(nameof(Kernel)));
Kernel = (IKernel)Activator.CreateInstance(type);
this.NormalizeFeatures = bool.Parse(reader.GetAttribute(nameof(NormalizeFeatures)));
var normalizer = Ject.FindType(reader.GetAttribute(nameof(FeatureNormalizer)));
base.FeatureNormalizer = (IFeatureNormalizer)Activator.CreateInstance(normalizer);
reader.ReadStartElement();
Descriptor = Xml.Read<Descriptor>(reader);
base.FeatureProperties = Xml.Read<FeatureProperties>(reader, null, false);
Y = Xml.Read<Vector>(reader, nameof(Y));
A = Xml.Read<Vector>(reader, nameof(A));
X = Xml.Read<Matrix>(reader, nameof(X));
}
>>>>>>> |
<<<<<<<
using System.Collections.Concurrent;
=======
using System.Reflection;
using System.Globalization;
using numl.Platform;
>>>>>>>
using System.Collections.Concurrent;
using System.Globalization;
<<<<<<<
t == typeof(int) ||
t == typeof(double) ||
t == typeof(decimal) ||
t == typeof(byte) ||
t == typeof(sbyte) ||
t == typeof(Single) ||
t == typeof(Int16) ||
t == typeof(UInt16) ||
t == typeof(UInt32) ||
t == typeof(Int64) ||
t == typeof(UInt64);
=======
t == typeof(int) || t == typeof(long) || t == typeof(short) ||
t == typeof(double) || t == typeof(float) || t == typeof(decimal) ||
t == typeof(byte) || t == typeof(sbyte) ||
t == typeof(uint) || t == typeof(ulong) || t == typeof(ushort);
>>>>>>>
t == typeof(int) ||
t == typeof(double) ||
t == typeof(decimal) ||
t == typeof(byte) ||
t == typeof(sbyte) ||
t == typeof(Single) ||
t == typeof(Int16) ||
t == typeof(UInt16) ||
t == typeof(UInt32) ||
t == typeof(Int64) ||
t == typeof(UInt64);
<<<<<<<
return (double)Encoding.ASCII.GetBytes(new char[] { (char)o })[0];
else if (o is Enum)
=======
return (double)Encoding.UTF8.GetBytes(new char[] { (char)o })[0];
else if (t.BaseType == typeof(Enum))
>>>>>>>
return (double)Encoding.ASCII.GetBytes(new char[] { (char)o })[0];
else if (o is Enum)
<<<<<<<
return System.Convert.ToDouble(o);
=======
{
try
{
return System.Convert.ToDouble(o);
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Cannot convert {0} to double", o));
}
}
>>>>>>>
{
try
{
return System.Convert.ToDouble(o);
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Cannot convert {0} to double", o));
}
}
<<<<<<<
else if (t.GetTypeInfo().BaseType == typeof(Enum))
return Enum.ToObject(t, System.Convert.ChangeType(val, System.Enum.GetUnderlyingType(t)));
=======
else if (t.BaseType == typeof(Enum))
return Enum.ToObject(t, System.Convert.ChangeType(val, System.Enum.GetUnderlyingType(t), CultureInfo.CurrentCulture));
>>>>>>>
else if (t.GetTypeInfo().BaseType == typeof(Enum))
return Enum.ToObject(t, System.Convert.ChangeType(val, System.Enum.GetUnderlyingType(t)));
<<<<<<<
return System.Convert.ChangeType(val, t);
=======
{
try
{
if (t == typeof(double)) return System.Convert.ToDouble(val, CultureInfo.CurrentCulture);
else if (t == typeof(float)) return System.Convert.ToSingle(val, CultureInfo.CurrentCulture);
else if (t == typeof(int)) return System.Convert.ToInt32(val, CultureInfo.CurrentCulture);
else if (t == typeof(byte)) return System.Convert.ToByte(val, CultureInfo.CurrentCulture);
else if (t == typeof(sbyte)) return System.Convert.ToSByte(val, CultureInfo.CurrentCulture);
else if (t == typeof(short)) return System.Convert.ToInt16(val, CultureInfo.CurrentCulture);
else if (t == typeof(long)) return System.Convert.ToInt64(val, CultureInfo.CurrentCulture);
else if (t == typeof(ushort)) return System.Convert.ToUInt16(val, CultureInfo.CurrentCulture);
else if (t == typeof(uint)) return System.Convert.ToUInt32(val, CultureInfo.CurrentCulture);
else if (t == typeof(ulong)) return System.Convert.ToUInt64(val, CultureInfo.CurrentCulture);
else if (t == typeof(DateTime)) return System.Convert.ToDateTime(val, CultureInfo.CurrentCulture);
else
throw new InvalidCastException();
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Cannot convert {0} to {1}", val, t.Name));
}
}
>>>>>>>
{
try
{
if (t == typeof(double)) return System.Convert.ToDouble(val, CultureInfo.CurrentCulture);
else if (t == typeof(float)) return System.Convert.ToSingle(val, CultureInfo.CurrentCulture);
else if (t == typeof(int)) return System.Convert.ToInt32(val, CultureInfo.CurrentCulture);
else if (t == typeof(byte)) return System.Convert.ToByte(val, CultureInfo.CurrentCulture);
else if (t == typeof(sbyte)) return System.Convert.ToSByte(val, CultureInfo.CurrentCulture);
else if (t == typeof(short)) return System.Convert.ToInt16(val, CultureInfo.CurrentCulture);
else if (t == typeof(long)) return System.Convert.ToInt64(val, CultureInfo.CurrentCulture);
else if (t == typeof(ushort)) return System.Convert.ToUInt16(val, CultureInfo.CurrentCulture);
else if (t == typeof(uint)) return System.Convert.ToUInt32(val, CultureInfo.CurrentCulture);
else if (t == typeof(ulong)) return System.Convert.ToUInt64(val, CultureInfo.CurrentCulture);
else if (t == typeof(DateTime)) return System.Convert.ToDateTime(val, CultureInfo.CurrentCulture);
else
throw new InvalidCastException();
}
catch (InvalidCastException)
{
throw new InvalidCastException(string.Format("Cannot convert {0} to {1}", val, t.Name));
}
}
<<<<<<<
=======
if (type == null) // need to look elsewhere
{
// someones notational laziness causes me to look
// everywhere... sorry... I know it's slow...
// that's why I am caching things...
var q = (from p in Platform.AppDomainWrapper.Instance.GetAssemblies()
from t in p.GetTypesSafe()
where (t.FullName == s || t.Name == s)
select t).ToArray();
if (q.Length == 1)
type = q[0];
}
>>>>>>>
<<<<<<<
=======
/// <summary>The descendants.</summary>
private readonly static Dictionary<Type, Type[]> _descendants = new Dictionary<Type, Type[]>();
/// <summary>Searches for all assignable from.</summary>
/// <param name="type">The type.</param>
/// <returns>The found all assignable from.</returns>
internal static Type[] FindAllAssignableFrom(Type type)
{
if (!_descendants.ContainsKey(type))
{
// find all descendants of given type
_descendants[type] = (from p in Platform.AppDomainWrapper.Instance.GetAssemblies()
from t in p.GetTypesSafe()
where type.IsAssignableFrom(t)
select t).ToArray();
}
return _descendants[type];
}
>>>>>>> |
<<<<<<<
=======
System.Diagnostics.Debug.WriteLine("Starting new sweep!");
>>>>>>> |
<<<<<<<
/// <summary>
/// Executes the compiler.
/// </summary>
/// <returns>True if the build task completes successfully. Otherwise, false.</returns>
=======
public string BaseAddress
{
get;
set;
}
public string LoadOffset
{
get;
set;
}
>>>>>>>
public string BaseAddress
{
get;
set;
}
public string LoadOffset
{
get;
set;
}
/// <summary>
/// Executes the compiler.
/// </summary>
/// <returns>True if the build task completes successfully. Otherwise, false.</returns> |
<<<<<<<
[Required(ErrorMessage = "Debe especificar al menos un requisito."), Display(Name = "Requisitos para aplicar")]
public string RequirementsToApply { get; set; }
[Required(ErrorMessage = "El nombre de la empresa es requerido."), Display(Name = "Ubicación")]
=======
public string Description { get; set; }
>>>>>>>
[Required(ErrorMessage = "Debe especificar al menos un requisito."), Display(Name = "Requisitos para aplicar")]
public string Description { get; set; }
[Required(ErrorMessage = "El nombre de la empresa es requerido."), Display(Name = "Ubicación")] |
<<<<<<<
=======
public StoredEvent()
{
}
>>>>>>> |
<<<<<<<
this.playerTeleported = new AsyncEvent<PlayerTeleportEventArgs>(HandleException, "PlayerTeleported");
=======
this.serverStatusRequest = new AsyncEvent<ServerStatusRequestEventArgs>(HandleException, "ServerStatusRequest");
>>>>>>>
this.playerTeleported = new AsyncEvent<PlayerTeleportEventArgs>(HandleException, "PlayerTeleported");
this.serverStatusRequest = new AsyncEvent<ServerStatusRequestEventArgs>(HandleException, "ServerStatusRequest"); |
<<<<<<<
using Obsidian.Entities;
using Obsidian.Serialization.Attributes;
=======
using Obsidian.API;
using Obsidian.Entities;
using Obsidian.Net.Packets.Play.Clientbound;
using Obsidian.Serializer.Attributes;
>>>>>>>
using Obsidian.API;
using Obsidian.Entities;
using Obsidian.Serialization.Attributes;
using Obsidian.Net.Packets.Play.Clientbound;
<<<<<<<
public Task HandleAsync(Server server, Player player) => Task.CompletedTask;
=======
public async Task HandleAsync(Obsidian.Server server, Player player)
{
if (this.WindowId == 0)
return;
var loc = player.OpenedInventory.BlockPosition;
var block = server.World.GetBlock(loc);
if (block.Type == Materials.Chest)
{
await player.client.QueuePacketAsync(new BlockAction
{
Location = loc,
ActionId = 1,
ActionParam = 0,
BlockType = block.Id
});
await player.SendSoundAsync(Sounds.BlockChestClose, loc.SoundPosition);
}
else if (block.Type == Materials.EnderChest)
{
await player.client.QueuePacketAsync(new BlockAction
{
Location = loc,
ActionId = 1,
ActionParam = 0,
BlockType = block.Id
});
await player.SendSoundAsync(Sounds.BlockEnderChestClose, loc.SoundPosition);
}
player.OpenedInventory = null;
}
>>>>>>>
public async Task HandleAsync(Server server, Player player)
{
if (this.WindowId == 0)
return;
var loc = player.OpenedInventory.BlockPosition;
var block = server.World.GetBlock(loc);
if (block.Type == Materials.Chest)
{
await player.client.QueuePacketAsync(new BlockAction
{
Location = loc,
ActionId = 1,
ActionParam = 0,
BlockType = block.Id
});
await player.SendSoundAsync(Sounds.BlockChestClose, loc.SoundPosition);
}
else if (block.Type == Materials.EnderChest)
{
await player.client.QueuePacketAsync(new BlockAction
{
Location = loc,
ActionId = 1,
ActionParam = 0,
BlockType = block.Id
});
await player.SendSoundAsync(Sounds.BlockEnderChestClose, loc.SoundPosition);
}
player.OpenedInventory = null;
} |
<<<<<<<
using (var dataStream = new MinecraftStream())
{
stream.semaphore.WaitOne();
await ComposeAsync(dataStream);
=======
using var dataStream = new MinecraftStream();
await ComposeAsync(dataStream);
>>>>>>>
stream.semaphore.WaitOne();
using var dataStream = new MinecraftStream();
await ComposeAsync(dataStream);
<<<<<<<
dataStream.Position = 0;
await dataStream.CopyToAsync(stream);
stream.semaphore.Release();
}
=======
dataStream.Position = 0;
await dataStream.CopyToAsync(stream);
>>>>>>>
dataStream.Position = 0;
await dataStream.CopyToAsync(stream);
stream.semaphore.Release(); |
<<<<<<<
(int playerChunkX, int playerChunkZ) = c.Player.Position.ToChunkCoord();
(int lastPlayerChunkX, int lastPlayerChunkZ) = c.Player.LastPosition.ToChunkCoord();
=======
(int playerChunkX, int playerChunkZ) = c.Player.Location.ToChunkCoord();
(int lastPlayerChunkX, int lastPlayerChunkZ) = c.Player.LastLocation.ToChunkCoord();
>>>>>>>
(int playerChunkX, int playerChunkZ) = c.Player.Position.ToChunkCoord();
(int lastPlayerChunkX, int lastPlayerChunkZ) = c.Player.LastPosition.ToChunkCoord();
<<<<<<<
long value = Helpers.IntsToLong(chunkX >> Region.cubiceRegionSizeShift, chunkZ >> Region.cubiceRegionSizeShift);
=======
long value = Helpers.IntsToLong(chunkX >> Region.CUBIC_REGION_SIZE_SHIFT, chunkZ >> Region.CUBIC_REGION_SIZE_SHIFT);
>>>>>>>
long value = Helpers.IntsToLong(chunkX >> Region.cubiceRegionSizeShift, chunkZ >> Region.cubiceRegionSizeShift);
<<<<<<<
public Region GetRegion(PositionF location)
=======
public Region GetRegionForChunk(Position location)
>>>>>>>
public Region GetRegionForChunk(Position location)
<<<<<<<
var index = (Helpers.Modulo(chunkX, Region.cubicRegionSize), Helpers.Modulo(chunkZ, Region.cubicRegionSize));
var chunk = region.LoadedChunks[index.Item1, index.Item2];
if (chunk is null)
=======
// region hasn't been loaded yet
if (region is null)
>>>>>>>
// region hasn't been loaded yet
if (region is null)
<<<<<<<
public Chunk GetChunk(Position worldLocation) => this.GetChunk(worldLocation.X.ToChunkCoord(), worldLocation.Z.ToChunkCoord());
public Block GetBlock(Position location) => GetBlock(location.X, location.Y, location.Z);
=======
/// <summary>
/// Gets a Chunk from a Region.
/// If the Chunk doesn't exist, it will be scheduled for generation.
/// </summary>
/// <param name="worldLocation">World location of the chunk.</param>
/// <returns>Null if the region or chunk doesn't exist yet. Otherwise the chunk.</returns>
public Chunk GetChunk(Position worldLocation) => this.GetChunk((int)worldLocation.X.ToChunkCoord(), (int)worldLocation.Z.ToChunkCoord());
>>>>>>>
/// <summary>
/// Gets a Chunk from a Region.
/// If the Chunk doesn't exist, it will be scheduled for generation.
/// </summary>
/// <param name="worldLocation">World location of the chunk.</param>
/// <returns>Null if the region or chunk doesn't exist yet. Otherwise the chunk.</returns>
public Chunk GetChunk(Position worldLocation) => this.GetChunk(worldLocation.X.ToChunkCoord(), worldLocation.Z.ToChunkCoord());
public Block GetBlock(Position location) => GetBlock(location.X, location.Y, location.Z);
<<<<<<<
int regionX = chunkX >> Region.cubiceRegionSizeShift, regionZ = chunkZ >> Region.cubiceRegionSizeShift;
return GenerateRegion(regionX, regionZ);
=======
int regionX = chunkX >> Region.CUBIC_REGION_SIZE_SHIFT, regionZ = chunkZ >> Region.CUBIC_REGION_SIZE_SHIFT;
return LoadRegion(regionX, regionZ);
>>>>>>>
int regionX = chunkX >> Region.CUBIC_REGION_SIZE_SHIFT, regionZ = chunkZ >> Region.CUBIC_REGION_SIZE_SHIFT;
return LoadRegion(regionX, regionZ);
<<<<<<<
var c = Generator.GenerateChunk(loc.X, loc.Z);
chunks.Add(c);
=======
if (ChunksToGen.TryDequeue(out var job))
jobs.Add(job);
}
Parallel.ForEach(jobs, (job) =>
{
Region region = GetRegionForChunk(job.Item1, job.Item2);
if (region is null)
{
// Region isn't ready. Try again later
ChunksToGen.Enqueue((job.Item1, job.Item2));
return;
}
Chunk c = Generator.GenerateChunk(job.Item1, job.Item2);
var index = (Helpers.Modulo(c.X, Region.CUBIC_REGION_SIZE), Helpers.Modulo(c.Z, Region.CUBIC_REGION_SIZE));
region.LoadedChunks[index.Item1, index.Item2] = c;
>>>>>>>
if (ChunksToGen.TryDequeue(out var job))
jobs.Add(job);
}
Parallel.ForEach(jobs, (job) =>
{
Region region = GetRegionForChunk(job.Item1, job.Item2);
if (region is null)
{
// Region isn't ready. Try again later
ChunksToGen.Enqueue((job.Item1, job.Item2));
return;
}
Chunk c = Generator.GenerateChunk(job.Item1, job.Item2);
var index = (Helpers.Modulo(c.X, Region.CUBIC_REGION_SIZE), Helpers.Modulo(c.Z, Region.CUBIC_REGION_SIZE));
region.LoadedChunks[index.Item1, index.Item2] = c; |
<<<<<<<
// Send commands
// await this.SendDeclareCommandsAsync();
=======
>>>>>>> |
<<<<<<<
semaphore = new Semaphore(1, 1);
=======
var oldStream = this.BaseStream;
this.BaseStream = new CipherStream(oldStream, DecryptCipher, EncryptCipher);
>>>>>>>
semaphore = new Semaphore(1, 1);
var oldStream = this.BaseStream;
this.BaseStream = new CipherStream(oldStream, DecryptCipher, EncryptCipher);
<<<<<<<
semaphore = new Semaphore(1, 1);
=======
var oldStream = this.BaseStream;
this.BaseStream = new CipherStream(oldStream, DecryptCipher, EncryptCipher);
>>>>>>>
semaphore = new Semaphore(1, 1);
var oldStream = this.BaseStream;
this.BaseStream = new CipherStream(oldStream, DecryptCipher, EncryptCipher);
<<<<<<<
semaphore = new Semaphore(1, 1);
=======
var oldStream = this.BaseStream;
this.BaseStream = new CipherStream(oldStream, DecryptCipher, EncryptCipher);
>>>>>>>
semaphore = new Semaphore(1, 1);
var oldStream = this.BaseStream;
this.BaseStream = new CipherStream(oldStream, DecryptCipher, EncryptCipher); |
<<<<<<<
[JsonProperty("logLevel")]
#if DEBUG
public LogLevel LogLevel = LogLevel.Debug;
#else
public LogLevel LogLevel = LogLevel.Error;
#endif
=======
[JsonProperty("debugMode")]
public bool DebugMode = false;
>>>>>>>
[JsonProperty("logLevel")]
#if DEBUG
public LogLevel LogLevel = LogLevel.Debug;
#else
public LogLevel LogLevel = LogLevel.Error;
#endif
[JsonProperty("debugMode")]
public bool DebugMode = false; |
<<<<<<<
using Obsidian.API.Plugins.Services.Common;
using System.IO;
=======
using System;
using System.IO;
>>>>>>>
using Obsidian.API.Plugins.Services.Common;
using System;
using System.IO; |
<<<<<<<
await stream.WriteEntityMetdata(13, EntityMetadataType.OptPosition, this.BedBlockPosition, this.BedBlockPosition != default);
}
public override void Write(MinecraftStream stream)
{
base.Write(stream);
stream.WriteEntityMetadataType(7, EntityMetadataType.Byte);
stream.WriteByte((byte)LivingBitMask);
stream.WriteEntityMetadataType(8, EntityMetadataType.Float);
stream.WriteFloat(Health);
stream.WriteEntityMetadataType(9, EntityMetadataType.VarInt);
stream.WriteVarInt((int)ActiveEffectColor);
stream.WriteEntityMetadataType(10, EntityMetadataType.Boolean);
stream.WriteBoolean(AmbientPotionEffect);
stream.WriteEntityMetadataType(11, EntityMetadataType.VarInt);
stream.WriteVarInt(AbsorbedArrows);
stream.WriteEntityMetadataType(12, EntityMetadataType.VarInt);
stream.WriteVarInt(AbsorbtionAmount);
stream.WriteEntityMetadataType(13, EntityMetadataType.OptPosition);
stream.WriteBoolean(BedBlockPosition != default);
if (BedBlockPosition != default)
stream.WritePositionF(BedBlockPosition);
=======
await stream.WriteEntityMetdata(13, EntityMetadataType.OptPosition, this.BedBlockPosition, this.BedBlockPosition != Position.Zero);
>>>>>>>
await stream.WriteEntityMetdata(13, EntityMetadataType.OptPosition, this.BedBlockPosition, this.BedBlockPosition != Position.Zero);
}
public override void Write(MinecraftStream stream)
{
base.Write(stream);
stream.WriteEntityMetadataType(7, EntityMetadataType.Byte);
stream.WriteByte((byte)LivingBitMask);
stream.WriteEntityMetadataType(8, EntityMetadataType.Float);
stream.WriteFloat(Health);
stream.WriteEntityMetadataType(9, EntityMetadataType.VarInt);
stream.WriteVarInt((int)ActiveEffectColor);
stream.WriteEntityMetadataType(10, EntityMetadataType.Boolean);
stream.WriteBoolean(AmbientPotionEffect);
stream.WriteEntityMetadataType(11, EntityMetadataType.VarInt);
stream.WriteVarInt(AbsorbedArrows);
stream.WriteEntityMetadataType(12, EntityMetadataType.VarInt);
stream.WriteVarInt(AbsorbtionAmount);
stream.WriteEntityMetadataType(13, EntityMetadataType.OptPosition);
stream.WriteBoolean(BedBlockPosition != default);
if (BedBlockPosition != default)
stream.WritePositionF(BedBlockPosition); |
<<<<<<<
public string Path => System.IO.Path.GetFullPath($"Server{Id}");
=======
public CommandService Commands { get; }
public Config Config { get; }
public AsyncLogger Logger { get; }
public int Id { get; private set; }
public string Version { get; }
public int Port { get; }
public int TotalTicks { get; private set; }
public World.World world;
public string Path => System.IO.Path.GetFullPath(Id.ToString());
>>>>>>>
public string Path => System.IO.Path.GetFullPath($"Server{Id}");
public CommandService Commands { get; }
public Config Config { get; }
public AsyncLogger Logger { get; }
public int Id { get; private set; }
public string Version { get; }
public int Port { get; }
public int TotalTicks { get; private set; }
public World.World world; |
<<<<<<<
using ContosoMoments.ViewModels;
using Microsoft.WindowsAzure.MobileServices.Files;
using Microsoft.WindowsAzure.MobileServices.Files.Sync;
using PCLStorage;
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace ContosoMoments.Views
{
public partial class ImageDetailsView : ContentPage
{
public ImageDetailsView()
{
InitializeComponent();
var tapLikeImage = new TapGestureRecognizer();
tapLikeImage.Tapped += OnLike;
imgLike.GestureRecognizers.Add(tapLikeImage);
}
public async void OnLike(object sender, EventArgs e)
{
ImageDetailsViewModel vm = this.BindingContext as ImageDetailsViewModel;
try {
await vm.LikeImageAsync();
await DisplayAlert("Like sent!", "Like was sent to the image author", "OK");
}
catch (Exception) {
await DisplayAlert("Error", "'Like' functionality is not available at the moment. Please try again later", "OK");
}
}
public async void OnOpenImage(object sender, EventArgs args)
{
var button = (Button)sender;
string imageSize = button.CommandParameter.ToString();
var vm = this.BindingContext as ImageDetailsViewModel;
IFileSyncContext context = App.MobileService.GetFileSyncContext();
var recordFiles = await context.MobileServiceFilesClient.GetFilesAsync(App.Instance.imageTableSync.TableName, vm.Image.Id);
var file = recordFiles.First(f => f.StoreUri.Contains(imageSize));
if (file != null) {
await DownloadAndDisplayImage(file, imageSize);
}
}
private async Task DownloadAndDisplayImage(MobileServiceFile file, string imageSize)
{
try {
var path = await FileHelper.GetLocalFilePathAsync(file.ParentId, imageSize + "-" + file.Name, App.Instance.DataFilesPath);
await App.Instance.imageTableSync.DownloadFileAsync(file, path);
await Navigation.PushAsync(CreateDetailsPage(path));
// delete the file
var fileRef = await FileSystem.Current.LocalStorage.GetFileAsync(path);
await fileRef.DeleteAsync();
}
catch (Exception e) {
// Note: we should be catching a WrappedStorageException and StorageException here, but WrappedStorageException is
// internal in the current version of the Azure Storage library
Debug.WriteLine("Exception downloading file: " + e.Message);
await DisplayAlert("Error downloading image", "Error downloading, image size might not be available yet", "OK");
}
}
private static MobileServiceFile GetFileReference(Models.Image image, string param)
{
var toDownload = new MobileServiceFile(image.File.Id, image.File.Name, image.File.TableName, image.File.ParentId) {
StoreUri = image.File.StoreUri.Replace("lg", param)
};
return toDownload;
}
private static ContentPage CreateDetailsPage(string uri)
{
var imagePage = new ContentPage {
Content = new StackLayout() {
VerticalOptions = LayoutOptions.Center,
Children = {
new Xamarin.Forms.Image {
Aspect = Aspect.AspectFill,
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
Source = ImageSource.FromFile(uri)
}
}
}
};
return imagePage;
}
}
}
=======
using ContosoMoments.ViewModels;
using System;
using System.Linq;
using System.Threading.Tasks;
using Xamarin.Forms;
using Microsoft.WindowsAzure.MobileServices.Files;
using Microsoft.WindowsAzure.MobileServices.Files.Sync;
using PCLStorage;
using System.Diagnostics;
using Microsoft.WindowsAzure.Storage;
namespace ContosoMoments.Views
{
public partial class ImageDetailsView : ContentPage
{
public ImageDetailsView()
{
InitializeComponent();
var tapLikeImage = new TapGestureRecognizer();
tapLikeImage.Tapped += OnLike;
imgLike.GestureRecognizers.Add(tapLikeImage);
var tapSettingsImage = new TapGestureRecognizer();
tapSettingsImage.Tapped += OnSettings;
imgSettings.GestureRecognizers.Add(tapSettingsImage);
}
public async void OnLike(object sender, EventArgs e)
{
ImageDetailsViewModel vm = this.BindingContext as ImageDetailsViewModel;
try {
await vm.LikeImageAsync();
await DisplayAlert("Like sent!", "Like was sent to the image author", "OK");
}
catch (Exception) {
await DisplayAlert("Error", "'Like' functionality is not available at the moment. Please try again later", "OK");
}
}
public async void OnSettings(object sender, EventArgs e)
{
ImageDetailsViewModel vm = this.BindingContext as ImageDetailsViewModel;
await Navigation.PushModalAsync(new SettingsView(App.Current as App));
}
public async void OnOpenImage(object sender, EventArgs args)
{
var button = (Button)sender;
string imageSize = button.CommandParameter.ToString();
var vm = this.BindingContext as ImageDetailsViewModel;
IFileSyncContext context = App.Instance.MobileService.GetFileSyncContext();
var recordFiles = await context.MobileServiceFilesClient.GetFilesAsync(App.Instance.imageTableSync.TableName, vm.Image.Id);
var file = recordFiles.First(f => f.StoreUri.Contains(imageSize));
if (file != null) {
await DownloadAndDisplayImage(file, imageSize);
}
}
private async Task DownloadAndDisplayImage(MobileServiceFile file, string imageSize)
{
try {
var path = await FileHelper.GetLocalFilePathAsync(file.ParentId, imageSize + "-" + file.Name, App.Instance.DataFilesPath);
await App.Instance.imageTableSync.DownloadFileAsync(file, path);
await Navigation.PushAsync(CreateDetailsPage(path));
// delete the file
var fileRef = await FileSystem.Current.LocalStorage.GetFileAsync(path);
await fileRef.DeleteAsync();
}
catch (Exception e) {
// Note: we should be catching a WrappedStorageException and StorageException here, but WrappedStorageException is
// internal in the current version of the Azure Storage library
Debug.WriteLine("Exception downloading file: " + e.Message);
await DisplayAlert("Error downloading image", "Error downloading, image size might not be available yet", "OK");
}
}
private static MobileServiceFile GetFileReference(Models.Image image, string param)
{
var toDownload = new MobileServiceFile(image.File.Id, image.File.Name, image.File.TableName, image.File.ParentId) {
StoreUri = image.File.StoreUri.Replace("lg", param)
};
return toDownload;
}
private static ContentPage CreateDetailsPage(string uri)
{
var imagePage = new ContentPage {
Content = new StackLayout() {
VerticalOptions = LayoutOptions.Center,
Children = {
new Xamarin.Forms.Image {
Aspect = Aspect.AspectFill,
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
Source = ImageSource.FromFile(uri)
}
}
}
};
return imagePage;
}
}
}
>>>>>>>
using ContosoMoments.ViewModels;
using Microsoft.WindowsAzure.MobileServices.Files;
using Microsoft.WindowsAzure.MobileServices.Files.Sync;
using PCLStorage;
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace ContosoMoments.Views
{
public partial class ImageDetailsView : ContentPage
{
public ImageDetailsView()
{
InitializeComponent();
var tapLikeImage = new TapGestureRecognizer();
tapLikeImage.Tapped += OnLike;
imgLike.GestureRecognizers.Add(tapLikeImage);
var tapSettingsImage = new TapGestureRecognizer();
tapSettingsImage.Tapped += OnSettings;
imgSettings.GestureRecognizers.Add(tapSettingsImage);
}
public async void OnLike(object sender, EventArgs e)
{
ImageDetailsViewModel vm = this.BindingContext as ImageDetailsViewModel;
try {
await vm.LikeImageAsync();
await DisplayAlert("Like sent!", "Like was sent to the image author", "OK");
}
catch (Exception) {
await DisplayAlert("Error", "'Like' functionality is not available at the moment. Please try again later", "OK");
}
}
public async void OnSettings(object sender, EventArgs e)
{
ImageDetailsViewModel vm = this.BindingContext as ImageDetailsViewModel;
await Navigation.PushModalAsync(new SettingsView(App.Current as App));
}
public async void OnOpenImage(object sender, EventArgs args)
{
var button = (Button)sender;
string imageSize = button.CommandParameter.ToString();
var vm = this.BindingContext as ImageDetailsViewModel;
IFileSyncContext context = App.Instance.MobileService.GetFileSyncContext();
var recordFiles = await context.MobileServiceFilesClient.GetFilesAsync(App.Instance.imageTableSync.TableName, vm.Image.Id);
var file = recordFiles.First(f => f.StoreUri.Contains(imageSize));
if (file != null) {
await DownloadAndDisplayImage(file, imageSize);
}
}
private async Task DownloadAndDisplayImage(MobileServiceFile file, string imageSize)
{
try {
var path = await FileHelper.GetLocalFilePathAsync(file.ParentId, imageSize + "-" + file.Name, App.Instance.DataFilesPath);
await App.Instance.imageTableSync.DownloadFileAsync(file, path);
await Navigation.PushAsync(CreateDetailsPage(path));
// delete the file
var fileRef = await FileSystem.Current.LocalStorage.GetFileAsync(path);
await fileRef.DeleteAsync();
}
catch (Exception e) {
// Note: we should be catching a WrappedStorageException and StorageException here, but WrappedStorageException is
// internal in the current version of the Azure Storage library
Debug.WriteLine("Exception downloading file: " + e.Message);
await DisplayAlert("Error downloading image", "Error downloading, image size might not be available yet", "OK");
}
}
private static MobileServiceFile GetFileReference(Models.Image image, string param)
{
var toDownload = new MobileServiceFile(image.File.Id, image.File.Name, image.File.TableName, image.File.ParentId) {
StoreUri = image.File.StoreUri.Replace("lg", param)
};
return toDownload;
}
private static ContentPage CreateDetailsPage(string uri)
{
var imagePage = new ContentPage {
Content = new StackLayout() {
VerticalOptions = LayoutOptions.Center,
Children = {
new Xamarin.Forms.Image {
Aspect = Aspect.AspectFill,
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
Source = ImageSource.FromFile(uri)
}
}
}
};
return imagePage;
}
}
} |
<<<<<<<
using Foundation;
using Microsoft.WindowsAzure.MobileServices;
using Newtonsoft.Json.Linq;
using System;
using System.Threading.Tasks;
using UIKit;
namespace ContosoMoments.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public static NSData DeviceToken { get; private set; }
public static bool IsAfterLogin = false;
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
app.StatusBarHidden = true;
global::Xamarin.Forms.Forms.Init();
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
SQLitePCL.CurrentPlatform.Init();
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
{
var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Sound |
UIUserNotificationType.Alert |
UIUserNotificationType.Badge, null);
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
UIApplication.SharedApplication.RegisterForRemoteNotifications();
}
else
{
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Badge |
UIRemoteNotificationType.Sound |
UIRemoteNotificationType.Alert);
}
var formsApp = new ContosoMoments.App();
LoadApplication(formsApp);
return base.FinishedLaunching(app, options);
}
public static async Task RegisterWithMobilePushNotifications()
{
if (null != DeviceToken && IsAfterLogin)
{
// Register for push with Mobile Services
//IEnumerable<string> tag = new List<string>() { "uniqueTag" };
const string templateBodyAPNS = "{\"aps\":{\"alert\":\"$(messageParam)\"}}";
//JObject templateBody = new JObject();
//templateBody["body"] = notificationTemplate;
//JObject templates = new JObject();
//templates["ContosoMomentsApnsTemplate"] = templateBody;
JObject templates = new JObject();
templates["genericMessage"] = new JObject
{
{"body", templateBodyAPNS}
};
//var expiryDate = DateTime.Now.AddDays(90).ToString
// (System.Globalization.CultureInfo.CreateSpecificCulture("en-US"));
// Get Mobile Services client
MobileServiceClient client = App.MobileService;
var push = client.GetPush();
try
{
await push.RegisterAsync(DeviceToken, templates);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("RegisterWithMobilePushNotifications: " + ex.Message);
}
}
}
public override async void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
DeviceToken = deviceToken;
if (IsAfterLogin)
await RegisterWithMobilePushNotifications();
}
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
{
NSObject inAppMessage;
bool success = userInfo.TryGetValue(new NSString("inAppMessage"), out inAppMessage);
if (success)
{
var alert = new UIAlertView("Got push notification", inAppMessage.ToString(), null, "OK", null);
alert.Show();
}
}
}
}
=======
using System;
using Foundation;
using UIKit;
using Microsoft.WindowsAzure.MobileServices;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
namespace ContosoMoments.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public static NSData DeviceToken { get; private set; }
public static bool IsAfterLogin = false;
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
app.StatusBarHidden = true;
global::Xamarin.Forms.Forms.Init();
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
SQLitePCL.CurrentPlatform.Init();
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
{
var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Sound |
UIUserNotificationType.Alert |
UIUserNotificationType.Badge, null);
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
UIApplication.SharedApplication.RegisterForRemoteNotifications();
}
else
{
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Badge |
UIRemoteNotificationType.Sound |
UIRemoteNotificationType.Alert);
}
var formsApp = new ContosoMoments.App();
LoadApplication(formsApp);
return base.FinishedLaunching(app, options);
}
public static async Task RegisterWithMobilePushNotifications()
{
if (null != DeviceToken && IsAfterLogin)
{
// Register for push with Mobile Services
//IEnumerable<string> tag = new List<string>() { "uniqueTag" };
const string templateBodyAPNS = "{\"aps\":{\"alert\":\"$(messageParam)\"}}";
//JObject templateBody = new JObject();
//templateBody["body"] = notificationTemplate;
//JObject templates = new JObject();
//templates["ContosoMomentsApnsTemplate"] = templateBody;
JObject templates = new JObject();
templates["genericMessage"] = new JObject
{
{"body", templateBodyAPNS}
};
//var expiryDate = DateTime.Now.AddDays(90).ToString
// (System.Globalization.CultureInfo.CreateSpecificCulture("en-US"));
// Get Mobile Services client
MobileServiceClient client = App.Instance.MobileService;
var push = client.GetPush();
try
{
await push.RegisterAsync(DeviceToken, templates);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("RegisterWithMobilePushNotifications: " + ex.Message);
}
}
}
public override async void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
DeviceToken = deviceToken;
if (IsAfterLogin)
await RegisterWithMobilePushNotifications();
}
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
{
NSObject inAppMessage;
bool success = userInfo.TryGetValue(new NSString("inAppMessage"), out inAppMessage);
if (success)
{
var alert = new UIAlertView("Got push notification", inAppMessage.ToString(), null, "OK", null);
alert.Show();
}
}
}
}
>>>>>>>
using Foundation;
using Microsoft.WindowsAzure.MobileServices;
using Newtonsoft.Json.Linq;
using System;
using System.Threading.Tasks;
using UIKit;
namespace ContosoMoments.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public static NSData DeviceToken { get; private set; }
public static bool IsAfterLogin = false;
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
app.StatusBarHidden = true;
global::Xamarin.Forms.Forms.Init();
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
SQLitePCL.CurrentPlatform.Init();
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
{
var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Sound |
UIUserNotificationType.Alert |
UIUserNotificationType.Badge, null);
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
UIApplication.SharedApplication.RegisterForRemoteNotifications();
}
else
{
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Badge |
UIRemoteNotificationType.Sound |
UIRemoteNotificationType.Alert);
}
var formsApp = new ContosoMoments.App();
LoadApplication(formsApp);
return base.FinishedLaunching(app, options);
}
public static async Task RegisterWithMobilePushNotifications()
{
if (null != DeviceToken && IsAfterLogin)
{
// Register for push with Mobile Services
//IEnumerable<string> tag = new List<string>() { "uniqueTag" };
const string templateBodyAPNS = "{\"aps\":{\"alert\":\"$(messageParam)\"}}";
//JObject templateBody = new JObject();
//templateBody["body"] = notificationTemplate;
//JObject templates = new JObject();
//templates["ContosoMomentsApnsTemplate"] = templateBody;
JObject templates = new JObject();
templates["genericMessage"] = new JObject
{
{"body", templateBodyAPNS}
};
//var expiryDate = DateTime.Now.AddDays(90).ToString
// (System.Globalization.CultureInfo.CreateSpecificCulture("en-US"));
// Get Mobile Services client
MobileServiceClient client = App.Instance.MobileService;
var push = client.GetPush();
try
{
await push.RegisterAsync(DeviceToken, templates);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("RegisterWithMobilePushNotifications: " + ex.Message);
}
}
}
public override async void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
DeviceToken = deviceToken;
if (IsAfterLogin)
await RegisterWithMobilePushNotifications();
}
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
{
NSObject inAppMessage;
bool success = userInfo.TryGetValue(new NSString("inAppMessage"), out inAppMessage);
if (success)
{
var alert = new UIAlertView("Got push notification", inAppMessage.ToString(), null, "OK", null);
alert.Show();
}
}
}
} |
<<<<<<<
=======
[EnableCors(origins: "*", headers: "*", methods: "*")]
[Authorize]
>>>>>>>
[Authorize]
<<<<<<<
=======
[EnableCors(origins: "*", headers: "*", methods: "*")]
[Authorize]
>>>>>>>
[Authorize]
<<<<<<<
=======
[EnableCors(origins: "*", headers: "*", methods: "*")]
[Authorize]
>>>>>>>
[Authorize] |
<<<<<<<
using Microsoft.WindowsAzure.MobileServices.Files;
using Microsoft.WindowsAzure.MobileServices.Files.Metadata;
using Microsoft.WindowsAzure.MobileServices.Sync;
using System.Threading.Tasks;
namespace ContosoMoments
{
public interface IPlatform
{
Task<string> GetDataFilesPath();
Task<IMobileServiceFileDataSource> GetFileDataSource(MobileServiceFileMetadata metadata);
Task DownloadFileAsync<T>(IMobileServiceSyncTable<T> table, MobileServiceFile file, string fullPath);
string GetDataPathAsync();
Task<string> TakePhotoAsync(object context);
}
}
=======
using System;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.MobileServices.Files;
using Microsoft.WindowsAzure.MobileServices.Files.Metadata;
using Microsoft.WindowsAzure.MobileServices.Sync;
namespace ContosoMoments
{
public interface IPlatform
{
Task<string> GetDataFilesPath();
Task<IMobileServiceFileDataSource> GetFileDataSource(MobileServiceFileMetadata metadata);
Task DownloadFileAsync<T>(IMobileServiceSyncTable<T> table, MobileServiceFile file, string fullPath);
string GetRootDataPath();
Task<string> TakePhotoAsync(object context);
}
}
>>>>>>>
using Microsoft.WindowsAzure.MobileServices.Files;
using Microsoft.WindowsAzure.MobileServices.Files.Metadata;
using Microsoft.WindowsAzure.MobileServices.Sync;
using System.Threading.Tasks;
namespace ContosoMoments
{
public interface IPlatform
{
Task<string> GetDataFilesPath();
Task<IMobileServiceFileDataSource> GetFileDataSource(MobileServiceFileMetadata metadata);
Task DownloadFileAsync<T>(IMobileServiceSyncTable<T> table, MobileServiceFile file, string fullPath);
string GetRootDataPath();
Task<string> TakePhotoAsync(object context);
}
} |
<<<<<<<
using ContosoMoments.Common.Queue;
using ContosoMoments.MobileServer.Models;
=======
>>>>>>>
using ContosoMoments.Common.Queue;
using ContosoMoments.MobileServer.Models;
<<<<<<<
using System.Configuration;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.OData;
=======
using ContosoMoments.Common;
>>>>>>>
using System.Configuration;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.OData;
using ContosoMoments.Common.Models;
using Microsoft.Azure.Mobile.Server;
using System.Configuration;
using System;
using ContosoMoments.Common; |
<<<<<<<
=======
using ContosoMoments.Common.Models;
using Microsoft.Azure.Mobile.Server;
using System.Configuration;
using System;
using System.Net.Http;
using System.Diagnostics;
>>>>>>>
using ContosoMoments.Common.Models;
using Microsoft.Azure.Mobile.Server;
using System.Configuration;
using System;
using System.Net.Http;
using System.Diagnostics;
<<<<<<<
[Route("tables/Album/{id}")]
=======
[EnableCors(origins: "*", headers: "*", methods: "*")]
[Route("tables/Album/{id}", Name = "GetAlbumById")]
>>>>>>>
[Route("tables/Album/{id}", Name = "GetAlbumById")] |
<<<<<<<
using System.Runtime.InteropServices;
using System.Text;
using System.Xml.Linq;
=======
>>>>>>>
<<<<<<<
public void AddDiagnosis(string diagnosisUid, DateTimeOffset submissionDate)
{
var existing = PositiveDiagnoses?.Where(d => d.DiagnosisUid.Equals(diagnosisUid, StringComparison.OrdinalIgnoreCase))
.OrderByDescending(d => d.DiagnosisDate).FirstOrDefault();
=======
PositiveDiagnosisState GetLatest()
{
var latest = PositiveDiagnoses?.OrderByDescending(p => p.DiagnosisDate)?.FirstOrDefault();
>>>>>>>
public void AddDiagnosis(string diagnosisUid, DateTimeOffset submissionDate)
{
var existing = PositiveDiagnoses?.Where(d => d.DiagnosisUid.Equals(diagnosisUid, StringComparison.OrdinalIgnoreCase))
.OrderByDescending(d => d.DiagnosisDate).FirstOrDefault(); |
<<<<<<<
var dom = parser.ParseDocument("<html><body></body></html>");
dom.Body.InnerHtml = html;
=======
var dom = parser.Parse("<html><body>" + html);
>>>>>>>
var dom = parser.ParseDocument("<html><body>" + html);
<<<<<<<
DoSanitize(dom, dom.DocumentElement, baseUrl);
=======
using (var dom = parser.Parse(html))
{
DoSanitize(dom, dom, baseUrl);
>>>>>>>
DoSanitize(dom, dom, baseUrl);
<<<<<<<
DoSanitize(dom, dom.DocumentElement, baseUrl);
=======
using (var dom = parser.Parse(html))
{
DoSanitize(dom, dom, baseUrl);
>>>>>>>
DoSanitize(dom, dom, baseUrl); |
<<<<<<<
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
=======
using Microsoft.Quantum.QsCompiler.SyntaxTokens;
using Microsoft.Quantum.QsCompiler.SyntaxTree;
>>>>>>>
using Microsoft.Quantum.QsCompiler.SyntaxTokens;
using Microsoft.Quantum.QsCompiler.SyntaxTree;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
<<<<<<<
internal static void RenderExecutionPath(this ExecutionPathTracer.ExecutionPathTracer tracer,
IChannel channel,
string executionPathDivId,
int renderDepth,
TraceVisualizationStyle style)
{
// Retrieve the `ExecutionPath` traced out by the `ExecutionPathTracer`
var executionPath = tracer.GetExecutionPath();
// Convert executionPath to JToken for serialization
var executionPathJToken = JToken.FromObject(executionPath,
new JsonSerializer() { NullValueHandling = NullValueHandling.Ignore });
// Send execution path to JavaScript via iopub for rendering
channel.SendIoPubMessage(
new Message
{
Header = new MessageHeader
{
MessageType = "render_execution_path"
},
Content = new ExecutionPathVisualizerContent
(
executionPathJToken,
executionPathDivId,
renderDepth,
style
)
}
);
}
=======
internal static IEnumerable<QsDeclarationAttribute> GetAttributesByName(
this OperationInfo operation, string attributeName,
string namespaceName = "Microsoft.Quantum.Documentation"
) =>
operation.Header.Attributes.Where(
attribute =>
// Since QsNullable<UserDefinedType>.Item can be null,
// we use a pattern match here to make sure that we have
// an actual UDT to compare against.
attribute.TypeId.Item is UserDefinedType udt &&
udt.Namespace.Value == namespaceName &&
udt.Name.Value == attributeName
);
internal static bool TryAsStringLiteral(this TypedExpression expression, [NotNullWhen(true)] out string? value)
{
if (expression.Expression is QsExpressionKind<TypedExpression, Identifier, ResolvedType>.StringLiteral literal)
{
value = literal.Item1.Value;
return true;
}
else
{
value = null;
return false;
}
}
internal static IEnumerable<string> GetStringAttributes(
this OperationInfo operation, string attributeName,
string namespaceName = "Microsoft.Quantum.Documentation"
) => operation
.GetAttributesByName(attributeName, namespaceName)
.Select(
attribute =>
attribute.Argument.TryAsStringLiteral(out var value)
? value : null
)
.Where(value => value != null)
// The Where above ensures that all elements are non-nullable,
// but the C# compiler doesn't quite figure that out, so we
// need to help it with a no-op that uses the null-forgiving
// operator.
.Select(value => value!);
internal static IDictionary<string?, string?> GetDictionaryAttributes(
this OperationInfo operation, string attributeName,
string namespaceName = "Microsoft.Quantum.Documentation"
) => operation
.GetAttributesByName(attributeName, namespaceName)
.SelectMany(
attribute => attribute.Argument.Expression switch
{
QsExpressionKind<TypedExpression, Identifier, ResolvedType>.ValueTuple tuple =>
tuple.Item.Length != 2
? throw new System.Exception("Expected attribute to be a tuple of two strings.")
: ImmutableList.Create((tuple.Item[0], tuple.Item[1])),
_ => ImmutableList<(TypedExpression, TypedExpression)>.Empty
}
)
.ToDictionary(
attribute => attribute.Item1.TryAsStringLiteral(out var value) ? value : null,
attribute => attribute.Item2.TryAsStringLiteral(out var value) ? value : null
);
>>>>>>>
internal static void RenderExecutionPath(this ExecutionPathTracer.ExecutionPathTracer tracer,
IChannel channel,
string executionPathDivId,
int renderDepth,
TraceVisualizationStyle style)
{
// Retrieve the `ExecutionPath` traced out by the `ExecutionPathTracer`
var executionPath = tracer.GetExecutionPath();
// Convert executionPath to JToken for serialization
var executionPathJToken = JToken.FromObject(executionPath,
new JsonSerializer() { NullValueHandling = NullValueHandling.Ignore });
// Send execution path to JavaScript via iopub for rendering
channel.SendIoPubMessage(
new Message
{
Header = new MessageHeader
{
MessageType = "render_execution_path"
},
Content = new ExecutionPathVisualizerContent
(
executionPathJToken,
executionPathDivId,
renderDepth,
style
)
}
);
}
internal static IEnumerable<QsDeclarationAttribute> GetAttributesByName(
this OperationInfo operation, string attributeName,
string namespaceName = "Microsoft.Quantum.Documentation"
) =>
operation.Header.Attributes.Where(
attribute =>
// Since QsNullable<UserDefinedType>.Item can be null,
// we use a pattern match here to make sure that we have
// an actual UDT to compare against.
attribute.TypeId.Item is UserDefinedType udt &&
udt.Namespace.Value == namespaceName &&
udt.Name.Value == attributeName
);
internal static bool TryAsStringLiteral(this TypedExpression expression, [NotNullWhen(true)] out string? value)
{
if (expression.Expression is QsExpressionKind<TypedExpression, Identifier, ResolvedType>.StringLiteral literal)
{
value = literal.Item1.Value;
return true;
}
else
{
value = null;
return false;
}
}
internal static IEnumerable<string> GetStringAttributes(
this OperationInfo operation, string attributeName,
string namespaceName = "Microsoft.Quantum.Documentation"
) => operation
.GetAttributesByName(attributeName, namespaceName)
.Select(
attribute =>
attribute.Argument.TryAsStringLiteral(out var value)
? value : null
)
.Where(value => value != null)
// The Where above ensures that all elements are non-nullable,
// but the C# compiler doesn't quite figure that out, so we
// need to help it with a no-op that uses the null-forgiving
// operator.
.Select(value => value!);
internal static IDictionary<string?, string?> GetDictionaryAttributes(
this OperationInfo operation, string attributeName,
string namespaceName = "Microsoft.Quantum.Documentation"
) => operation
.GetAttributesByName(attributeName, namespaceName)
.SelectMany(
attribute => attribute.Argument.Expression switch
{
QsExpressionKind<TypedExpression, Identifier, ResolvedType>.ValueTuple tuple =>
tuple.Item.Length != 2
? throw new System.Exception("Expected attribute to be a tuple of two strings.")
: ImmutableList.Create((tuple.Item[0], tuple.Item[1])),
_ => ImmutableList<(TypedExpression, TypedExpression)>.Empty
}
)
.ToDictionary(
attribute => attribute.Item1.TryAsStringLiteral(out var value) ? value : null,
attribute => attribute.Item2.TryAsStringLiteral(out var value) ? value : null
); |
<<<<<<<
<<<<<<< HEAD
protected Logger _log = LogManager.GetCurrentClassLogger();
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
protected Logger _log = LogManager.GetCurrentClassLogger();
<<<<<<<
AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly());
}
=======
AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly());
}
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
List<ServiceBusInfo> _serviceBusHistory = new List<ServiceBusInfo>();
private void CreateServiceBusManager(string serviceBus, string version, string queueType) {
_mgr = ServiceBusFactory.CreateManager(serviceBus, version, queueType);
_mgr.ErrorOccured += System_ErrorOccured;
_mgr.WarningOccured += System_WarningOccured;
_mgr.ItemsChanged += System_ItemsChanged;
var cmdSender = ( _mgr as ISendCommand );
if( cmdSender != null )
cmdSender.CommandContentFormat = Config.CurrentServer.CommandContentType;
lock( _itemsLock )
_items.Clear();
_mgr.Initialize(Config.CurrentServer.ConnectionSettings, Config.MonitorQueues.Select(mq => new Queue(mq.Name, mq.Type, mq.Color)).ToArray(), _monitorState);
CanSendCommand = ( _mgr as ISendCommand ) != null;
CanViewSubscriptions = ( _mgr as IViewSubscriptions ) != null;
_serviceBusHistory.Add(ServiceBusInfo.Create(serviceBus, version, queueType));
}
public void SwitchServiceBus(string serviceBus, string version, string queueType) {
StopMonitoring();
_mgr.Terminate();
if( !_serviceBusHistory.Any(s => s.Name == serviceBus && s.Version != version) ) {
CreateServiceBusManager(serviceBus, version, queueType);
} else throw new RestartRequiredException();
_serviceBusHistory.Add(ServiceBusInfo.Create(serviceBus, version, queueType));
}
private static SbmqSystem _instance;
public static SbmqSystem Create() {
_instance = new SbmqSystem();
_instance.Initialize();
return _instance;
}
public IServiceBusDiscovery GetDiscoveryService() {
return ServiceBusFactory.CreateDiscovery(Config.ServiceBus, Config.ServiceBusVersion, Config.ServiceBusQueueType);
}
public IServiceBusDiscovery GetDiscoveryService(string messageBus, string version, string queueType) {
return ServiceBusFactory.CreateDiscovery(messageBus, version, queueType);
<<<<<<< HEAD
}
public Type[] GetAvailableCommands(string messageBus, string version, string queueType, string[] asmPaths, CommandDefinition cmdDef, bool suppressErrors) {
var mgr = ServiceBusFactory.CreateManager(messageBus, version, queueType) as ISendCommand;
if( mgr != null ) {
return mgr.GetAvailableCommands(asmPaths, cmdDef, suppressErrors);
} else return new Type[0];
}
=======
}
public Type[] GetAvailableCommands(string messageBus, string version, string queueType, string[] asmPaths, CommandDefinition cmdDef, bool suppressErrors) {
var mgr = ServiceBusFactory.CreateManager(messageBus, version, queueType) as ISendCommand;
if( mgr != null ) {
return mgr.GetAvailableCommands(asmPaths, cmdDef, suppressErrors);
} else return new Type[0];
}
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
protected volatile object _itemsLock = new object();
public object ItemsLock { get { return _itemsLock; } }
volatile ThreadState _currentMonitor = null;
//bool _monitoring = false;
public void StartMonitoring() {
//_monitoring = true;
_currentMonitor = new ThreadState();
var t = new Thread(ExecMonitor);
t.Name = "Queue Monitoring";
t.Start(_currentMonitor);
}
public void StopMonitoring() {
//_monitoring = false;
if( _currentMonitor != null ) {
_currentMonitor.Executing = false;
_currentMonitor = null;
}
<<<<<<< HEAD
}
<<<<<<< /mnt/batch/tasks/workitems/adfv2-General_1/job-1/ed783730-9249-48f0-8995-015f9fff7adc/wd/.temp/athenacommon/a1fdeb63-f91c-4a7d-b028-247d58e5bf5e.cs
public void PauseMonitoring() {
if( _currentMonitor != null ) {
_currentMonitor.Paused = true;
}
}
public void ResumeMonitoring() {
if( _currentMonitor != null ) {
_currentMonitor.Paused = false;
}
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
}
=======
>>>>>>>
AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly());
}
List<ServiceBusInfo> _serviceBusHistory = new List<ServiceBusInfo>();
private void CreateServiceBusManager(string serviceBus, string version, string queueType) {
_mgr = ServiceBusFactory.CreateManager(serviceBus, version, queueType);
_mgr.ErrorOccured += System_ErrorOccured;
_mgr.WarningOccured += System_WarningOccured;
_mgr.ItemsChanged += System_ItemsChanged;
var cmdSender = ( _mgr as ISendCommand );
if( cmdSender != null )
cmdSender.CommandContentFormat = Config.CurrentServer.CommandContentType;
lock( _itemsLock )
_items.Clear();
_mgr.Initialize(Config.CurrentServer.ConnectionSettings, Config.MonitorQueues.Select(mq => new Queue(mq.Name, mq.Type, mq.Color)).ToArray(), _monitorState);
CanSendCommand = ( _mgr as ISendCommand ) != null;
CanViewSubscriptions = ( _mgr as IViewSubscriptions ) != null;
_serviceBusHistory.Add(ServiceBusInfo.Create(serviceBus, version, queueType));
}
public void SwitchServiceBus(string serviceBus, string version, string queueType) {
StopMonitoring();
_mgr.Terminate();
if( !_serviceBusHistory.Any(s => s.Name == serviceBus && s.Version != version) ) {
CreateServiceBusManager(serviceBus, version, queueType);
} else throw new RestartRequiredException();
_serviceBusHistory.Add(ServiceBusInfo.Create(serviceBus, version, queueType));
}
private static SbmqSystem _instance;
public static SbmqSystem Create() {
_instance = new SbmqSystem();
_instance.Initialize();
return _instance;
}
public IServiceBusDiscovery GetDiscoveryService() {
return ServiceBusFactory.CreateDiscovery(Config.ServiceBus, Config.ServiceBusVersion, Config.ServiceBusQueueType);
}
public IServiceBusDiscovery GetDiscoveryService(string messageBus, string version, string queueType) {
return ServiceBusFactory.CreateDiscovery(messageBus, version, queueType);
}
public Type[] GetAvailableCommands(string messageBus, string version, string queueType, string[] asmPaths, CommandDefinition cmdDef, bool suppressErrors) {
var mgr = ServiceBusFactory.CreateManager(messageBus, version, queueType) as ISendCommand;
if( mgr != null ) {
return mgr.GetAvailableCommands(asmPaths, cmdDef, suppressErrors);
} else return new Type[0];
}
protected volatile object _itemsLock = new object();
public object ItemsLock { get { return _itemsLock; } }
volatile ThreadState _currentMonitor = null;
//bool _monitoring = false;
public void StartMonitoring() {
//_monitoring = true;
_currentMonitor = new ThreadState();
var t = new Thread(ExecMonitor);
t.Name = "Queue Monitoring";
t.Start(_currentMonitor);
}
public void StopMonitoring() {
//_monitoring = false;
if( _currentMonitor != null ) {
_currentMonitor.Executing = false;
_currentMonitor = null;
}
}
public void PauseMonitoring() {
if( _currentMonitor != null ) {
_currentMonitor.Paused = true;
}
}
public void ResumeMonitoring() {
if( _currentMonitor != null ) {
_currentMonitor.Paused = false;
}
}
<<<<<<<
<<<<<<< HEAD
while( state.Paused )
Thread.Sleep(1000);
=======
>>>>>>>
while( state.Paused )
Thread.Sleep(1000);
<<<<<<<
} finally {
=======
OnStartedLoadingQueues();
try {
if( RefreshUnprocessedQueueItemList() )
OnItemsChanged(ItemChangeOrigin.Queue);
} finally {
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
} finally {
>>>>>>>
} finally {
<<<<<<<
<<<<<<< HEAD
// Temp until we have a more proper way to Discover if Error queues are built-in with normal queues
if( !_monitorState.IsMonitoring(QueueType.Error) )
_unprocessedItemsCount[(int)QueueType.Error] = 0;
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
// Temp until we have a more proper way to Discover if Error queues are built-in with normal queues
if( !_monitorState.IsMonitoring(QueueType.Error) )
_unprocessedItemsCount[(int)QueueType.Error] = 0;
<<<<<<<
<<<<<<< HEAD
if( r.Status == QueueFetchResultStatus.ConnectionFailed )
=======
if( r.Status == QueueFetchResultStatus.ConnectionFailed )
>>>>>>>
if( r.Status == QueueFetchResultStatus.ConnectionFailed )
<<<<<<<
unchangedQueues.AddRange(_mgr.MonitorQueues.Where(q => q.Type == t).Select(q => q.Name));
=======
if( r.Status == QueueFetchResultStatus.ConnectionFailed )
break;
if( r.Status == QueueFetchResultStatus.NotChanged ) {
unchangedQueues.AddRange( _mgr.MonitorQueues.Where( q => q.Type == t ).Select( q => q.Name ) );
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
unchangedQueues.AddRange( _mgr.MonitorQueues.Where( q => q.Type == t ).Select( q => q.Name ) );
>>>>>>>
unchangedQueues.AddRange(_mgr.MonitorQueues.Where(q => q.Type == t).Select(q => q.Name));
<<<<<<<
changedItemsCount = true;
_unprocessedItemsCount[typeIndex] = r.Count;
<<<<<<< /mnt/batch/tasks/workitems/adfv2-General_1/job-1/ed783730-9249-48f0-8995-015f9fff7adc/wd/.temp/athenacommon/a1fdeb63-f91c-4a7d-b028-247d58e5bf5e.cs
if( t != QueueType.Error && items.Any(i => i.Queue.Type == QueueType.Error) ) {
_unprocessedItemsCount[(int)QueueType.Error] += (uint)items.Where(i => i.Queue.Type == QueueType.Error).Count();
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
changedItemsCount = true;
}
<<<<<<< HEAD
=======
_unprocessedItemsCount[typeIndex] = r.Count;
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
changedItemsCount = true;
_unprocessedItemsCount[typeIndex] = r.Count;
if( t != QueueType.Error && items.Any(i => i.Queue.Type == QueueType.Error) ) {
_unprocessedItemsCount[(int)QueueType.Error] += (uint)items.Where(i => i.Queue.Type == QueueType.Error).Count();
changedItemsCount = true;
}
<<<<<<<
<<<<<<< HEAD
items = items.Where(i => !removedQueueTypes.Any(x => x == i.Queue.Type)).ToList();
=======
items = items.Where(i => !removedQueueTypes.Any( x => x == i.Queue.Type ) ).ToList();
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
items = items.Where(i => !removedQueueTypes.Any( x => x == i.Queue.Type ) ).ToList();
>>>>>>>
items = items.Where(i => !removedQueueTypes.Any(x => x == i.Queue.Type)).ToList();
<<<<<<<
var mgrFilePath = ServiceBusFactory.GetManagerFilePath(Config.ServiceBus, Config.ServiceBusVersion, Config.ServiceBusQueueType);
if( mgrFilePath.IsValid() ) {
string adapterPath = Path.GetDirectoryName(mgrFilePath);
fn = Path.Combine(adapterPath, asmName + ".dll");
if( File.Exists(fn) && ( !hasFullAsmName || AssemblyName.GetAssemblyName(fn).FullName == args.Name ) )
return Assembly.LoadFrom(fn);
<<<<<<< /mnt/batch/tasks/workitems/adfv2-General_1/job-1/ed783730-9249-48f0-8995-015f9fff7adc/wd/.temp/athenacommon/a1fdeb63-f91c-4a7d-b028-247d58e5bf5e.cs
}
} catch( NoMessageBusManagerFound ) {
=======
var mgrFilePath = ServiceBusFactory.GetManagerFilePath(Config.ServiceBus, Config.ServiceBusVersion, Config.ServiceBusQueueType);
if( mgrFilePath.IsValid() ) {
string adapterPath = Path.GetDirectoryName(mgrFilePath);
fn = Path.Combine(adapterPath, asmName + ".dll");
if( File.Exists(fn) && ( !hasFullAsmName || AssemblyName.GetAssemblyName(fn).FullName == args.Name ) )
return Assembly.LoadFrom(fn);
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
try {
var mgrFilePath = ServiceBusFactory.GetManagerFilePath(Config.ServiceBus, Config.ServiceBusVersion, Config.ServiceBusQueueType);
if( mgrFilePath.IsValid() ) {
string adapterPath = Path.GetDirectoryName(mgrFilePath);
fn = Path.Combine(adapterPath, asmName + ".dll");
if( File.Exists(fn) && ( !hasFullAsmName || AssemblyName.GetAssemblyName(fn).FullName == args.Name ) )
return Assembly.LoadFrom(fn);
}
} catch( NoMessageBusManagerFound ) {
<<<<<<<
<<<<<<< HEAD
protected void OnStartedLoadingQueues() {
=======
protected void OnStartedLoadingQueues() {
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
protected void OnStartedLoadingQueues() {
>>>>>>>
protected void OnStartedLoadingQueues() {
<<<<<<<
<<<<<<< HEAD
public event EventHandler<EventArgs> FinishedLoadingQueues {
=======
public event EventHandler<EventArgs> FinishedLoadingQueues {
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
public event EventHandler<EventArgs> FinishedLoadingQueues {
>>>>>>>
public event EventHandler<EventArgs> FinishedLoadingQueues { |
<<<<<<<
<<<<<<< HEAD
Project: ServiceBusMQ.Adapter.NServiceBus4.Azure.SB22
=======
Project: ServiceBusMQ.NServiceBus4.Azure
>>>>>>>
Project: ServiceBusMQ.Adapter.NServiceBus4.Azure.SB22
<<<<<<<
Created: 2013-11-30
=======
Project: ServiceBusMQ.NServiceBus4.Azure
File: AzureMessageQueue.cs
Created: 2013-10-11
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
Created: 2013-10-11
>>>>>>>
Created: 2013-11-30
<<<<<<<
<<<<<<< HEAD
=======
using Microsoft.ServiceBus.Messaging;
>>>>>>>
<<<<<<<
=======
using Microsoft.ServiceBus.Messaging;
using ServiceBusMQ.Model;
using ServiceBusMQ.NServiceBus;
namespace ServiceBusMQ.NServiceBus4 {
public class AzureMessageQueue : IMessageQueue {
string _connectionStr;
public Queue Queue { get; set; }
public QueueClient Main { get; set; }
//public QueueClient Journal { get; set; }
//public bool UseJournalQueue { get { return Main.UseJournalQueue; } }
//public bool CanReadJournalQueue { get { return Main.UseJournalQueue && Journal.CanRead; } }
public AzureMessageQueue(string connectionString, Queue queue) {
_connectionStr = connectionString;
Queue = queue;
Main = QueueClient.CreateFromConnectionString(connectionString, queue.Name, ReceiveMode.ReceiveAndDelete);
//if( Main.UseJournalQueue ) { // Error when trying to use FormatName, strange as it should work according to MSDN. Temp solution for now.
// Journal = new MessageQueue(string.Format(@"{0}\Private$\{1};JOURNAL", connectionString, queue.Name));
// _journalContent = new MessageQueue(string.Format(@"{0}\Private$\{1};JOURNAL", connectionString, queue.Name));
// _journalContent.MessageReadPropertyFilter.ClearAll();
// _journalContent.MessageReadPropertyFilter.Body = true;
//}
}
public static implicit operator QueueClient(AzureMessageQueue q) {
return q.Main;
}
internal void Purge() {
var q = QueueClient.CreateFromConnectionString(_connectionStr, Queue.Name, ReceiveMode.ReceiveAndDelete);
int max = 0xFFFF;
var msgs = q.ReceiveBatch(max);
Console.WriteLine(msgs.Count());
//.Count() == max ) { }
//while( q.ReceiveBatch(max).Count() == max ) { }
}
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>> |
<<<<<<<
<<<<<<< HEAD
using NLog;
=======
>>>>>>>
using NLog;
<<<<<<<
<<<<<<< HEAD
public void Purge() {
var q = Main; //QueueClient.CreateFromConnectionString(_connectionStr, Queue.Name, ReceiveMode.ReceiveAndDelete);
=======
internal void Purge() {
var q = QueueClient.CreateFromConnectionString(_connectionStr, Queue.Name, ReceiveMode.ReceiveAndDelete);
>>>>>>>
public void Purge() {
var q = Main; //QueueClient.CreateFromConnectionString(_connectionStr, Queue.Name, ReceiveMode.ReceiveAndDelete);
<<<<<<<
<<<<<<< HEAD
public bool HasUpdatedSince(DateTime dt) {
=======
internal bool HasUpdatedSince(DateTime dt) {
>>>>>>>
public bool HasUpdatedSince(DateTime dt) { |
<<<<<<<
**`dump.measurementDisplayStyle`**
**Value:** '""NumberOnly""' , `""BarOnly""`, `""BarAndNumber""` (default), or `""None""`
Configures the measurement probability visualization style in output of callables such as
`DumpMachine` or `DumpRegister`. Supports displaying measurement probability as progress bars, numbers, both,
or neither.
**'dump.measurementDisplayPrecision'**
**Value:** non-negative integer such as '1' or '2' (default '4')
Sets the precision of the measurement probability represented as a percentage when set to 'NumberOnly' or
'BarAndNumber'.
**`dump.measurementDisplayHistogram`**
**Value:** `true` (default) or `false'
If `dump.measurementDisplayHistogram` is set to `true`, displays the
histogram representation of the state of the simulator underneath the original chart output.
=======
**`trace.defaultDepth`**
**Value:** positive integer (default `1`)
Configures the default depth used in the `%trace` command for visualizing Q# operations.
>>>>>>>
**`dump.measurementDisplayStyle`**
**Value:** '""NumberOnly""' , `""BarOnly""`, `""BarAndNumber""` (default), or `""None""`
Configures the measurement probability visualization style in output of callables such as
`DumpMachine` or `DumpRegister`. Supports displaying measurement probability as progress bars, numbers, both,
or neither.
**'dump.measurementDisplayPrecision'**
**Value:** non-negative integer such as '1' or '2' (default '4')
Sets the precision of the measurement probability represented as a percentage when set to 'NumberOnly' or
'BarAndNumber'.
**`dump.measurementDisplayHistogram`**
**Value:** `true` (default) or `false'
If `dump.measurementDisplayHistogram` is set to `true`, displays the
histogram representation of the state of the simulator underneath the original chart output.
**`trace.defaultDepth`**
**Value:** positive integer (default `1`)
Configures the default depth used in the `%trace` command for visualizing Q# operations. |
<<<<<<<
<<<<<<< HEAD
namespace ServiceBusMQ.Adapter.Azure.ServiceBus22 {
=======
namespace ServiceBusMQ.NServiceBus4.Azure {
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
namespace ServiceBusMQ.NServiceBus4.Azure {
>>>>>>>
namespace ServiceBusMQ.Adapter.Azure.ServiceBus22 {
<<<<<<<
<<<<<<< HEAD
var queue = QueueClient.CreateFromConnectionString(ConnectionString, fromQueueName);
var deadLetterQueue = QueueClient.CreateFromConnectionString(ConnectionString, QueueClient.FormatDeadLetterPath(fromQueueName), ReceiveMode.PeekLock);
=======
var queue = GetInputQueue(fromQueueName);
>>>>>>>
var queue = QueueClient.CreateFromConnectionString(ConnectionString, fromQueueName);
var deadLetterQueue = QueueClient.CreateFromConnectionString(ConnectionString, QueueClient.FormatDeadLetterPath(fromQueueName), ReceiveMode.PeekLock);
<<<<<<<
<<<<<<< HEAD
public void ReturnMessageToSourceQueue(QueueClient queue, QueueClient deadLetterQueue, ServiceBusMQ.Model.QueueItem itm) {
=======
public void ReturnMessageToSourceQueue(QueueClient queue, ServiceBusMQ.Model.QueueItem itm) {
>>>>>>>
public void ReturnMessageToSourceQueue(QueueClient queue, QueueClient deadLetterQueue, ServiceBusMQ.Model.QueueItem itm) {
<<<<<<<
<<<<<<< HEAD
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>> |
<<<<<<<
<<<<<<< HEAD
using System.Threading.Tasks;
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
using System.Threading.Tasks;
<<<<<<<
<<<<<<< HEAD
namespace ServiceBusMQ.Adapter.NServiceBus4.Azure.SB22 {
=======
namespace ServiceBusMQ.NServiceBus4.Azure {
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
namespace ServiceBusMQ.NServiceBus4.Azure {
>>>>>>>
namespace ServiceBusMQ.Adapter.NServiceBus4.Azure.SB22 {
<<<<<<<
<<<<<<< HEAD
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
<<<<<<<
<<<<<<< HEAD
///AzureMessageQueue q = GetMessageQueue(itm);
=======
///AzureMessageQueue q = GetMessageQueue(itm);
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
///AzureMessageQueue q = GetMessageQueue(itm);
>>>>>>>
///AzureMessageQueue q = GetMessageQueue(itm);
<<<<<<<
<<<<<<< HEAD
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
<<<<<<<
<<<<<<< HEAD
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
<<<<<<<
<<<<<<< HEAD
=======
>>>>>>>
<<<<<<<
result.Status = QueueFetchResultStatus.NotChanged;
=======
public override Model.QueueFetchResult GetUnprocessedMessages(QueueType type, IEnumerable<QueueItem> currentItems) {
var result = new QueueFetchResult();
result.Status = QueueFetchResultStatus.OK;
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
result.Status = QueueFetchResultStatus.OK;
>>>>>>>
result.Status = QueueFetchResultStatus.NotChanged;
<<<<<<<
<<<<<<< HEAD
OnWarning(se.Message, null, Manager.WarningType.ConnectonFailed);
=======
OnWarning( se.Message, null, Manager.WarningType.ConnectonFailed );
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
OnWarning( se.Message, null, Manager.WarningType.ConnectonFailed );
>>>>>>>
OnWarning(se.Message, null, Manager.WarningType.ConnectonFailed);
<<<<<<<
<<<<<<< HEAD
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
<<<<<<<
<<<<<<< HEAD
} catch( Exception ex ) {
=======
} catch (Exception ex) {
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
} catch (Exception ex) {
>>>>>>>
} catch( Exception ex ) {
<<<<<<<
<<<<<<< HEAD
itm.Content = ReadMessageStream(new System.IO.MemoryStream(msg.GetBody<byte[]>()));
=======
itm.Content = ReadMessageStream( new System.IO.MemoryStream(msg.GetBody<byte[]>()) );
>>>>>>>
itm.Content = ReadMessageStream(new System.IO.MemoryStream(msg.GetBody<byte[]>()));
<<<<<<<
if( msg.Properties.Count > 0 )
msg.Properties.ForEach(p => itm.Headers.Add(p.Key, p.Value.ToString()));
=======
itm.Content = ReadMessageStream( new System.IO.MemoryStream(msg.GetBody<byte[]>()) );
//itm.Content = ReadMessageStream(msg.BodyStream);
itm.Headers = new Dictionary<string, string>();
if( msg.Properties.Count > 0 )
msg.Properties.ForEach( p => itm.Headers.Add(p.Key, p.Value.ToString()) );
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
if( msg.Properties.Count > 0 )
msg.Properties.ForEach( p => itm.Headers.Add(p.Key, p.Value.ToString()) );
>>>>>>>
if( msg.Properties.Count > 0 )
msg.Properties.ForEach(p => itm.Headers.Add(p.Key, p.Value.ToString()));
<<<<<<<
List<Task> tasks = new List<Task>();
for(int i = 0; i < _monitorQueues.Count; i++) {
tasks.Add(Task.Factory.StartNew(() => _monitorQueues[i].Purge()));
if( (i % 4) == 0 ) {
Task.WaitAll(tasks.ToArray());
tasks.Clear();
}
}
=======
QueueClient q = GetMessageQueue(itm);
if( q != null ) {
var msg = q.Receive( (long)itm.MessageQueueItemId );
//if( msg != null )
// msg.Complete();
itm.Processed = true;
OnItemsChanged();
}
}
public override void PurgeAllMessages() {
_monitorQueues.ForEach(q => q.Purge());
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
_monitorQueues.ForEach(q => q.Purge());
>>>>>>>
List<Task> tasks = new List<Task>();
for(int i = 0; i < _monitorQueues.Count; i++) {
tasks.Add(Task.Factory.StartNew(() => _monitorQueues[i].Purge()));
if( (i % 4) == 0 ) {
Task.WaitAll(tasks.ToArray());
tasks.Clear();
}
}
<<<<<<<
<<<<<<< HEAD
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>> |
<<<<<<<
<<<<<<< HEAD
namespace ServiceBusMQ.Adapter.Azure.ServiceBus22 {
=======
namespace ServiceBusMQ.NServiceBus4.Azure {
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
namespace ServiceBusMQ.NServiceBus4.Azure {
>>>>>>>
namespace ServiceBusMQ.Adapter.Azure.ServiceBus22 {
<<<<<<<
<<<<<<< HEAD
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
<<<<<<<
<<<<<<< HEAD
static readonly ServiceBusFeature[] _features = new ServiceBusFeature[] {
//ServiceBusFeature.PurgeMessage,
ServiceBusFeature.PurgeAllMessages,
//ServiceBusFeature.MoveErrorMessageToOriginQueue,
ServiceBusFeature.MoveAllErrorMessagesToOriginQueue
};
public ServiceBusFeature[] Features {
get { return _features; }
}
=======
>>>>>>>
static readonly ServiceBusFeature[] _features = new ServiceBusFeature[] {
//ServiceBusFeature.PurgeMessage,
ServiceBusFeature.PurgeAllMessages,
//ServiceBusFeature.MoveErrorMessageToOriginQueue,
ServiceBusFeature.MoveAllErrorMessagesToOriginQueue
};
public ServiceBusFeature[] Features {
get { return _features; }
}
<<<<<<<
ServerConnectionParameter.Create("connectionStr", "Connection String"),
ServerConnectionParameter.Create("msgLimit", "Fetch Message Count Limit", ParamType.String, "100")
=======
public ServerConnectionParameter[] ServerConnectionParameters {
get {
return new ServerConnectionParameter[] {
ServerConnectionParameter.Create("connectionStr", "Connection String")
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
ServerConnectionParameter.Create("connectionStr", "Connection String")
>>>>>>>
ServerConnectionParameter.Create("connectionStr", "Connection String"),
ServerConnectionParameter.Create("msgLimit", "Fetch Message Count Limit", ParamType.String, "100") |
<<<<<<<
<<<<<<< HEAD
using System.Threading;
using System.Threading.Tasks;
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
using System.Threading;
using System.Threading.Tasks;
<<<<<<<
<<<<<<< HEAD
namespace ServiceBusMQ.Adapter.Azure.ServiceBus22 {
=======
namespace ServiceBusMQ.NServiceBus4.Azure {
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
namespace ServiceBusMQ.NServiceBus4.Azure {
>>>>>>>
namespace ServiceBusMQ.Adapter.Azure.ServiceBus22 {
<<<<<<<
<<<<<<< HEAD
=======
static readonly string CS_SERVER = "server";
>>>>>>>
<<<<<<<
static readonly string CS_MAX_MESSAGES = "msgLimit";
=======
static readonly string CS_SERVER = "server";
static readonly string CS_CONNECTION_STRING = "connectionStr";
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
static readonly string CS_MAX_MESSAGES = "msgLimit";
<<<<<<<
<<<<<<< HEAD
private int MessageCountLimit {
get {
int r = 0;
if( _connectionSettings.ContainsKey(CS_MAX_MESSAGES) && Int32.TryParse(_connectionSettings[CS_MAX_MESSAGES] as string, out r) )
return r;
else return SbmqSystem.MAX_ITEMS_PER_QUEUE;
}
}
private string ConnectionString {
get { return _connectionSettings[CS_CONNECTION_STRING] as string; }
}
=======
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
>>>>>>>
private int MessageCountLimit {
get {
int r = 0;
if( _connectionSettings.ContainsKey(CS_MAX_MESSAGES) && Int32.TryParse(_connectionSettings[CS_MAX_MESSAGES] as string, out r) )
return r;
else return SbmqSystem.MAX_ITEMS_PER_QUEUE;
}
}
private string ConnectionString {
get { return _connectionSettings[CS_CONNECTION_STRING] as string; }
}
<<<<<<<
<<<<<<< HEAD
IEnumerable<AzureMessageQueue> queues = type != QueueType.Error ? _monitorQueues.Where(q => q.Queue.Type == type) : _monitorQueues.Where( q => q.IsDeadLetterQueue || q.Queue.Type == QueueType.Error );
=======
var queues = _monitorQueues.Where(q => q.Queue.Type == type);
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
var queues = _monitorQueues.Where(q => q.Queue.Type == type);
>>>>>>>
IEnumerable<AzureMessageQueue> queues = type != QueueType.Error ? _monitorQueues.Where(q => q.Queue.Type == type) : _monitorQueues.Where( q => q.IsDeadLetterQueue || q.Queue.Type == QueueType.Error );
<<<<<<<
<<<<<<< HEAD
if( q.HasChanged() ) {
=======
if( q.HasChanged ) {
>>>>>>>
if( q.HasChanged() ) {
<<<<<<<
var msgs = q.Main.PeekBatch(0, MessageCountLimit);
=======
if( q.HasChanged ) {
if( result.Status == QueueFetchResultStatus.NotChanged )
result.Status = QueueFetchResultStatus.OK;
q.LastPeek = DateTime.Now;
var countDetails = q.Info.MessageCountDetails;
// Get Messages
var msgCount = AzureMessageQueue.GetMessageCount(countDetails);
if( msgCount > 0 ) {
var msgs = q.Main.PeekBatch(0, SbmqSystem.MAX_ITEMS_PER_QUEUE);
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
var msgs = q.Main.PeekBatch(0, SbmqSystem.MAX_ITEMS_PER_QUEUE);
>>>>>>>
var msgs = q.Main.PeekBatch(0, MessageCountLimit);
<<<<<<<
<<<<<<< HEAD
=======
// Get Dead Letter Messages
var deadLetters = AzureMessageQueue.GetDeadLetterMessageCount(countDetails);
if( deadLetters > 0 ) {
var msgs = q.DeadLetter.PeekBatch(0, SbmqSystem.MAX_ITEMS_PER_QUEUE);
result.Count += (uint)deadLetters;
foreach( var msg in msgs ) {
QueueItem itm = currentItems.FirstOrDefault(i => i.Id == msg.MessageId);
if( itm == null && !r.Any(i => i.Id == msg.MessageId) ) {
itm = CreateQueueItem(q.ErrorQueue, msg);
// Load Message names and check if its not an infra-message
if( !PrepareQueueItemForAdd(itm) )
itm = null;
}
if( itm != null )
r.Insert(0, itm);
}
}
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
// Get Dead Letter Messages
var deadLetters = AzureMessageQueue.GetDeadLetterMessageCount(countDetails);
if( deadLetters > 0 ) {
var msgs = q.DeadLetter.PeekBatch(0, SbmqSystem.MAX_ITEMS_PER_QUEUE);
result.Count += (uint)deadLetters;
foreach( var msg in msgs ) {
QueueItem itm = currentItems.FirstOrDefault(i => i.Id == msg.MessageId);
if( itm == null && !r.Any(i => i.Id == msg.MessageId) ) {
itm = CreateQueueItem(q.ErrorQueue, msg);
// Load Message names and check if its not an infra-message
if( !PrepareQueueItemForAdd(itm) )
itm = null;
}
if( itm != null )
r.Insert(0, itm);
}
}
>>>>>>>
<<<<<<<
List<Task> tasks = new List<Task>();
for( int i = 0; i < _monitorQueues.Count; i++ ) {
tasks.Add(Task.Factory.StartNew(() => _monitorQueues[i].Purge()));
Thread.Sleep(700);
if( ( i % 6 ) == 0 ) {
Task.WaitAll(tasks.ToArray());
tasks.Clear();
}
}
if( tasks.Count > 0 )
Task.WaitAll(tasks.ToArray());
=======
QueueClient q = GetMessageQueue(itm);
if( q != null ) {
var msg = q.Receive((long)itm.MessageQueueItemId);
//if( msg != null )
// msg.Complete();
itm.Processed = true;
OnItemsChanged();
}
}
public void PurgeAllMessages() {
_monitorQueues.ForEach(q => q.Purge());
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
_monitorQueues.ForEach(q => q.Purge());
>>>>>>>
List<Task> tasks = new List<Task>();
for( int i = 0; i < _monitorQueues.Count; i++ ) {
tasks.Add(Task.Factory.StartNew(() => _monitorQueues[i].Purge()));
Thread.Sleep(700);
if( ( i % 6 ) == 0 ) {
Task.WaitAll(tasks.ToArray());
tasks.Clear();
}
}
if( tasks.Count > 0 )
Task.WaitAll(tasks.ToArray());
<<<<<<<
<<<<<<< HEAD
var mgr = new ErrorManager(ConnectionString);
=======
var mgr = new ErrorManager(_connectionSettings[CS_CONNECTION_STRING] as string);
// TODO:
// Check if Clustered Queue, due if Clustered && NonTransactional, then Error
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
var mgr = new ErrorManager(_connectionSettings[CS_CONNECTION_STRING] as string);
// TODO:
// Check if Clustered Queue, due if Clustered && NonTransactional, then Error
>>>>>>>
var mgr = new ErrorManager(ConnectionString);
<<<<<<<
<<<<<<< HEAD
public event EventHandler<WarningArgs> WarningOccured;
=======
public event EventHandler<WarningArgs> WarningOccured;
>>>>>>> 3dd34e76b2bd5c60a3431e8f5fa66de0154cca6c
=======
public event EventHandler<WarningArgs> WarningOccured;
>>>>>>>
public event EventHandler<WarningArgs> WarningOccured; |
<<<<<<<
/// <summary>
/// Tests <see cref="CommandLine.Arguments.GetArgumentHelp"/> with no arguments.
/// </summary>
[Fact]
public void GetArgumentHelpNull()
{
#pragma warning disable CS0618 // Type or member is obsolete
var help = CommandLine.Arguments.GetArgumentHelp().ToList();
#pragma warning restore CS0618 // Type or member is obsolete
Assert.Equal(7, help.Count);
Assert.Single(help.Where(h => h.ShortName == 'b'));
Assert.Equal("help", help.Where(h => h.ShortName == 'b').FirstOrDefault().HelpText);
}
/// <summary>
/// Tests the <see cref="Indexer"/> of <see cref="Utility.CommandLine.Arguments"/>.
/// </summary>
=======
>>>>>>>
[Fact]
public void GetArgumentHelpNull()
{
#pragma warning disable CS0618 // Type or member is obsolete
var help = CommandLine.Arguments.GetArgumentHelp().ToList();
#pragma warning restore CS0618 // Type or member is obsolete
Assert.Equal(7, help.Count);
Assert.Single(help.Where(h => h.ShortName == 'b'));
Assert.Equal("help", help.Where(h => h.ShortName == 'b').FirstOrDefault().HelpText);
}
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with the default values.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit command line string
/// containing a mixture of upper and lower case arguments.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with a string coning a single operand
/// which contains a dash.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with a decimal value.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an empty string.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit command line string
/// containing values with inner quoted strings.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit command line string
/// containing a mixture of short and long arguments.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="CommandLine.Arguments.Parse(string, Type, string)"/> method with a mixture of arguments and operands.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit command line string
/// containing multiple pairs of arguments containing quoted values.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with no argument.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with a null argument.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with a string containing only a series
/// of operands.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with a string containing an operand.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with a string containing multiple operands.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit command line string
/// containing only short parameters.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with a a string containing only the
/// strict operand delimiter.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with a a string containing multiple
/// strict operand delimiters.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit operand delimiter.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit operand delimiter, and
/// nothing after the delimiter.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with a a string beginning with the
/// explicit operand delimiter.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit command line string
/// containing only long parameters.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit command line string
/// containing a value beginning with a slash.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Parse(string, Type, string)"/> method with an explicit command line string
/// containing arguments with values enclosed in quotes and containing a period.
/// </summary>
=======
>>>>>>>
<<<<<<<
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Populate(Type, string, bool)"/> method with an explicit string
/// containing multiple instances of a list-backed argument.
/// </summary>
[Fact]
public void PopulateLong()
{
Exception ex = Record.Exception(() => CommandLine.Arguments.Populate(GetType(), "--list one --list two --list three"));
Assert.Null(ex);
Assert.Equal(3, List.Count);
Assert.Equal("one", List[0]);
Assert.Equal("two", List[1]);
Assert.Equal("three", List[2]);
}
///// <summary>
///// Tests the <see cref="Utility.CommandLine.Arguments.Populate(Type, string, bool)"/> method with an explicit string
///// containing multiple instances of a list-backed argument.
///// </summary>
//[Fact]
//public void PopulateLongAndShort()
//{
// Exception ex = Record.Exception(() => CommandLine.Arguments.Populate(GetType(), "-l one --list two -l three"));
// Assert.Null(ex);
// Assert.Equal(3, List.Count);
// Assert.Equal("one", List[0]);
// Assert.Equal("two", List[1]);
// Assert.Equal("three", List[2]);
//}
/// <summary>
/// Tests the <see cref="Utility.CommandLine.Arguments.Populate(Type, string, bool)"/> method with an explicit string
/// containing a single a single instance of a list-backed argument.
/// </summary>
=======
>>>>>>>
[Fact]
public void PopulateLong()
{
Exception ex = Record.Exception(() => CommandLine.Arguments.Populate(GetType(), "--list one --list two --list three"));
Assert.Null(ex);
Assert.Equal(3, List.Count);
Assert.Equal("one", List[0]);
Assert.Equal("two", List[1]);
Assert.Equal("three", List[2]);
}
//[Fact]
//public void PopulateLongAndShort()
//{
// Exception ex = Record.Exception(() => CommandLine.Arguments.Populate(GetType(), "-l one --list two -l three"));
// Assert.Null(ex);
// Assert.Equal(3, List.Count);
// Assert.Equal("one", List[0]);
// Assert.Equal("two", List[1]);
// Assert.Equal("three", List[2]);
//} |
<<<<<<<
// Carry out initial population of information
InvokeUpdateProfile(ref state, ref shortIntValues, ref textValues, ref intValues, ref decimalValues, ref booleanValues, ref dateTimeValues, ref extendedValues);
InvokeNewSystem(ref state, ref shortIntValues, ref textValues, ref intValues, ref decimalValues, ref booleanValues, ref dateTimeValues, ref extendedValues);
CurrentEnvironment = ENVIRONMENT_NORMAL_SPACE;
setString(ref textValues, "Environment", CurrentEnvironment);
=======
starMapService = new StarMapService("8023ed4044b074115af1dd85bc8920e0ef072cb1", "Test");
setPluginStatus(ref textValues, "Operational", null, null);
>>>>>>>
starMapService = new StarMapService("8023ed4044b074115af1dd85bc8920e0ef072cb1", "Test");
// Carry out initial population of information
InvokeUpdateProfile(ref state, ref shortIntValues, ref textValues, ref intValues, ref decimalValues, ref booleanValues, ref dateTimeValues, ref extendedValues);
InvokeNewSystem(ref state, ref shortIntValues, ref textValues, ref intValues, ref decimalValues, ref booleanValues, ref dateTimeValues, ref extendedValues);
CurrentEnvironment = ENVIRONMENT_NORMAL_SPACE;
setString(ref textValues, "Environment", CurrentEnvironment); |
<<<<<<<
using System.Linq;
=======
using System.IO;
>>>>>>>
using System.Linq;
using System.IO;
<<<<<<<
[TestMethod]
public void TestBlueprintFromEdNameAndGrade()
{
string blueprintName = "WakeScanner_Fast Scan_3";
string blueprintTemplate = "Sensor_FastScan";
int grade = 3;
Blueprint blueprint = Blueprint.FromEDNameAndGrade(blueprintName, grade);
Assert.IsNotNull(blueprint);
Assert.AreEqual(grade, blueprint.grade);
Assert.AreEqual(blueprintTemplate, blueprint.blueprintTemplate?.edname);
Assert.AreEqual(3, blueprint.materials.Count);
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("phosphorus"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("uncutfocuscrystals"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("symmetrickeys"));
}
[TestMethod]
public void TestBlueprintFromTemplateEdNameAndGrade()
{
// We should also be able to handle receiving a template name rather than a blueprint name while still providing essential info.
string blueprintTemplate = "Sensor_FastScan";
int grade = 3;
Blueprint blueprintFromTemplate = Blueprint.FromEDNameAndGrade(blueprintTemplate, grade);
Assert.IsNotNull(blueprintFromTemplate);
Assert.AreEqual(grade, blueprintFromTemplate.grade);
Assert.AreEqual(blueprintTemplate, blueprintFromTemplate.blueprintTemplate.edname);
Assert.AreEqual(3, blueprintFromTemplate.materials.Count);
string[] materials = blueprintFromTemplate.materials.Select(m => m.edname).ToArray();
Assert.IsTrue(materials.Contains("phosphorus"));
Assert.IsTrue(materials.Contains("uncutfocuscrystals"));
Assert.IsTrue(materials.Contains("symmetrickeys"));
}
[TestMethod]
public void TestBlueprintNameAndGrade()
{
string blueprintName = "Dirty Drive Tuning";
int grade = 5;
Blueprint blueprint = Blueprint.FromNameAndGrade(blueprintName, grade);
Assert.IsNotNull(blueprint);
Assert.AreEqual(128673659, blueprint.blueprintId);
Assert.AreEqual(grade, blueprint.grade);
Assert.AreEqual("Engine_Dirty", blueprint.blueprintTemplate?.edname);
Assert.AreEqual(3, blueprint.materials.Count);
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("industrialfirmware"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("cadmium"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("pharmaceuticalisolators"));
}
[TestMethod]
public void TestBlueprintBadNameAndGrade()
{
string blueprintName = "No such blueprint";
int grade = 5;
Blueprint blueprint = Blueprint.FromNameAndGrade(blueprintName, grade);
Assert.IsNull(blueprint);
}
[TestMethod]
public void TestBlueprintFromBlueprintID()
{
long blueprintId = 128740124;
Blueprint blueprint = Blueprint.FromEliteID(blueprintId);
Assert.IsNotNull(blueprint);
Assert.AreEqual(3, blueprint.grade);
Assert.IsNotNull(blueprint.blueprintTemplate);
Assert.AreEqual(3, blueprint.materials.Count);
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("phosphorus"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("uncutfocuscrystals"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("symmetrickeys"));
}
[TestMethod]
public void TestBlueprintFromBadBlueprintID()
{
long blueprintId = -1;
Blueprint blueprint = Blueprint.FromEliteID(blueprintId);
Assert.IsNull(blueprint);
}
=======
[TestMethod]
[DeploymentItem("vehicle.json")]
public void TestVehicleProperties()
{
string jsonString = File.ReadAllText("vehicle.json");
JObject json = JsonConvert.DeserializeObject<JObject>(jsonString);
Vehicle v0 = Vehicle.FromJson(0, json);
Assert.AreEqual(0, v0.subslot, "testing v0 subslot from JSON");
Assert.AreEqual(v0.localizedName, "SRV Scarab");
Assert.AreEqual(v0.localizedDescription, "dual plasma repeaters");
Vehicle v1 = Vehicle.FromJson(1, json);
Assert.AreEqual(1, v1.subslot, "testing v1 subslot from JSON");
Assert.AreEqual(0, v0.subslot, "testing v0 subslot after setting v1 subslot");
}
>>>>>>>
[TestMethod]
public void TestBlueprintFromEdNameAndGrade()
{
string blueprintName = "WakeScanner_Fast Scan_3";
string blueprintTemplate = "Sensor_FastScan";
int grade = 3;
Blueprint blueprint = Blueprint.FromEDNameAndGrade(blueprintName, grade);
Assert.IsNotNull(blueprint);
Assert.AreEqual(grade, blueprint.grade);
Assert.AreEqual(blueprintTemplate, blueprint.blueprintTemplate?.edname);
Assert.AreEqual(3, blueprint.materials.Count);
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("phosphorus"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("uncutfocuscrystals"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("symmetrickeys"));
}
[TestMethod]
public void TestBlueprintFromTemplateEdNameAndGrade()
{
// We should also be able to handle receiving a template name rather than a blueprint name while still providing essential info.
string blueprintTemplate = "Sensor_FastScan";
int grade = 3;
Blueprint blueprintFromTemplate = Blueprint.FromEDNameAndGrade(blueprintTemplate, grade);
Assert.IsNotNull(blueprintFromTemplate);
Assert.AreEqual(grade, blueprintFromTemplate.grade);
Assert.AreEqual(blueprintTemplate, blueprintFromTemplate.blueprintTemplate.edname);
Assert.AreEqual(3, blueprintFromTemplate.materials.Count);
string[] materials = blueprintFromTemplate.materials.Select(m => m.edname).ToArray();
Assert.IsTrue(materials.Contains("phosphorus"));
Assert.IsTrue(materials.Contains("uncutfocuscrystals"));
Assert.IsTrue(materials.Contains("symmetrickeys"));
}
[TestMethod]
public void TestBlueprintNameAndGrade()
{
string blueprintName = "Dirty Drive Tuning";
int grade = 5;
Blueprint blueprint = Blueprint.FromNameAndGrade(blueprintName, grade);
Assert.IsNotNull(blueprint);
Assert.AreEqual(128673659, blueprint.blueprintId);
Assert.AreEqual(grade, blueprint.grade);
Assert.AreEqual("Engine_Dirty", blueprint.blueprintTemplate?.edname);
Assert.AreEqual(3, blueprint.materials.Count);
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("industrialfirmware"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("cadmium"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("pharmaceuticalisolators"));
}
[TestMethod]
public void TestBlueprintBadNameAndGrade()
{
string blueprintName = "No such blueprint";
int grade = 5;
Blueprint blueprint = Blueprint.FromNameAndGrade(blueprintName, grade);
Assert.IsNull(blueprint);
}
[TestMethod]
public void TestBlueprintFromBlueprintID()
{
long blueprintId = 128740124;
Blueprint blueprint = Blueprint.FromEliteID(blueprintId);
Assert.IsNotNull(blueprint);
Assert.AreEqual(3, blueprint.grade);
Assert.IsNotNull(blueprint.blueprintTemplate);
Assert.AreEqual(3, blueprint.materials.Count);
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("phosphorus"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("uncutfocuscrystals"));
Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("symmetrickeys"));
}
[TestMethod]
public void TestBlueprintFromBadBlueprintID()
{
long blueprintId = -1;
Blueprint blueprint = Blueprint.FromEliteID(blueprintId);
Assert.IsNull(blueprint);
}
[TestMethod]
[DeploymentItem("vehicle.json")]
public void TestVehicleProperties()
{
string jsonString = File.ReadAllText("vehicle.json");
JObject json = JsonConvert.DeserializeObject<JObject>(jsonString);
Vehicle v0 = Vehicle.FromJson(0, json);
Assert.AreEqual(0, v0.subslot, "testing v0 subslot from JSON");
Assert.AreEqual(v0.localizedName, "SRV Scarab");
Assert.AreEqual(v0.localizedDescription, "dual plasma repeaters");
Vehicle v1 = Vehicle.FromJson(1, json);
Assert.AreEqual(1, v1.subslot, "testing v1 subslot from JSON");
Assert.AreEqual(0, v0.subslot, "testing v0 subslot after setting v1 subslot");
} |
<<<<<<<
using EddiCore;
=======
using System.Text;
using EddiDataProviderService;
using EddiStarMapService;
using Newtonsoft.Json.Linq;
using Tests.Properties;
using Utilities;
>>>>>>>
using EddiCore;
using System.Text;
using EddiDataProviderService;
using EddiStarMapService;
using Newtonsoft.Json.Linq;
using Tests.Properties;
using Utilities; |
<<<<<<<
Assert.AreEqual(0.94775, (double)theEvent.solarradius, 0.01);
=======
Assert.AreEqual(theEvent.radius, (decimal)659162816.0);
Assert.AreEqual(theEvent.solarradius, StarClass.solarradius((decimal)659162816.000000));
>>>>>>>
Assert.AreEqual(theEvent.radius, (decimal)659162816.0);
Assert.AreEqual(theEvent.solarradius, StarClass.solarradius((decimal)659162816.000000));
Assert.AreEqual(0.94775, (double)theEvent.solarradius, 0.01); |
<<<<<<<
using System;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System; |
<<<<<<<
using System.ComponentModel.Composition;
using Microsoft.R.Components.ContentTypes;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.ComponentModel.Composition;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.ComponentModel.Composition;
using Microsoft.R.Components.ContentTypes; |
<<<<<<<
var dte = _coreShell.GetService<DTE>();
if (dte.Solution.Projects.Count > 0) {
=======
DTE dte = VsAppShell.Current.GetGlobalService<DTE>();
var projects = dte?.Solution?.Projects;
if (projects != null && projects.Count > 0) {
>>>>>>>
var dte = _coreShell.GetService<DTE>();
var projects = dte?.Solution?.Projects;
if (projects != null && projects.Count > 0) { |
<<<<<<<
public Task<PlotDeviceProperties> PlotDeviceCreate(Guid deviceId, CancellationToken ct) {
if (PlotDeviceCreateHandler != null) {
return Task.FromResult(PlotDeviceCreateHandler(deviceId));
}
throw new NotImplementedException();
}
public Task PlotDeviceDestroy(Guid deviceId, CancellationToken ct) {
if (PlotDeviceDestroyHandler != null) {
PlotDeviceDestroyHandler(deviceId);
return Task.CompletedTask;
}
throw new NotImplementedException();
}
=======
public Task<string> SaveFileAsync(string fileName, byte[] data) {
return Task.FromResult(string.Empty);
}
>>>>>>>
public Task<string> SaveFileAsync(string fileName, byte[] data) {
return Task.FromResult(string.Empty);
}
public Task<PlotDeviceProperties> PlotDeviceCreate(Guid deviceId, CancellationToken ct) {
if (PlotDeviceCreateHandler != null) {
return Task.FromResult(PlotDeviceCreateHandler(deviceId));
}
throw new NotImplementedException();
}
public Task PlotDeviceDestroy(Guid deviceId, CancellationToken ct) {
if (PlotDeviceDestroyHandler != null) {
PlotDeviceDestroyHandler(deviceId);
return Task.CompletedTask;
}
throw new NotImplementedException();
} |
<<<<<<<
new ShowContextMenuCommand(textView, RGuidList.RPackageGuid, RGuidList.RCmdSetGuid, (int)RContextMenuId.RHistory),
new LoadHistoryCommand(textView, _historyProvider, _interactiveWorkflow),
new SaveHistoryCommand(textView, _historyProvider, _interactiveWorkflow),
=======
new LoadHistoryCommand(textView, _historyProvider),
new SaveHistoryCommand(textView, _historyProvider),
>>>>>>>
new LoadHistoryCommand(textView, _historyProvider, _interactiveWorkflow),
new SaveHistoryCommand(textView, _historyProvider, _interactiveWorkflow),
<<<<<<<
new HistoryWindowVsStd97CmdIdSelectAllCommand(textView, _historyProvider, _interactiveWorkflow),
new ToggleMultilineHistorySelectionCommand(textView, _historyProvider, _interactiveWorkflow, RToolsSettings.Current),
new CopySelectedHistoryCommand(textView, _historyProvider, _interactiveWorkflow)
=======
new HistoryWindowVsStd97CmdIdSelectAllCommand(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdUp(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdDown(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdHome(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdEnd(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdPageUp(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdPageDown(textView, _historyProvider),
new ToggleMultilineHistorySelectionCommand(textView, _historyProvider, RToolsSettings.Current),
new CopySelectedHistoryCommand(textView, _historyProvider, _editorOperationsService)
>>>>>>>
new HistoryWindowVsStd97CmdIdSelectAllCommand(textView, _historyProvider, _interactiveWorkflow),
new HistoryWindowVsStd2KCmdIdUp(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdDown(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdHome(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdEnd(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdPageUp(textView, _historyProvider),
new HistoryWindowVsStd2KCmdIdPageDown(textView, _historyProvider),
new ToggleMultilineHistorySelectionCommand(textView, _historyProvider, _interactiveWorkflow, RToolsSettings.Current),
new CopySelectedHistoryCommand(textView, _historyProvider, _interactiveWorkflow) |
<<<<<<<
using System;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Linq;
using Microsoft.Languages.Editor;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System; |
<<<<<<<
text.Should().Contain(string.Format(Microsoft.R.Components.Resources.InputIsTooLong, 4096));
=======
text.Should().Contain(string.Format(Resources.InputIsTooLong, 4096));
tb.Clear();
>>>>>>>
text.Should().Contain(string.Format(Microsoft.R.Components.Resources.InputIsTooLong, 4096));
tb.Clear();
<<<<<<<
text.Should().Be(Microsoft.R.Components.Resources.Error_ReplUnicodeCoversion);
=======
text.TrimEnd().Should().Be("[1] \"電話帳 全米のお\"");
tb.Clear();
>>>>>>>
text.TrimEnd().Should().Be("[1] \"電話帳 全米のお\"");
tb.Clear(); |
<<<<<<<
using System;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using Microsoft.Languages.Editor;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System; |
<<<<<<<
using System;
using Microsoft.R.Components.ContentTypes;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using Microsoft.R.Components.ContentTypes; |
<<<<<<<
CancellationTokenSource evaluationCts;
Task evaluationTask;
if (isEvaluationAllowed) {
evaluationCts = new CancellationTokenSource();
evaluationTask = EvaluateUntilCancelled(contexts, evaluationCts.Token, ct); // will raise Mutate
} else {
evaluationCts = null;
evaluationTask = Task.CompletedTask;
OnMutated();
}
=======
var evaluationCts = new CancellationTokenSource();
var evaluationTask = EvaluateUntilCancelled(contexts, evaluationCts.Token, ct); // will raise Mutate
>>>>>>>
CancellationTokenSource evaluationCts;
Task evaluationTask;
evaluationCts = new CancellationTokenSource();
evaluationTask = EvaluateUntilCancelled(contexts, evaluationCts.Token, ct); // will raise Mutate |
<<<<<<<
using System.ComponentModel.Composition;
using Microsoft.R.Components.ContentTypes;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.ComponentModel.Composition;
using Microsoft.R.Editor.ContentType;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.ComponentModel.Composition;
using Microsoft.R.Components.ContentTypes; |
<<<<<<<
=======
using Microsoft.VisualStudio.R.Package.Debugger.Commands;
using Microsoft.VisualStudio.R.Package.Documentation;
>>>>>>>
using Microsoft.VisualStudio.R.Package.Debugger.Commands;
using Microsoft.VisualStudio.R.Package.Documentation;
<<<<<<<
new LoadWorkspaceCommand(interactiveWorkflow, projectServiceAccessor),
new SaveWorkspaceCommand(interactiveWorkflow, projectServiceAccessor),
=======
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRtvsDocumentation, DocumentationUrls.RtvsDocumentation),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRtvsSamples, DocumentationUrls.RtvsSamples),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRDocsIntroToR, DocumentationUrls.CranIntro),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRDocsTaskViews, DocumentationUrls.CranViews),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRDocsDataImportExport, DocumentationUrls.CranData),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRDocsWritingRExtensions, DocumentationUrls.CranExtensions),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdCheckForUpdates, DocumentationUrls.CheckForRtvsUpdates),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdMicrosoftRProducts, DocumentationUrls.MicrosoftRProducts),
new LoadWorkspaceCommand(rSessionProvider, projectServiceAccessor),
new SaveWorkspaceCommand(rSessionProvider, projectServiceAccessor),
>>>>>>>
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRtvsDocumentation, DocumentationUrls.RtvsDocumentation),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRtvsSamples, DocumentationUrls.RtvsSamples),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRDocsIntroToR, DocumentationUrls.CranIntro),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRDocsTaskViews, DocumentationUrls.CranViews),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRDocsDataImportExport, DocumentationUrls.CranData),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdRDocsWritingRExtensions, DocumentationUrls.CranExtensions),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdCheckForUpdates, DocumentationUrls.CheckForRtvsUpdates),
new OpenDocumentationCommand(RGuidList.RCmdSetGuid, RPackageCommandId.icmdMicrosoftRProducts, DocumentationUrls.MicrosoftRProducts),
new LoadWorkspaceCommand(interactiveWorkflow, projectServiceAccessor),
new SaveWorkspaceCommand(interactiveWorkflow, projectServiceAccessor), |
<<<<<<<
using Microsoft.Common.Core.Enums;
using Microsoft.R.Components.Settings;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.Common.Core.Enums;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.Common.Core.Enums;
using Microsoft.R.Components.Settings; |
<<<<<<<
using System.Windows.Input;
using Microsoft.Languages.Editor.Controller;
=======
using System.Linq;
using System.Windows;
using System.Windows.Input;
using Microsoft.Languages.Editor;
>>>>>>>
using System.Linq;
using System.Windows;
using System.Windows.Input;
<<<<<<<
using Microsoft.Languages.Editor.Services;
using Microsoft.R.Components.Controller;
=======
using Microsoft.Languages.Editor.Shell;
using Microsoft.R.Editor.Selection;
using Microsoft.VisualStudio.Text;
>>>>>>>
using Microsoft.Languages.Editor.Shell;
using Microsoft.R.Components.Controller;
using Microsoft.R.Editor.Selection;
using Microsoft.VisualStudio.Text; |
<<<<<<<
using Microsoft.Common.Core.Shell;
=======
using Microsoft.Common.Core.Tasks;
>>>>>>>
using Microsoft.Common.Core.Shell;
using Microsoft.Common.Core.Tasks;
<<<<<<<
IColorService ColorService { get; }
=======
ITaskService Tasks { get; }
>>>>>>>
ITaskService Tasks { get; }
IColorService ColorService { get; } |
<<<<<<<
protected override IClassifier CreateClassifier(ITextBuffer textBuffer, IClassificationTypeRegistryService crs, IContentTypeRegistryService ctrs, IEnumerable<Lazy<IClassificationNameProvider, IComponentContentTypes>> ClassificationNameProviders) {
var classifier = ServiceManager.GetService<MdClassifier>(textBuffer);
if (classifier == null) {
classifier = new MdClassifier(textBuffer, ClassificationRegistryService, ContentTypeRegistryService, ClassificationNameProviders);
}
return classifier;
=======
private readonly IClassificationTypeRegistryService _classificationRegistryService;
private readonly IContentTypeRegistryService _contentTypeRegistryService;
private readonly IEnumerable<Lazy<IClassificationNameProvider, IComponentContentTypes>> _classificationNameProviders;
[ImportingConstructor]
public MdClassifierProvider(IClassificationTypeRegistryService crs, IContentTypeRegistryService ctrs, IEnumerable<Lazy<IClassificationNameProvider, IComponentContentTypes>> cnp) {
_classificationRegistryService = crs;
_contentTypeRegistryService = ctrs;
_classificationNameProviders = cnp;
}
protected override IClassifier CreateClassifier(ITextBuffer textBuffer) {
return new MdClassifier(textBuffer, _classificationRegistryService, _contentTypeRegistryService, _classificationNameProviders);
>>>>>>>
[ImportingConstructor]
public MdClassifierProvider(IClassificationTypeRegistryService crs, IContentTypeRegistryService ctrs, IEnumerable<Lazy<IClassificationNameProvider, IComponentContentTypes>> cnp) {
_classificationRegistryService = crs;
_contentTypeRegistryService = ctrs;
_classificationNameProviders = cnp;
}
protected override IClassifier CreateClassifier(ITextBuffer textBuffer, IClassificationTypeRegistryService crs, IContentTypeRegistryService ctrs, IEnumerable<Lazy<IClassificationNameProvider, IComponentContentTypes>> ClassificationNameProviders) {
var classifier = ServiceManager.GetService<MdClassifier>(textBuffer);
if (classifier == null) {
classifier = new MdClassifier(textBuffer, ClassificationRegistryService, ContentTypeRegistryService, ClassificationNameProviders);
}
return classifier; |
<<<<<<<
using System.ComponentModel.Composition;
using Microsoft.R.Components.ContentTypes;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.ComponentModel.Composition;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.ComponentModel.Composition;
using Microsoft.R.Components.ContentTypes; |
<<<<<<<
using Microsoft.R.Host.Client.Host;
=======
using Microsoft.R.Host.Client.Extensions;
>>>>>>>
using Microsoft.R.Host.Client.Extensions;
using Microsoft.R.Host.Client.Host;
<<<<<<<
await _interactiveWorkflow.RSession.ExportToBitmapAsync(deviceName, outputFilePath, _lastPixelWidth, _lastPixelHeight, _lastResolution);
} catch (RHostDisconnectedException ex) {
=======
var bitmapResult = await _interactiveWorkflow.RSession.ExportToBitmapAsync(deviceName, outputFilePath, _lastPixelWidth, _lastPixelHeight, _lastResolution);
bitmapResult.SaveRawDataToFile(outputFilePath);
} catch (MessageTransportException ex) {
>>>>>>>
var bitmapResult = await _interactiveWorkflow.RSession.ExportToBitmapAsync(deviceName, outputFilePath, _lastPixelWidth, _lastPixelHeight, _lastResolution);
bitmapResult.SaveRawDataToFile(outputFilePath);
} catch (RHostDisconnectedException ex) {
<<<<<<<
await _interactiveWorkflow.RSession.ExportToMetafileAsync(outputFilePath, PixelsToInches(_lastPixelWidth), PixelsToInches(_lastPixelHeight), _lastResolution);
} catch (RHostDisconnectedException ex) {
=======
var metafileResult = await _interactiveWorkflow.RSession.ExportToMetafileAsync(outputFilePath, PixelsToInches(_lastPixelWidth), PixelsToInches(_lastPixelHeight), _lastResolution);
metafileResult.SaveRawDataToFile(outputFilePath);
} catch (MessageTransportException ex) {
>>>>>>>
var metafileResult = await _interactiveWorkflow.RSession.ExportToMetafileAsync(outputFilePath, PixelsToInches(_lastPixelWidth), PixelsToInches(_lastPixelHeight), _lastResolution);
metafileResult.SaveRawDataToFile(outputFilePath);
} catch (RHostDisconnectedException ex) {
<<<<<<<
await _interactiveWorkflow.RSession.ExportToPdfAsync(outputFilePath, PixelsToInches(_lastPixelWidth), PixelsToInches(_lastPixelHeight));
} catch (RHostDisconnectedException ex) {
=======
var pdfResult = await _interactiveWorkflow.RSession.ExportToPdfAsync(outputFilePath, PixelsToInches(_lastPixelWidth), PixelsToInches(_lastPixelHeight));
pdfResult.SaveRawDataToFile(outputFilePath);
} catch (MessageTransportException ex) {
>>>>>>>
var pdfResult = await _interactiveWorkflow.RSession.ExportToPdfAsync(outputFilePath, PixelsToInches(_lastPixelWidth), PixelsToInches(_lastPixelHeight));
pdfResult.SaveRawDataToFile(outputFilePath);
} catch (RHostDisconnectedException ex) { |
<<<<<<<
[ProvideCodeExpansions(RGuidList.RLanguageServiceGuidString, false, 0,
RContentTypeDefinition.LanguageName, @"Snippets\SnippetsIndex.xml")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "analysis", @"Snippets\analysis")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "datasets", @"Snippets\datasets")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "distributions", @"Snippets\distributions")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "flow", @"Snippets\flow")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "graphics", @"Snippets\graphics")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "operators", @"Snippets\operators")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "rodbc", @"Snippets\rodbc")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-analysis", @"Snippets\mrs-analysis")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-chunking", @"Snippets\mrs-chunking")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-computeContext", @"Snippets\mrs-computeContext")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-data", @"Snippets\mrs-data")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-distributed", @"Snippets\mrs-distributed")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-graphics", @"Snippets\mrs-graphics")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-transforms", @"Snippets\mrs-transforms")]
=======
#region RProj editor factory
// Provide editor factory that instead of opening .rproj file in the editor
// locates matching .rxproj file, if any, and opens the project instead.
[ProvideEditorExtension(typeof(RProjEditorFactory), RContentTypeDefinition.RStudioProjectExtension, 0x32, NameResourceID = 108, ProjectGuid = RGuidList.CpsProjectFactoryGuidString)]
[ProvideLanguageExtension(RGuidList.RProjEditorFactoryGuidString, RContentTypeDefinition.RStudioProjectExtension)]
[ProvideLanguageService(typeof(RProjLanguageService), RContentTypeDefinition.RProjectName, 108)]
[ProvideEditorFactory(typeof(RProjEditorFactory), 200, CommonPhysicalViewAttributes = 0x2, TrustLevel = __VSEDITORTRUSTLEVEL.ETL_AlwaysTrusted)]
[ProvideEditorLogicalView(typeof(RProjEditorFactory), VSConstants.LOGVIEWID.TextView_string)]
#endregion
>>>>>>>
[ProvideCodeExpansions(RGuidList.RLanguageServiceGuidString, false, 0,
RContentTypeDefinition.LanguageName, @"Snippets\SnippetsIndex.xml")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "analysis", @"Snippets\analysis")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "datasets", @"Snippets\datasets")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "distributions", @"Snippets\distributions")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "flow", @"Snippets\flow")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "graphics", @"Snippets\graphics")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "operators", @"Snippets\operators")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "rodbc", @"Snippets\rodbc")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-analysis", @"Snippets\mrs-analysis")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-chunking", @"Snippets\mrs-chunking")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-computeContext", @"Snippets\mrs-computeContext")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-data", @"Snippets\mrs-data")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-distributed", @"Snippets\mrs-distributed")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-graphics", @"Snippets\mrs-graphics")]
[ProvideCodeExpansionPath(RContentTypeDefinition.LanguageName, "mrs-transforms", @"Snippets\mrs-transforms")]
#region RProj editor factory
// Provide editor factory that instead of opening .rproj file in the editor
// locates matching .rxproj file, if any, and opens the project instead.
[ProvideEditorExtension(typeof(RProjEditorFactory), RContentTypeDefinition.RStudioProjectExtension, 0x32, NameResourceID = 108, ProjectGuid = RGuidList.CpsProjectFactoryGuidString)]
[ProvideLanguageExtension(RGuidList.RProjEditorFactoryGuidString, RContentTypeDefinition.RStudioProjectExtension)]
[ProvideLanguageService(typeof(RProjLanguageService), RContentTypeDefinition.RProjectName, 108)]
[ProvideEditorFactory(typeof(RProjEditorFactory), 200, CommonPhysicalViewAttributes = 0x2, TrustLevel = __VSEDITORTRUSTLEVEL.ETL_AlwaysTrusted)]
[ProvideEditorLogicalView(typeof(RProjEditorFactory), VSConstants.LOGVIEWID.TextView_string)]
#endregion |
<<<<<<<
replWindow.EnqueueCode(text, addNewLine);
=======
ReplWindow.Show();
replWindow.InsertCodeMaybeExecute(text, addNewLine);
>>>>>>>
ReplWindow.Show();
replWindow.EnqueueCode(text, addNewLine); |
<<<<<<<
struct MessagePos {
public string Message;
public int Position;
}
private readonly ConcurrentStack<MessagePos> _messageStack = new ConcurrentStack<MessagePos>();
=======
private volatile string _lastMessage;
private int _lastPosition = -1;
>>>>>>>
struct MessagePos {
public string Message;
public int Position;
}
private readonly ConcurrentStack<MessagePos> _messageStack = new ConcurrentStack<MessagePos>();
<<<<<<<
if (CurrentWindow != null) {
_coreShell.DispatchOnUIThread(() => {
CurrentWindow.FlushOutput();
// If message starts with CR we remember current output buffer
// length so we can continue writing lines into the same spot.
// See txtProgressBar in R.
if (message.Length > 1 && message[0] == '\r' && message[1] != '\n') {
// Store the message and the initial position. All subsequent
// messages that start with CR. Will be written into the same place.
var mp = new MessagePos() {
Message = message.Substring(1),
Position = CurrentWindow.OutputBuffer.CurrentSnapshot.Length
};
message = "$"; // replacement placeholder so we can receive 'buffer changed' event
_messageStack.Push(mp);
}
=======
// If the message starts with \r with no \n following it, it is an attempt to overwrite the previous line
// of text in place, as used by e.g. R txtProgressBar() function. Since VS REPL doesn't support it directly,
// we need to handle it ourselves here.
// Note: DispatchOnUIThread is expensive, and can saturate the message pump when there's a lot of output,
// making UI non-responsive. So avoid using it unless we need it - and we only need it for FlushOutput,
// and to synchronize _lastMessage.
if (message.Length > 1 && message[0] == '\r' && message[1] != '\n') {
_coreShell.DispatchOnUIThread(() => {
// Remember current output buffer length so that we can continue writing lines into the same spot.
// Store the message and the initial position. All subsequent messages that start with \r will be
// written into the same place.
_lastMessage = message.Substring(1);
_lastPosition = _lastPosition < 0 ? CurrentWindow.OutputBuffer.CurrentSnapshot.Length : _lastPosition;
message = "|"; // replacement placeholder so we can receive 'buffer changed' event
>>>>>>>
if (CurrentWindow != null) {
// Note: DispatchOnUIThread is expensive, and can saturate the message pump when there's a lot of output,
// making UI non-responsive. So avoid using it unless we need it - and we only need it for FlushOutput,
// and to synchronize _lastMessage.
_coreShell.DispatchOnUIThread(() => {
CurrentWindow.FlushOutput();
// If message starts with CR we remember current output buffer
// length so we can continue writing lines into the same spot.
// See txtProgressBar in R.
if (message.Length > 1 && message[0] == '\r' && message[1] != '\n') {
// Store the message and the initial position. All subsequent
// messages that start with CR. Will be written into the same place.
var mp = new MessagePos() {
Message = message.Substring(1),
Position = CurrentWindow.OutputBuffer.CurrentSnapshot.Length
};
message = "$"; // replacement placeholder so we can receive 'buffer changed' event
_messageStack.Push(mp);
}
<<<<<<<
});
}
=======
});
} else {
if (_lastMessage != null) {
// Stop tracking position for \r handling, using UI thread to synchronize access.
_coreShell.DispatchOnUIThread(() => _lastMessage = null);
}
CurrentWindow.Write(message);
}
>>>>>>>
});
} |
<<<<<<<
Process = new ProcessServices();
=======
ProcessServices = processServices;
>>>>>>>
Process = new ProcessServices();
<<<<<<<
Process = ps;
Registry = registry;
=======
ProcessServices = ps;
>>>>>>>
Process = ps;
<<<<<<<
public IProcessServices Process { get; }
public IRegistry Registry { get; }
=======
public IProcessServices ProcessServices { get; }
>>>>>>>
public IProcessServices Process { get; } |
<<<<<<<
using System.Windows;
=======
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Threading;
>>>>>>>
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows;
<<<<<<<
=======
using System.Windows.Threading;
using Microsoft.Common.Core;
>>>>>>>
using Microsoft.Common.Core;
<<<<<<<
internal sealed class HelpWindowVisualComponent : IHelpWindowVisualComponent {
private static bool _showDefaultPage;
=======
public sealed class HelpWindowVisualComponent : IHelpWindowVisualComponent {
>>>>>>>
internal sealed class HelpWindowVisualComponent : IHelpWindowVisualComponent {
<<<<<<<
=======
private WindowsFormsHost _host;
private Color? _lastDefaultBackground;
>>>>>>>
private WindowsFormsHost _host;
private Color? _lastDefaultBackground;
<<<<<<<
_windowContentControl = new ContentControl();
Control = _windowContentControl;
CreateBrowser(_showDefaultPage);
=======
_windowContentControl = new System.Windows.Controls.ContentControl();
this.Control = _windowContentControl;
>>>>>>>
_windowContentControl = new ContentControl();
Control = _windowContentControl;
<<<<<<<
VsAppShell.Current.DispatchOnUIThread(CloseBrowser);
=======
VsAppShell.Current.DispatchOnUIThread(() => {
CloseBrowser();
});
>>>>>>>
VsAppShell.Current.DispatchOnUIThread(CloseBrowser); |
<<<<<<<
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using System.Threading;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection; |
<<<<<<<
/// Looks up a localized string similar to Surround With.
/// </summary>
public static string SurroundWith {
get {
return ResourceManager.GetString("SurroundWith", resourceCulture);
}
}
/// <summary>
=======
/// Looks up a localized string similar to Open in a Grid Viewer.
/// </summary>
public static string ShowDetailCommandTooltip {
get {
return ResourceManager.GetString("ShowDetailCommandTooltip", resourceCulture);
}
}
/// <summary>
>>>>>>>
/// Looks up a localized string similar to Open in a Grid Viewer.
/// </summary>
public static string ShowDetailCommandTooltip {
get {
return ResourceManager.GetString("ShowDetailCommandTooltip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Surround With.
/// </summary>
public static string SurroundWith {
get {
return ResourceManager.GetString("SurroundWith", resourceCulture);
}
}
/// <summary> |
<<<<<<<
using Microsoft.R.Components.InteractiveWorkflow;
using Microsoft.R.Host.Client;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.R.Host.Client;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.R.Components.InteractiveWorkflow;
using Microsoft.R.Host.Client; |
<<<<<<<
using System;
using System.Collections.Generic;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic; |
<<<<<<<
using System;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using Microsoft.Languages.Editor;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System; |
<<<<<<<
private const string Ns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation";
private const string SetupCode = @"
xaml <- function(filename, width, height) { .External('rtvs::External.xaml_graphicsdevice_new', filename, width, height)}
=======
private const string ns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation";
private const string setupCode = @"
xaml <- function(filename, width, height) { .External('Microsoft.R.Host::External.xaml_graphicsdevice_new', filename, width, height)}
>>>>>>>
private const string Ns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation";
private const string SetupCode = @"
xaml <- function(filename, width, height) { .External('Microsoft.R.Host::External.xaml_graphicsdevice_new', filename, width, height)} |
<<<<<<<
using System;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using Microsoft.Languages.Editor;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System; |
<<<<<<<
using System;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Text;
using Microsoft.Languages.Editor;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System; |
<<<<<<<
/// Looks up a localized string similar to R Plot - Locator is Active.
/// </summary>
public static string PlotWindowCaptionLocatorActive {
get {
return ResourceManager.GetString("PlotWindowCaptionLocatorActive", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Locator is active. Click in the plot window to select points then choose End Locator..
/// </summary>
public static string PlotWindowStatusLocatorActive {
get {
return ResourceManager.GetString("PlotWindowStatusLocatorActive", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Visual Studio detected that Microsoft R Client was recently installed. Would you like to start using R from the Microsoft R Client?.
/// </summary>
public static string Prompt_MsRClientJustInstalled {
get {
return ResourceManager.GetString("Prompt_MsRClientJustInstalled", resourceCulture);
}
}
/// <summary>
=======
>>>>>>>
/// Looks up a localized string similar to Visual Studio detected that Microsoft R Client was recently installed. Would you like to start using R from the Microsoft R Client?.
/// </summary>
public static string Prompt_MsRClientJustInstalled {
get {
return ResourceManager.GetString("Prompt_MsRClientJustInstalled", resourceCulture);
}
}
/// <summary> |
<<<<<<<
using Microsoft.Languages.Editor;
=======
using Microsoft.Languages.Editor.Extensions;
using Microsoft.Languages.Editor.Text;
>>>>>>>
using Microsoft.Languages.Editor.Extensions;
using Microsoft.Languages.Editor.Text;
using Microsoft.Languages.Editor; |
<<<<<<<
public HostLoadIndicatorViewModelTest(RComponentsShellProviderFixture shellProvider) {
_coreShell = shellProvider.CoreShell;
}
[Test]
public async Task Update() {
=======
[Test(ThreadType.UI)]
public void Update() {
>>>>>>>
public HostLoadIndicatorViewModelTest(RComponentsShellProviderFixture shellProvider) {
_coreShell = shellProvider.CoreShell;
}
[Test(ThreadType.UI)]
public async Task Update() { |
<<<<<<<
return _interactiveWorkflow.ActiveWindow != null ? CommandStatus.SupportedAndEnabled : CommandStatus.Supported;
=======
if (ReplWindow.ReplWindowExists) {
return CommandStatus.SupportedAndEnabled;
}
return CommandStatus.Invisible;
>>>>>>>
return _interactiveWorkflow.ActiveWindow != null ? CommandStatus.SupportedAndEnabled : CommandStatus.Invisible; |
<<<<<<<
using System;
=======
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using Microsoft.Languages.Editor;
>>>>>>>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System; |
<<<<<<<
Task PingAsync();
=======
AboutHost AboutHost { get; }
>>>>>>>
AboutHost AboutHost { get; }
Task PingAsync(); |
<<<<<<<
this.contextMenuStripAssets.Size = new System.Drawing.Size(350, 408);
=======
this.contextMenuStripAssets.Size = new System.Drawing.Size(350, 414);
>>>>>>>
this.contextMenuStripAssets.Size = new System.Drawing.Size(350, 414);
<<<<<<<
private System.Windows.Forms.ToolStripMenuItem refreshOriginLocatorsExpirationTime;
=======
private System.Windows.Forms.Label label19;
private System.Windows.Forms.ComboBox comboBoxOrderStreamingEndpoints;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator18;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem3;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator20;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem4;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator21;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem5;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator25;
private System.Windows.Forms.ContextMenuStrip contextMenuStripProcessors;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem6;
private System.Windows.Forms.ToolStripMenuItem displayErrorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayErrorToolStripMenuItem1;
>>>>>>>
private System.Windows.Forms.Label label19;
private System.Windows.Forms.ComboBox comboBoxOrderStreamingEndpoints;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator18;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem3;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator20;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem4;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator21;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem5;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator25;
private System.Windows.Forms.ContextMenuStrip contextMenuStripProcessors;
private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem6;
private System.Windows.Forms.ToolStripMenuItem displayErrorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayErrorToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem refreshOriginLocatorsExpirationTime; |
<<<<<<<
Task.Factory.StartNew(() => ProcessUploadFileAndMore(file, response.Id, Properties.Settings.Default.useStorageEncryption ? AssetCreationOptions.StorageEncrypted : AssetCreationOptions.None, response.token), response.token);
DotabControlMainSwitch(AMSExplorer.Properties.Resources.TabTransfers);
=======
Task.Factory.StartNew(() => ProcessUploadFileAndMore(FileNames.ToList(), response.Id, form.AssetCreationOptions, response.token, storageaccount: form.StorageSelected), response.token);
DotabControlMainSwitch(Constants.TabTransfers);
>>>>>>>
Task.Factory.StartNew(() => ProcessUploadFileAndMore(FileNames.ToList(), response.Id, form.AssetCreationOptions, response.token, storageaccount: form.StorageSelected), response.token);
DotabControlMainSwitch(Constants.TabTransfers);
<<<<<<<
if (form.ShowDialog() == DialogResult.OK)
{
var response = DoGridTransferAddItem(string.Format("Import from Http of '{0}'", form.GetAssetFileName), TransferType.ImportFromHttp, false);
// Start a worker thread that does uploading.
var myTask = Task.Factory.StartNew(() => ProcessImportFromHttp(form.GetURL, form.GetAssetName, form.GetAssetFileName, response.Id, response.token), response.token);
DotabControlMainSwitch(AMSExplorer.Properties.Resources.TabTransfers);
=======
string valuekey = "";
if (Program.InputBox("Storage Account Key Needed", "Please enter the Storage Account Access Key for " + _context.DefaultStorageAccount.Name + ":", ref valuekey, true) == DialogResult.OK)
{
_credentials.DefaultStorageKey = passwordDestStorage = valuekey;
havestoragecredentials = true;
}
else
{
return;
}
>>>>>>>
string valuekey = "";
if (Program.InputBox("Storage Account Key Needed", "Please enter the Storage Account Access Key for " + _context.DefaultStorageAccount.Name + ":", ref valuekey, true) == DialogResult.OK)
{
_credentials.DefaultStorageKey = passwordDestStorage = valuekey;
havestoragecredentials = true;
}
else
{
return;
}
<<<<<<<
if (form.ShowDialog() == DialogResult.OK)
{
var response = DoGridTransferAddItem(string.Format("Import from SAS Container Path '{0}'", form.GetAssetFileName), TransferType.ImportFromHttp, false);
// Start a worker thread that does uploading.
var myTask = Task.Factory.StartNew(() => ProcessImportFromStorageContainerSASUrl(form.GetURL, form.GetAssetName, response), response.token);
DotabControlMainSwitch(AMSExplorer.Properties.Resources.TabTransfers);
=======
string valuekey = "";
if (Program.InputBox("Storage Account Key Needed", "Please enter the Storage Account Access Key for " + _context.DefaultStorageAccount.Name + ":", ref valuekey, true) == DialogResult.OK)
{
_credentials.DefaultStorageKey = passwordDestStorage = valuekey;
havestoragecredentials = true;
}
else
{
return;
}
>>>>>>>
string valuekey = "";
if (Program.InputBox("Storage Account Key Needed", "Please enter the Storage Account Access Key for " + _context.DefaultStorageAccount.Name + ":", ref valuekey, true) == DialogResult.OK)
{
_credentials.DefaultStorageKey = passwordDestStorage = valuekey;
havestoragecredentials = true;
}
else
{
return;
}
<<<<<<<
DotabControlMainSwitch(AMSExplorer.Properties.Resources.TabJobs);
=======
else
{
foreach (IAsset asset in form.SelectedAssets)
{
bool Error = false;
string jobnameloc = form.EncodingJobName.Replace(Constants.NameconvInputasset, asset.Name);
IJob job = _context.Jobs.Create(jobnameloc, form.JobOptions.Priority);
string tasknameloc = taskname.Replace(Constants.NameconvInputasset, asset.Name).Replace(Constants.NameconvEncodername, processor.Name + " v" + processor.Version);
ITask AMEStandardTask = job.Tasks.AddNew(
tasknameloc,
processor,
form.EncodingConfiguration,
form.JobOptions.TasksOptionsSetting
);
AMEStandardTask.InputAssets.Add(asset);
// Add an output asset to contain the results of the job.
string outputassetnameloc = form.EncodingOutputAssetName.Replace(Constants.NameconvInputasset, asset.Name);
AMEStandardTask.OutputAssets.AddNew(outputassetnameloc, form.JobOptions.StorageSelected, form.JobOptions.OutputAssetsCreationOptions);
// Submit the job
TextBoxLogWriteLine("Submitting job '{0}'", jobnameloc);
try
{
job.Submit();
}
catch (Exception e)
{
// Add useful information to the exception
if (SelectedAssets.Count < 5)
{
MessageBox.Show(string.Format("There has been a problem when submitting the job '{0}'", jobnameloc) + Constants.endline + Constants.endline + Program.GetErrorMessage(e), "Job Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
TextBoxLogWriteLine("There has been a problem when submitting the job '{0}' ", jobnameloc, true);
TextBoxLogWriteLine(e);
Error = true;
}
if (!Error) Task.Factory.StartNew(() => dataGridViewJobsV.DoJobProgress(job));
}
}
DotabControlMainSwitch(Constants.TabJobs);
>>>>>>>
else
{
foreach (IAsset asset in form.SelectedAssets)
{
bool Error = false;
string jobnameloc = form.EncodingJobName.Replace(Constants.NameconvInputasset, asset.Name);
IJob job = _context.Jobs.Create(jobnameloc, form.JobOptions.Priority);
string tasknameloc = taskname.Replace(Constants.NameconvInputasset, asset.Name).Replace(Constants.NameconvEncodername, processor.Name + " v" + processor.Version);
ITask AMEStandardTask = job.Tasks.AddNew(
tasknameloc,
processor,
form.EncodingConfiguration,
form.JobOptions.TasksOptionsSetting
);
AMEStandardTask.InputAssets.Add(asset);
// Add an output asset to contain the results of the job.
string outputassetnameloc = form.EncodingOutputAssetName.Replace(Constants.NameconvInputasset, asset.Name);
AMEStandardTask.OutputAssets.AddNew(outputassetnameloc, form.JobOptions.StorageSelected, form.JobOptions.OutputAssetsCreationOptions);
// Submit the job
TextBoxLogWriteLine("Submitting job '{0}'", jobnameloc);
try
{
job.Submit();
}
catch (Exception e)
{
// Add useful information to the exception
if (SelectedAssets.Count < 5)
{
MessageBox.Show(string.Format("There has been a problem when submitting the job '{0}'", jobnameloc) + Constants.endline + Constants.endline + Program.GetErrorMessage(e), "Job Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
TextBoxLogWriteLine("There has been a problem when submitting the job '{0}' ", jobnameloc, true);
TextBoxLogWriteLine(e);
Error = true;
}
if (!Error) Task.Factory.StartNew(() => dataGridViewJobsV.DoJobProgress(job));
}
}
DotabControlMainSwitch(AMSExplorer.Properties.Resources.TabJobs); |
<<<<<<<
/// <summary>
/// Ssl cipher.
/// </summary>
public class SslCipher : Base, IStackable
=======
class SslCipher : BaseReference<SslCipher>, IStackable
>>>>>>>
public class SslCipher : BaseReference<SslCipher>, IStackable
<<<<<<<
// SSL_CIPHERs come from a static list in ssl_ciph.c
// nothing to do here
=======
get
{
Initialize();
return authMethod;
}
}
internal override void AddRef()
{
// SSL_CIPHERs come from a static list in ssl_ciph.c
// nothing to do here
>>>>>>>
// SSL_CIPHERs come from a static list in ssl_ciph.c
// nothing to do here
<<<<<<<
{
// SSL_CIPHERs come from a static list in ssl_ciph.c
// no need to free them
=======
{
// SSL_CIPHERs come from a static list in ssl_ciph.c
// nothing to do here
>>>>>>>
{
// SSL_CIPHERs come from a static list in ssl_ciph.c
// nothing to do here |
<<<<<<<
InputProtocol = c.Input.StreamingProtocol,
Encoding = c.EncodingType != ChannelEncodingType.None ? EncodingImage : null,
IngestUrl = c.Input.Endpoints.FirstOrDefault().Url,
=======
InputProtocol = string.Format("{0} ({1})", c.Input.StreamingProtocol.ToString(), c.Input.Endpoints.Count),
InputUrl = c.Input.Endpoints.FirstOrDefault().Url,
>>>>>>>
InputProtocol = string.Format("{0} ({1})", c.Input.StreamingProtocol.ToString(), c.Input.Endpoints.Count),
Encoding = c.EncodingType != ChannelEncodingType.None ? EncodingImage : null,
InputUrl = c.Input.Endpoints.FirstOrDefault().Url,
<<<<<<<
public StreamingProtocol InputProtocol { get; set; }
public Bitmap Encoding { get; set; }
public Uri IngestUrl { get; set; }
=======
public string InputProtocol { get; set; }
public Uri InputUrl { get; set; }
>>>>>>>
public string InputProtocol { get; set; }
public Bitmap Encoding { get; set; }
public Uri InputUrl { get; set; } |
<<<<<<<
private void withAzureMediaPlayerToolStripMenuItem_Click(object sender, EventArgs e)
{
if (IsAssetCanBePlayed(ReturnSelectedAssets().FirstOrDefault(), ref PlayBackLocator))
AssetInfo.DoPlayBackWithBestStreamingEndpoint(PlayerType.AzureMediaPlayer, PlayBackLocator.GetSmoothStreamingUri(), _context, ReturnSelectedAssets().FirstOrDefault());
}
=======
>>>>>>>
private void withAzureMediaPlayerToolStripMenuItem_Click(object sender, EventArgs e)
{
if (IsAssetCanBePlayed(ReturnSelectedAssets().FirstOrDefault(), ref PlayBackLocator))
AssetInfo.DoPlayBackWithBestStreamingEndpoint(PlayerType.AzureMediaPlayer, PlayBackLocator.GetSmoothStreamingUri(), _context, ReturnSelectedAssets().FirstOrDefault());
} |
<<<<<<<
DGChannel.Rows.Add(string.Format(AMSExplorer.Properties.Resources.ChannelInformation_ChannelInformation_Load_PreviewURL0, endpoint.Protocol), endpoint.Url);
=======
foreach (var endpoint in MyChannel.Preview.Endpoints)
{
DGChannel.Rows.Add(string.Format("Preview URL ({0})", endpoint.Protocol), endpoint.Url);
}
>>>>>>>
foreach (var endpoint in MyChannel.Preview.Endpoints)
{
DGChannel.Rows.Add(string.Format(AMSExplorer.Properties.Resources.ChannelInformation_ChannelInformation_Load_PreviewURL0, endpoint.Protocol), endpoint.Url);
} |
<<<<<<<
CDNIndexHandler.Cache.Enabled = flags.UseCache;
CDNIndexHandler.Cache.CacheData = flags.CacheData;
CDNIndexHandler.Cache.Validate = flags.ValidateCache;
CASCConfig config = null;
// ngdp:us:pro
// http:us:pro:us.patch.battle.net:1119
if (root.ToLowerInvariant().Substring(0, 5) == "ngdp:") {
string cdn = root.Substring(5, 4);
string[] parts = root.Substring(5).Split(':');
string region = "us";
string product = "pro";
if (parts.Length > 1) {
region = parts[1];
}
if (parts.Length > 2) {
product = parts[2];
}
if (cdn == "bnet") {
config = CASCConfig.LoadOnlineStorageConfig(product, region);
} else {
if (cdn == "http") {
string host = string.Join(":", parts.Skip(3));
config = CASCConfig.LoadOnlineStorageConfig(host, product, region, true, true);
}
}
} else {
config = CASCConfig.LoadLocalStorageConfig(root, !flags.SkipKeys, false);
}
config.Languages = new HashSet<string>(new string[1] { flags.Language });
=======
>>>>>>>
CDNIndexHandler.Cache.Enabled = flags.UseCache;
CDNIndexHandler.Cache.CacheData = flags.CacheData;
CDNIndexHandler.Cache.Validate = flags.ValidateCache;
CASCConfig config = null;
// ngdp:us:pro
// http:us:pro:us.patch.battle.net:1119
if (root.ToLowerInvariant().Substring(0, 5) == "ngdp:") {
string cdn = root.Substring(5, 4);
string[] parts = root.Substring(5).Split(':');
string region = "us";
string product = "pro";
if (parts.Length > 1) {
region = parts[1];
}
if (parts.Length > 2) {
product = parts[2];
}
if (cdn == "bnet") {
config = CASCConfig.LoadOnlineStorageConfig(product, region);
} else {
if (cdn == "http") {
string host = string.Join(":", parts.Skip(3));
config = CASCConfig.LoadOnlineStorageConfig(host, product, region, true, true);
}
}
} else {
config = CASCConfig.LoadLocalStorageConfig(root, !flags.SkipKeys, false);
}
config.Languages = new HashSet<string>(new string[1] { flags.Language });
<<<<<<<
=======
CASCConfig config = CASCConfig.LoadLocalStorageConfig(root, !flags.SkipKeys, false);
config.Languages = new HashSet<string>(new string[1] { flags.Language });
>>>>>>> |
<<<<<<<
public IList<Measurement> AllMeasurements { get; }
public GcStats GcStats { get; }
=======
public IReadOnlyList<Measurement> AllMeasurements { get; }
>>>>>>>
public IReadOnlyList<Measurement> AllMeasurements { get; }
public GcStats GcStats { get; }
<<<<<<<
IList<ExecuteResult> executeResults,
IList<Measurement> allMeasurements,
GcStats gcStats)
=======
IReadOnlyList<ExecuteResult> executeResults,
IReadOnlyList<Measurement> allMeasurements)
>>>>>>>
IReadOnlyList<ExecuteResult> executeResults,
IReadOnlyList<Measurement> allMeasurements,
GcStats gcStats) |
<<<<<<<
=======
public static void ExportToFile(IBenchmarkExporter exporter, IList<BenchmarkReport> reports, string competitionName,
IEnumerable<IBenchmarkResultExtender> resultExtenders = null)
{
using (var stream = new StreamWriter(competitionName + "-report." + exporter.Name))
exporter.Export(reports, new BenchmarkStreamLogger(stream), resultExtenders);
}
>>>>>>>
<<<<<<<
public static List<string[]> BuildTable(IList<BenchmarkReport> reports, bool pretty = true)
=======
public static List<string[]> BuildTable(IList<BenchmarkReport> reports,
IEnumerable<IBenchmarkResultExtender> resultExtenders = null,
bool pretty = true, bool extended = false)
>>>>>>>
public static List<string[]> BuildTable(IList<BenchmarkReport> reports,
IEnumerable<IBenchmarkResultExtender> resultExtenders = null,
bool pretty = true, bool extended = false)
<<<<<<<
headerRow.Add("Error");
=======
headerRow.Add("StdDev");
headerRow.Add("op/s");
if (extended)
headerRow.Add("StdErr");
if (resultExtenders != null)
{
foreach (var extender in resultExtenders)
headerRow.Add(extender.ColumnName);
}
>>>>>>>
headerRow.Add("Error");
if (resultExtenders != null)
{
foreach (var extender in resultExtenders)
headerRow.Add(extender.ColumnName);
}
<<<<<<<
foreach (var item in orderedData)
=======
var rowNumber = 0;
foreach (var reportStat in orderedStats)
>>>>>>>
var rowNumber = 0;
foreach (var item in orderedData) |
<<<<<<<
public SetupAttributeTest(ITestOutputHelper output) : base(output) { }
=======
private const string SetupCalled = "// ### Setup called ###";
private const string BenchmarkCalled = "// ### Benchmark called ###";
>>>>>>>
private const string SetupCalled = "// ### Setup called ###";
private const string BenchmarkCalled = "// ### Benchmark called ###";
public SetupAttributeTest(ITestOutputHelper output) : base(output) { } |
<<<<<<<
using BenchmarkDotNet.Helpers;
using BenchmarkDotNet.Horology;
=======
>>>>>>>
using BenchmarkDotNet.Horology;
<<<<<<<
public void Foo()
{
}
[Benchmark]
public void Bar()
{
}
}
public class MockHostEnvironmentInfo : HostEnvironmentInfo
{
public static MockHostEnvironmentInfo Default = new MockHostEnvironmentInfo
{
Architecture = "64bit",
BenchmarkDotNetVersion = "0.10.3.20170408-develop",
ChronometerFrequency = new Frequency(2531248),
Configuration = "RELEASE",
DotNetCliVersion = new Lazy<string>(() => "1.0.0"),
HardwareTimerKind = HardwareTimerKind.Tsc,
HasAttachedDebugger = false,
HasRyuJit = true,
IsConcurrentGC = false,
IsServerGC = false,
JitInfo = "RyuJIT-v4.6.1637.0",
JitModules = "clrjit-v4.6.1637.0",
OsVersion = new Lazy<string>(() => "Microsoft Windows NT 10.0.14393.0"),
ProcessorCount = 8,
ProcessorName = new Lazy<string>(() => "Intel(R) Core(TM) i7-6700HQ CPU 2.60GHz"),
RuntimeVersion = "Clr 4.0.30319.42000"
};
private MockHostEnvironmentInfo()
{
}
=======
public void Foo() { }
>>>>>>>
public void Foo()
{
}
[Benchmark]
public void Bar()
{
}
}
public class MockHostEnvironmentInfo : HostEnvironmentInfo
{
public static MockHostEnvironmentInfo Default = new MockHostEnvironmentInfo
{
Architecture = "64bit",
BenchmarkDotNetVersion = "0.10.3.20170408-develop",
ChronometerFrequency = new Frequency(2531248),
Configuration = "RELEASE",
DotNetCliVersion = new Lazy<string>(() => "1.0.0"),
HardwareTimerKind = HardwareTimerKind.Tsc,
HasAttachedDebugger = false,
HasRyuJit = true,
IsConcurrentGC = false,
IsServerGC = false,
JitInfo = "RyuJIT-v4.6.1637.0",
JitModules = "clrjit-v4.6.1637.0",
OsVersion = new Lazy<string>(() => "Microsoft Windows NT 10.0.14393.0"),
ProcessorCount = 8,
ProcessorName = new Lazy<string>(() => "Intel(R) Core(TM) i7-6700HQ CPU 2.60GHz"),
RuntimeVersion = "Clr 4.0.30319.42000"
};
private MockHostEnvironmentInfo()
{
} |
<<<<<<<
public string From { get; }
=======
[JsonConverter(typeof(KeyPairTypeAdapter))]
public KeyPair From { get; private set; }
>>>>>>>
public string From { get; private set; }
<<<<<<<
public string To { get; }
=======
[JsonConverter(typeof(KeyPairTypeAdapter))]
public KeyPair To { get; private set; }
>>>>>>>
public string To { get; private set; } |
<<<<<<<
public string Trustor { get; }
=======
[JsonConverter(typeof(KeyPairTypeAdapter))]
public KeyPair Trustor { get; private set; }
>>>>>>>
public string Trustor { get; private set; }
<<<<<<<
public string Trustee { get; }
=======
[JsonConverter(typeof(KeyPairTypeAdapter))]
public KeyPair Trustee { get; private set; }
>>>>>>>
public string Trustee { get; private set; } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.